mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53a20d4421 | ||
|
|
478208b7c4 | ||
|
|
1159d0a212 |
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -279,7 +280,12 @@ func TestReadCmd_ErrorUnreadableFile(t *testing.T) {
|
|||||||
if result.Error == nil {
|
if result.Error == nil {
|
||||||
t.Error("Expected command to fail due to unknown file")
|
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())
|
assertResult(t, expectedOutput, result.Error.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +499,12 @@ func TestPrefixCmd_ErrorUnreadableFile(t *testing.T) {
|
|||||||
if result.Error == nil {
|
if result.Error == nil {
|
||||||
t.Error("Expected command to fail due to unknown file")
|
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())
|
assertResult(t, expectedOutput, result.Error.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -693,7 +704,12 @@ func TestWriteCmd_ErrorUnreadableFile(t *testing.T) {
|
|||||||
if result.Error == nil {
|
if result.Error == nil {
|
||||||
t.Error("Expected command to fail due to unknown file")
|
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())
|
assertResult(t, expectedOutput, result.Error.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,7 +1035,12 @@ func TestMergeCmd_ErrorUnreadableFile(t *testing.T) {
|
|||||||
if result.Error == nil {
|
if result.Error == nil {
|
||||||
t.Error("Expected command to fail due to unknown file")
|
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())
|
assertResult(t, expectedOutput, result.Error.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
- increment version in version.go
|
- increment version in version.go
|
||||||
- increment version in snapcraft.yaml
|
- increment version in snapcraft.yaml
|
||||||
|
- commit
|
||||||
- tag git with same version number
|
- tag git with same version number
|
||||||
- be sure to also tag with 'v' for gopkg.in
|
- be sure to also tag with 'v' for gopkg.in
|
||||||
- make sure local build passes
|
- make sure local build passes
|
||||||
@@ -21,11 +22,11 @@
|
|||||||
|
|
||||||
|
|
||||||
- brew
|
- 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
|
- docker
|
||||||
- build and push latest and new version tag
|
- 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
|
- debian package
|
||||||
- execute
|
- execute
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: yq
|
name: yq
|
||||||
version: 2.2.0
|
version: '2.2.1'
|
||||||
summary: A lightweight and portable command-line YAML processor
|
summary: A lightweight and portable command-line YAML processor
|
||||||
description: |
|
description: |
|
||||||
The aim of the project is to be the jq or sed of yaml files.
|
The aim of the project is to be the jq or sed of yaml files.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ var (
|
|||||||
GitDescribe string
|
GitDescribe string
|
||||||
|
|
||||||
// Version is main version number that is being run at the moment.
|
// 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)
|
// 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
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
|
|||||||
4
yq.go
4
yq.go
@@ -462,11 +462,11 @@ func readAndUpdate(stdOut io.Writer, inputFile string, updateData updateDataFn)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = tempFile.Chmod(info.Mode())
|
destinationName = tempFile.Name()
|
||||||
|
err = os.Chmod(destinationName, info.Mode())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
destinationName = tempFile.Name()
|
|
||||||
destination = tempFile
|
destination = tempFile
|
||||||
defer func() {
|
defer func() {
|
||||||
safelyCloseFile(tempFile)
|
safelyCloseFile(tempFile)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,6 +65,11 @@ func TestNewYaml_WithUnknownScript(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Expected error due to unknown file")
|
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())
|
assertResult(t, expectedOutput, err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user