1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Mike Farah
53a20d4421 Bumb version 2019-01-07 10:23:37 +11:00
Kyle Titus
478208b7c4 Added Windows support for the "--inplace" command flag 2019-01-07 10:07:08 +11:00
Mike Farah
1159d0a212 Fixing snapcraft yml 2018-11-21 13:39:03 +11:00
6 changed files with 39 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"runtime"
"strings"
"testing"
@@ -279,7 +280,12 @@ func TestReadCmd_ErrorUnreadableFile(t *testing.T) {
if result.Error == nil {
t.Error("Expected command to fail due to unknown file")
}
expectedOutput := `open fake-unknown: no such file or directory`
var expectedOutput string
if runtime.GOOS == "windows" {
expectedOutput = `open fake-unknown: The system cannot find the file specified.`
} else {
expectedOutput = `open fake-unknown: no such file or directory`
}
assertResult(t, expectedOutput, result.Error.Error())
}
@@ -493,7 +499,12 @@ func TestPrefixCmd_ErrorUnreadableFile(t *testing.T) {
if result.Error == nil {
t.Error("Expected command to fail due to unknown file")
}
expectedOutput := `open fake-unknown: no such file or directory`
var expectedOutput string
if runtime.GOOS == "windows" {
expectedOutput = `open fake-unknown: The system cannot find the file specified.`
} else {
expectedOutput = `open fake-unknown: no such file or directory`
}
assertResult(t, expectedOutput, result.Error.Error())
}
@@ -693,7 +704,12 @@ func TestWriteCmd_ErrorUnreadableFile(t *testing.T) {
if result.Error == nil {
t.Error("Expected command to fail due to unknown file")
}
expectedOutput := `open fake-unknown: no such file or directory`
var expectedOutput string
if runtime.GOOS == "windows" {
expectedOutput = `open fake-unknown: The system cannot find the file specified.`
} else {
expectedOutput = `open fake-unknown: no such file or directory`
}
assertResult(t, expectedOutput, result.Error.Error())
}
@@ -1019,7 +1035,12 @@ func TestMergeCmd_ErrorUnreadableFile(t *testing.T) {
if result.Error == nil {
t.Error("Expected command to fail due to unknown file")
}
expectedOutput := `Error updating document at index 0: open fake-unknown: no such file or directory`
var expectedOutput string
if runtime.GOOS == "windows" {
expectedOutput = `Error updating document at index 0: open fake-unknown: The system cannot find the file specified.`
} else {
expectedOutput = `Error updating document at index 0: open fake-unknown: no such file or directory`
}
assertResult(t, expectedOutput, result.Error.Error())
}

View File

@@ -1,5 +1,6 @@
- increment version in version.go
- increment version in snapcraft.yaml
- commit
- tag git with same version number
- be sure to also tag with 'v' for gopkg.in
- make sure local build passes
@@ -21,11 +22,11 @@
- brew
- brew bump-formula-pr --url=https://github.com/mikefarah/yq/archive/2.1.2.tar.gz yq
- brew bump-formula-pr --url=https://github.com/mikefarah/yq/archive/2.2.0.tar.gz yq
- docker
- build and push latest and new version tag
- docker build . --arg -t mikefarah/yq:latest -t mikefarah/yq:VERSION
- docker build . -t mikefarah/yq:latest -t mikefarah/yq:VERSION
- debian package
- execute

View File

@@ -1,5 +1,5 @@
name: yq
version: 2.2.0
version: '2.2.1'
summary: A lightweight and portable command-line YAML processor
description: |
The aim of the project is to be the jq or sed of yaml files.

View File

@@ -11,7 +11,7 @@ var (
GitDescribe string
// Version is main version number that is being run at the moment.
Version = "2.2.0"
Version = "2.2.1"
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release

4
yq.go
View File

@@ -462,11 +462,11 @@ func readAndUpdate(stdOut io.Writer, inputFile string, updateData updateDataFn)
if err != nil {
return err
}
err = tempFile.Chmod(info.Mode())
destinationName = tempFile.Name()
err = os.Chmod(destinationName, info.Mode())
if err != nil {
return err
}
destinationName = tempFile.Name()
destination = tempFile
defer func() {
safelyCloseFile(tempFile)

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"runtime"
"testing"
)
@@ -64,6 +65,11 @@ func TestNewYaml_WithUnknownScript(t *testing.T) {
if err == nil {
t.Error("Expected error due to unknown file")
}
expectedOutput := `open fake-unknown: no such file or directory`
var expectedOutput string
if runtime.GOOS == "windows" {
expectedOutput = `open fake-unknown: The system cannot find the file specified.`
} else {
expectedOutput = `open fake-unknown: no such file or directory`
}
assertResult(t, expectedOutput, err.Error())
}