Skip to content

Commit

Permalink
Allow ddev start to accept project name arguments (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfrench committed Jul 19, 2018
1 parent 8973bc7 commit 3aae0cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
7 changes: 0 additions & 7 deletions cmd/ddev/cmd/start.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"os"
"strings"

"github.com/drud/ddev/pkg/dockerutil"
Expand All @@ -20,12 +19,6 @@ var StartCmd = &cobra.Command{
Long: `Start initializes and configures the web server and database containers to
provide a local development environment.`,
PreRun: func(cmd *cobra.Command, args []string) {
if len(args) > 0 {
err := cmd.Usage()
util.CheckErr(err)
os.Exit(0)
}

dockerutil.EnsureDdevNetwork()
},
Run: func(cmd *cobra.Command, args []string) {
Expand Down
19 changes: 19 additions & 0 deletions cmd/ddev/cmd/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,23 @@ func TestDdevStart(t *testing.T) {
for _, app := range apps {
assert.True(app.SiteStatus() == ddevapp.SiteRunning, "All sites should be running, but %s status: %s", app.GetName(), app.SiteStatus())
}

// Stop all sites.
_, err = exec.RunCommand(DdevBin, []string{"stop", "--all"})
assert.NoError(err)

// Build start command startMultipleArgs
startMultipleArgs := []string{"start"}
for _, app := range apps {
startMultipleArgs = append(startMultipleArgs, app.GetName())
}

// Start multiple projects in one command
out, err = exec.RunCommand(DdevBin, startMultipleArgs)
assert.NoError(err, "ddev start with multiple project names should have succeeded, but failed, err: %v, output %s", err, out)

// Confirm all sites are running
for _, app := range apps {
assert.True(app.SiteStatus() == ddevapp.SiteRunning, "All sites should be running, but %s status: %s", app.GetName(), app.SiteStatus())
}
}

0 comments on commit 3aae0cc

Please sign in to comment.