diff --git a/cmd_deploy.go b/cmd_deploy.go index cbabb22..5c06bf7 100644 --- a/cmd_deploy.go +++ b/cmd_deploy.go @@ -2,6 +2,8 @@ package main import ( "fmt" + "github.com/dballard/warren/src/warren" + "os" ) var deployUsage = ` @@ -17,15 +19,17 @@ var deployCmd = &Command{ } func checkDeployDir() { - // does ./deploy exist? - // if not make + _, err := os.Stat("deploy") + if err != nil { + os.Mkdir("deploy", os.ModeDir) + } // does ./deploy/DST exist? // if not make } func getDeployFilesList() []string { - - return []string{""} + name := warren.AppName() + return []string{name} } func deployRun(cmd *Command, args ...string) { @@ -35,7 +39,7 @@ func deployRun(cmd *Command, args ...string) { } checkDeployDir() + files := getDeployFilesList() - //files := getDeployFilesList() - + fmt.Println(files) } diff --git a/src/warren/warren.go b/src/warren/warren.go index 600b459..fb3d3af 100644 --- a/src/warren/warren.go +++ b/src/warren/warren.go @@ -2,7 +2,9 @@ package warren import ( "log" + "os" "os/exec" + "path/filepath" "strings" ) @@ -21,3 +23,9 @@ func GitBranch() string { } return strings.TrimSpace(string(gitbranch)) } + +func AppName() string { + paths, _ := filepath.Abs(filepath.Dir(os.Args[0])) + paths, name := filepath.Split(paths) + return name +}