closer to automatic 'go get' myself
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
77c1b9258f
commit
8ddc35e198
12
main.go
12
main.go
|
@ -178,8 +178,8 @@ func repoworld() {
|
||||||
buildOptions.NewLabel("get autotypist")
|
buildOptions.NewLabel("get autotypist")
|
||||||
buildOptions.NewButton("go get", func () {
|
buildOptions.NewButton("go get", func () {
|
||||||
var newCmds [][]string
|
var newCmds [][]string
|
||||||
newCmds = append(newCmds, []string{"mkdir", "-p", "go/src/go.wit.com/apps"})
|
newCmds = append(newCmds, []string{"mkdir", "-p", "~/go/src/go.wit.com/apps"})
|
||||||
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/"})
|
||||||
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "go.wit.com/apps/myrepos"})
|
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "go.wit.com/apps/myrepos"})
|
||||||
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
|
||||||
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
|
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
|
||||||
|
@ -210,10 +210,11 @@ func repoworld() {
|
||||||
|
|
||||||
buildOptions.NewLabel("--dry-run")
|
buildOptions.NewLabel("--dry-run")
|
||||||
dryrun = buildOptions.NewButton("show commands", func () {
|
dryrun = buildOptions.NewButton("show commands", func () {
|
||||||
if dryRunCommands() {
|
if goMake("--dry-run") {
|
||||||
log.Warn("EVERYTHING MIGHT HAVE WORKED")
|
log.Warn("EVERYTHING MIGHT HAVE WORKED")
|
||||||
} else {
|
} else {
|
||||||
log.Warn("EVERYTHING DID NOT WORK")
|
log.Warn("EVERYTHING WILL NOT WORK")
|
||||||
|
dryrun.Disable()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -221,7 +222,8 @@ func repoworld() {
|
||||||
doit = buildOptions.NewButton("run commands", func () {
|
doit = buildOptions.NewButton("run commands", func () {
|
||||||
doit.Disable()
|
doit.Disable()
|
||||||
log.Warn("should run the commands here")
|
log.Warn("should run the commands here")
|
||||||
if runCommands() {
|
// true here means dryrun == true. it's confusingly named
|
||||||
|
if goMake("--doit") {
|
||||||
log.Warn("EVERYTHING WORKED")
|
log.Warn("EVERYTHING WORKED")
|
||||||
} else {
|
} else {
|
||||||
log.Warn("EVERYTHING DID NOT WORK")
|
log.Warn("EVERYTHING DID NOT WORK")
|
||||||
|
|
22
unix.go
22
unix.go
|
@ -9,7 +9,9 @@ import (
|
||||||
|
|
||||||
var repopath string = "/home/jcarr/"
|
var repopath string = "/home/jcarr/"
|
||||||
|
|
||||||
func dryRunCommands() bool {
|
// if dryRun == true, then it just prints out the values
|
||||||
|
// but doesn't do anything
|
||||||
|
func goMake(dryRun string) bool {
|
||||||
var workingPath string = "go/src"
|
var workingPath string = "go/src"
|
||||||
for _, line := range script {
|
for _, line := range script {
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
|
@ -33,6 +35,24 @@ func dryRunCommands() bool {
|
||||||
s := strings.Join(line[1:], " ")
|
s := strings.Join(line[1:], " ")
|
||||||
path := repopath + workingPath
|
path := repopath + workingPath
|
||||||
log.Warn("NEED TO RUN path =", path, "cmd =", cmd, "argv:", s)
|
log.Warn("NEED TO RUN path =", path, "cmd =", cmd, "argv:", s)
|
||||||
|
if dryRun == "--dry-run" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if dryRun == "--doit" {
|
||||||
|
log.Warn("Actually RUN path =", path, "cmd =", cmd, "argv:", s)
|
||||||
|
err, b, output := repostatus.RunCmd(repopath, line)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("ABEND EXECUTION")
|
||||||
|
log.Info("error =", err)
|
||||||
|
log.Info("b =", b)
|
||||||
|
log.Info("output =", output)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
log.Warn("output was =", output)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Warn("don't know what to do. dryRun ==", dryRun)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue