2014-12-10 07:04:49 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-12-12 07:13:55 +00:00
|
|
|
"github.com/dballard/warren/src/warren"
|
|
|
|
"os"
|
2014-12-10 07:04:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var deployUsage = `
|
|
|
|
warren deploy - Deploys the go server and support files
|
|
|
|
`
|
|
|
|
|
|
|
|
var deployCmd = &Command{
|
|
|
|
Name: "deploy",
|
|
|
|
Usage: "",
|
|
|
|
Summary: "deploy the go server and support files",
|
|
|
|
Help: deployUsage,
|
|
|
|
Run: deployRun,
|
|
|
|
}
|
|
|
|
|
2014-12-10 16:12:46 +00:00
|
|
|
func checkDeployDir() {
|
2014-12-12 07:13:55 +00:00
|
|
|
_, err := os.Stat("deploy")
|
|
|
|
if err != nil {
|
|
|
|
os.Mkdir("deploy", os.ModeDir)
|
|
|
|
}
|
2014-12-10 16:12:46 +00:00
|
|
|
// does ./deploy/DST exist?
|
|
|
|
// if not make
|
|
|
|
}
|
|
|
|
|
|
|
|
func getDeployFilesList() []string {
|
2014-12-12 07:13:55 +00:00
|
|
|
name := warren.AppName()
|
|
|
|
return []string{name}
|
2014-12-10 16:12:46 +00:00
|
|
|
}
|
|
|
|
|
2014-12-10 07:04:49 +00:00
|
|
|
func deployRun(cmd *Command, args ...string) {
|
|
|
|
if len(args) > 0 && args[0] == "help" {
|
|
|
|
fmt.Print(cmd.Help)
|
|
|
|
return
|
|
|
|
}
|
2014-12-10 16:12:46 +00:00
|
|
|
|
|
|
|
checkDeployDir()
|
2014-12-12 07:13:55 +00:00
|
|
|
files := getDeployFilesList()
|
2014-12-10 16:12:46 +00:00
|
|
|
|
2014-12-12 07:13:55 +00:00
|
|
|
fmt.Println(files)
|
2014-12-10 07:04:49 +00:00
|
|
|
}
|