Skip to content

Commit

Permalink
Added commands for 'build' and 'bundle' to be bypassed into Compose
Browse files Browse the repository at this point in the history
  • Loading branch information
vovimayhem committed Aug 18, 2016
1 parent 5f5a24e commit 764e7c5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 22 additions & 10 deletions plis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...))
}

Expand Down Expand Up @@ -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{
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
}
Expand Down

0 comments on commit 764e7c5

Please sign in to comment.