Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
Merge e0ab346 into fa9244f
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Oct 14, 2014
2 parents fa9244f + e0ab346 commit 0e7948f
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ The directory you execute chef-runner from must either:

### Download

There are [pre-built binaries] of chef-runner for Mac OS X, Linux, FreeBSD, and
OpenBSD. Please download the proper package for your operating system and
architecture, then unzip the `chef-runner` binary to a location included in
`$PATH`.
There are [pre-built binaries] of chef-runner for Mac OS X, Linux, Windows,
FreeBSD, and OpenBSD. Please download the proper package for your operating
system and architecture, then unzip the `chef-runner` binary to a location
included in `$PATH`.

### Homebrew

Expand Down
6 changes: 3 additions & 3 deletions exec/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
)

func TestRunCommand_Success(t *testing.T) {
err := RunCommand([]string{"bash", "-c", "echo foo | grep -q foo"})
err := RunCommand([]string{"go", "version"})
assert.NoError(t, err)
}

func TestRunCommand_Failure(t *testing.T) {
err := RunCommand([]string{"bash", "-c", "echo foo | grep -q bar"})
assert.EqualError(t, err, "exit status 1")
err := RunCommand([]string{"go", "some-unknown-subcommand"})
assert.EqualError(t, err, "exit status 2")
}

func TestRunCommand_Func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion openssh/openssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (c Client) Shell() string {
cmd := c.Command([]string{})
var quoted []string
for _, i := range cmd[:len(cmd)-1] {
quoted = append(quoted, `"`+i+`"`)
quoted = append(quoted, "'"+i+"'")
}
return strings.Join(quoted, " ")
}
6 changes: 3 additions & 3 deletions openssh/openssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ var shellTests = []struct {
}{
{
Client{Host: "some-host", User: "some-user", Port: 1234},
`"ssh" "-l" "some-user" "-p" "1234"`,
"'ssh' '-l' 'some-user' '-p' '1234'",
},
{
Client{Host: "some-host", Options: []string{"x=1"}},
`"ssh" "-o" "x=1"`,
"'ssh' '-o' 'x=1'",
},
{
Client{Host: "some-host", Options: []string{"y 2 3"}},
`"ssh" "-o" "y 2 3"`,
"'ssh' '-o' 'y 2 3'",
},
}

Expand Down
2 changes: 1 addition & 1 deletion script/build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "Cross-compiling binaries..."
rm -rf "$build_dir"
gox \
-output="${build_dir}/{{.Dir}}_${version}_{{.OS}}_{{.Arch}}/{{.Dir}}" \
-os="darwin linux freebsd openbsd" \
-os="darwin linux windows freebsd openbsd" \
-ldflags "-X main.GitVersion $git_version" \
./...

Expand Down
1 change: 0 additions & 1 deletion testdata/bin/bundle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#!/usr/bin/env ruby
# Bundler stub for testing
1 change: 1 addition & 0 deletions testdata/bin/bundle.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:: Bundler stub for testing
14 changes: 14 additions & 0 deletions testdata/bin/vagrant.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:: Vagrant stub for testing

@echo off

echo Host default
echo HostName 127.0.0.1
echo User vagrant
echo Port 2200
echo UserKnownHostsFile /dev/null
echo StrictHostKeyChecking no
echo PasswordAuthentication no
echo IdentityFile /Users/mlafeldt/.vagrant.d/insecure_private_key
echo IdentitiesOnly yes
echo LogLevel FATAL
4 changes: 2 additions & 2 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io/ioutil"
"net/http"
"os"
"path"
"path/filepath"
"strings"
)

Expand All @@ -20,7 +20,7 @@ func FileExist(name string) bool {
// BaseName - as the basename Unix tool - deletes any prefix ending with the
// last slash character present in a string, and a suffix, if given.
func BaseName(s, suffix string) string {
base := path.Base(s)
base := filepath.Base(s)
if suffix != "" {
base = strings.TrimSuffix(base, suffix)
}
Expand Down
11 changes: 5 additions & 6 deletions util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net/http"
"net/http/httptest"
"os"
"path"
"path/filepath"
"strings"
"testing"
Expand Down Expand Up @@ -48,7 +47,7 @@ func TestTempDir(t *testing.T) {
assert.NoError(t, err)
defer os.RemoveAll(dir)

assert.True(t, strings.HasPrefix(path.Base(dir), "chef-runner-"))
assert.True(t, strings.HasPrefix(filepath.Base(dir), "chef-runner-"))

m, err := os.Stat(dir)
assert.NoError(t, err)
Expand Down Expand Up @@ -86,13 +85,13 @@ func TestInTestDir(t *testing.T) {
}

func TestDownloadFile(t *testing.T) {
ts := httptest.NewServer(http.FileServer(http.Dir("../testdata")))
ts := httptest.NewServer(http.FileServer(http.Dir(".")))
defer ts.Close()

filename := "download.md"
assert.NoError(t, DownloadFile(filename, ts.URL+"/README.md"))
filename := "some-download-file"
assert.NoError(t, DownloadFile(filename, ts.URL+"/util_test.go"))
defer os.Remove(filename)

data, _ := ioutil.ReadFile(filename)
assert.Equal(t, "# Test Cookbook\n", string(data))
assert.True(t, strings.HasPrefix(string(data), "package util_test"))
}

0 comments on commit 0e7948f

Please sign in to comment.