From 764e7c553b11f6a0899e9d231c6f6b2b85e5c88d Mon Sep 17 00:00:00 2001 From: Roberto Quintanilla Date: Thu, 18 Aug 2016 12:11:14 -0500 Subject: [PATCH] Added commands for 'build' and 'bundle' to be bypassed into Compose --- README.md | 2 +- plis.go | 32 ++++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d5be2d8..de8a317 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ plis stop web ``` ## TODO's: -- [ ] `build` command to invoke the docker-compose build command. +- [x] `build` command to invoke the docker-compose build command. - [ ] Change the `run` command to use `docker-compose exec` instead of `docker exec` whenever a running container is already available. - [ ] Copy (from existing templates/examples) or generate blank dotenv files referenced in the Compose file. - [ ] Install Docker (for Mac/Windows or native for Linux) if it is missing. diff --git a/plis.go b/plis.go index dd5e8d5..9a4eb8c 100644 --- a/plis.go +++ b/plis.go @@ -104,7 +104,7 @@ func RunGeneratedCommand(command []string) { if execErr != nil { panic(execErr) } } -func Bypass(cmd string, args []string) { +func BypassToCompose(cmd string, args []string) { RunGeneratedCommand(append([]string{"docker-compose", cmd}, args...)) } @@ -174,8 +174,8 @@ func Run(c *cli.Context) { func main() { app := cli.NewApp() app.Name = "Plis" - app.Usage = "Translates common actions into docker/docker-compose commands by asking nicely" - app.Version = "0.0.0.build3" + app.Usage = "Translates common development actions into docker/docker-compose commands by asking nicely" + app.Version = "0.0.0.build4" app.Commands = []cli.Command{ { @@ -186,13 +186,13 @@ func main() { { Name: "stop", Usage: "Stop the project's running processes", - Action: func (c *cli.Context) { Bypass("stop", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("stop", c.Args()) }, SkipFlagParsing: true, }, { Name: "restart", Usage: "Restarts the project's running processes", - Action: func (c *cli.Context) { Bypass("restart", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("restart", c.Args()) }, SkipFlagParsing: true, }, { @@ -210,31 +210,43 @@ func main() { { Name: "ps", Usage: "Lists the project's running processes", - Action: func (c *cli.Context) { Bypass("ps", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("ps", c.Args()) }, SkipFlagParsing: true, }, { Name: "rm", Usage: "Removes the project's running processes", - Action: func (c *cli.Context) { Bypass("rm", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("rm", c.Args()) }, SkipFlagParsing: true, }, { Name: "logs", Usage: "Opens the logs of running processes", - Action: func (c *cli.Context) { Bypass("logs", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("logs", c.Args()) }, SkipFlagParsing: true, }, { Name: "down", Usage: "Stops and removes all containers", - Action: func (c *cli.Context) { Bypass("down", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("down", c.Args()) }, SkipFlagParsing: true, }, { Name: "scale", Usage: "Scales the given services", - Action: func (c *cli.Context) { Bypass("scale", c.Args()) }, + Action: func (c *cli.Context) { BypassToCompose("scale", c.Args()) }, + SkipFlagParsing: true, + }, + { + Name: "build", + Usage: "Build or rebuild services", + Action: func (c *cli.Context) { BypassToCompose("build", c.Args()) }, + SkipFlagParsing: true, + }, + { + Name: "bundle", + Usage: "Generate a Docker bundle from the Compose file", + Action: func (c *cli.Context) { BypassToCompose("bundle", c.Args()) }, SkipFlagParsing: true, }, }