Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Some more Windows fixes Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Upgrading xignore Signed-off-by: Dave Henderson <dhenderson@gmail.com>
- Loading branch information
1 parent
b431586
commit e991f3e
Showing
27 changed files
with
273 additions
and
164 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ | |
|
||
[[constraint]] | ||
name = "github.com/zealic/xignore" | ||
version = "~0.3.2" | ||
version = "~0.3.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
image: | ||
- Visual Studio 2015 | ||
version: "{build}" | ||
|
||
clone_folder: c:\gopath\src\github.com\hairyhenderson\gomplate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// +build !windows | ||
|
||
package data | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// +build !windows | ||
|
||
package data | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
//+build !windows | ||
|
||
package data | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// +build !windows | ||
|
||
package gomplate | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/afero" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestWalkDir(t *testing.T) { | ||
origfs := fs | ||
defer func() { fs = origfs }() | ||
fs = afero.NewMemMapFs() | ||
|
||
_, err := walkDir("/indir", "/outdir", nil, 0, false) | ||
assert.Error(t, err) | ||
|
||
_ = fs.MkdirAll("/indir/one", 0777) | ||
_ = fs.MkdirAll("/indir/two", 0777) | ||
afero.WriteFile(fs, "/indir/one/foo", []byte("foo"), 0644) | ||
afero.WriteFile(fs, "/indir/one/bar", []byte("bar"), 0644) | ||
afero.WriteFile(fs, "/indir/two/baz", []byte("baz"), 0644) | ||
|
||
templates, err := walkDir("/indir", "/outdir", []string{"*/two"}, 0, false) | ||
|
||
assert.NoError(t, err) | ||
expected := []*tplate{ | ||
{ | ||
name: "/indir/one/bar", | ||
targetPath: "/outdir/one/bar", | ||
mode: 0644, | ||
}, | ||
{ | ||
name: "/indir/one/foo", | ||
targetPath: "/outdir/one/foo", | ||
mode: 0644, | ||
}, | ||
} | ||
assert.EqualValues(t, expected, templates) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// +build windows | ||
|
||
package gomplate | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/afero" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestWalkDir(t *testing.T) { | ||
origfs := fs | ||
defer func() { fs = origfs }() | ||
fs = afero.NewMemMapFs() | ||
|
||
_, err := walkDir(`C:\indir`, `C:\outdir`, nil, 0, false) | ||
assert.Error(t, err) | ||
|
||
_ = fs.MkdirAll(`C:\indir\one`, 0777) | ||
_ = fs.MkdirAll(`C:\indir\two`, 0777) | ||
afero.WriteFile(fs, `C:\indir\one\foo`, []byte("foo"), 0644) | ||
afero.WriteFile(fs, `C:\indir\one\bar`, []byte("bar"), 0644) | ||
afero.WriteFile(fs, `C:\indir\two\baz`, []byte("baz"), 0644) | ||
|
||
templates, err := walkDir(`C:\indir`, `C:\outdir`, []string{`*\two`}, 0, false) | ||
|
||
assert.NoError(t, err) | ||
expected := []*tplate{ | ||
{ | ||
name: `C:\indir\one\bar`, | ||
targetPath: `C:\outdir\one\bar`, | ||
mode: 0644, | ||
}, | ||
{ | ||
name: `C:\indir\one\foo`, | ||
targetPath: `C:\outdir\one\foo`, | ||
mode: 0644, | ||
}, | ||
} | ||
assert.EqualValues(t, expected, templates) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//+build integration | ||
//+build !windows | ||
|
||
package integration | ||
|
||
import ( | ||
"bytes" | ||
"io/ioutil" | ||
"os" | ||
|
||
. "gopkg.in/check.v1" | ||
|
||
"github.com/gotestyourself/gotestyourself/assert" | ||
"github.com/gotestyourself/gotestyourself/icmd" | ||
) | ||
|
||
func (s *BasicSuite) TestRoutesInputsToProperOutputsWithChmod(c *C) { | ||
oneOut := s.tmpDir.Join("one.out") | ||
twoOut := s.tmpDir.Join("two.out") | ||
result := icmd.RunCmd(icmd.Command(GomplateBin, | ||
"-f", s.tmpDir.Join("one"), | ||
"-f", s.tmpDir.Join("two"), | ||
"-o", oneOut, | ||
"-o", twoOut, | ||
"--chmod", "0600"), func(cmd *icmd.Cmd) { | ||
cmd.Stdin = bytes.NewBufferString("hello world") | ||
}) | ||
result.Assert(c, icmd.Success) | ||
|
||
testdata := []struct { | ||
path string | ||
mode os.FileMode | ||
content string | ||
}{ | ||
{oneOut, 0600, "hi\n"}, | ||
{twoOut, 0600, "hello\n"}, | ||
} | ||
for _, v := range testdata { | ||
info, err := os.Stat(v.path) | ||
assert.NilError(c, err) | ||
assert.Equal(c, v.mode, info.Mode()) | ||
content, err := ioutil.ReadFile(v.path) | ||
assert.NilError(c, err) | ||
assert.Equal(c, v.content, string(content)) | ||
} | ||
} | ||
|
||
func (s *BasicSuite) TestOverridesOutputModeWithChmod(c *C) { | ||
out := s.tmpDir.Join("two") | ||
result := icmd.RunCmd(icmd.Command(GomplateBin, | ||
"-f", s.tmpDir.Join("one"), | ||
"-o", out, | ||
"--chmod", "0600"), func(cmd *icmd.Cmd) { | ||
cmd.Stdin = bytes.NewBufferString("hello world") | ||
}) | ||
result.Assert(c, icmd.Success) | ||
|
||
testdata := []struct { | ||
path string | ||
mode os.FileMode | ||
content string | ||
}{ | ||
{out, 0600, "hi\n"}, | ||
} | ||
for _, v := range testdata { | ||
info, err := os.Stat(v.path) | ||
assert.NilError(c, err) | ||
assert.Equal(c, v.mode, info.Mode()) | ||
content, err := ioutil.ReadFile(v.path) | ||
assert.NilError(c, err) | ||
assert.Equal(c, v.content, string(content)) | ||
} | ||
} |
Oops, something went wrong.