-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bring myke go run with regular Windows environment on Windows systems * Add environment variable expansion in the way golang does (very close to sh) that it behaves on every operating system and/or distribution in the same way to be more "cross platform" * Added appveyor config to also enable tests to run on an Windows environment. * * Fixed problem with case insensitve PATH variable under Windows is doubled set - and with a chance of 50% wrong. * Improved the output .. if a different Shell is used do not output "+ whatever" if a command starts.
- Loading branch information
Showing
11 changed files
with
109 additions
and
16 deletions.
There are no files selected for viewing
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,25 @@ | ||
version: "{build}" | ||
|
||
os: Windows Server 2012 R2 | ||
|
||
clone_folder: c:\gopath\src\github.com\goeuro\myke | ||
|
||
environment: | ||
GOPATH: C:\gopath | ||
|
||
# Uncomment following line if you are willing to debug on the build machine. | ||
#init: | ||
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) | ||
|
||
install: | ||
- set PATH=%GOPATH%\bin;C:\go\bin;%WINDIR%;%WINDIR%\System32;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin | ||
- go version | ||
- go env | ||
- sh c:\gopath\src\github.com\goeuro\myke\bin\init.sh | ||
|
||
build_script: | ||
- gofmt -d -s -e . 2>&1 | tee -a fmt.out | ||
- test ! -s fmt.out | ||
- golint -set_exit_status . | ||
- go test -timeout 10s -v ./... | ||
|
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,11 @@ | ||
// +build !windows | ||
|
||
package core | ||
|
||
func executionShell() []string { | ||
return []string{"sh", "-exc"} | ||
} | ||
|
||
func (e *Execution) beforeExecuteCmd(cmd string, env map[string]string) error { | ||
return nil | ||
} |
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,41 @@ | ||
// +build windows | ||
|
||
package core | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
) | ||
|
||
var comSpec string | ||
|
||
func init() { | ||
comSpec = os.Getenv("ComSpec") | ||
if len(comSpec) > 0 { | ||
return | ||
} | ||
winDir := os.Getenv("windir") | ||
if len(winDir) > 0 { | ||
comSpec = filepath.Join(winDir, "system32", "cmd.exe") | ||
} | ||
comSpec = "C:\\windows\\system32\\cmd.exe" | ||
return | ||
} | ||
|
||
func executionShell() []string { | ||
return []string{comSpec, "/C"} | ||
} | ||
|
||
func (e *Execution) beforeExecuteCmd(cmd string, env map[string]string) error { | ||
if len(e.Task.Shell) > 0 { | ||
return nil | ||
} | ||
// This will cause the same output like the sh -x on unix like systems. | ||
proc := exec.Command(comSpec, "/C", "echo", "+", cmd) | ||
proc.Dir = e.Project.Cwd | ||
proc.Env = mapToSlice(env) | ||
proc.Stdout = os.Stdout | ||
proc.Stderr = os.Stderr | ||
return proc.Run() | ||
} |
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
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