Skip to content

Commit f08022d

Browse files
authored
new command: Support skipping Bedrock installation (#584)
1 parent 2f95276 commit f08022d

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

cmd/new.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type NewCommand struct {
2525
name string
2626
host string
2727
skipVirtualenv bool
28+
skipBedrock bool
2829
trellisVersion string
2930
vaultPass string
3031
}
@@ -44,6 +45,7 @@ func (c *NewCommand) init() {
4445
c.flags.StringVar(&c.trellisVersion, "trellis-version", "latest", "Version of Trellis to create the project with (default: latest).")
4546
c.flags.StringVar(&c.vaultPass, "vault-pass", ".vault_pass", "Path for the generated Vault pass file")
4647
c.flags.BoolVar(&c.skipVirtualenv, "skip-virtualenv", false, "Skip creating a new virtual environment for this project")
48+
c.flags.BoolVar(&c.skipBedrock, "skip-bedrock", false, "Skip downloading Bedrock")
4749
}
4850

4951
func (c *NewCommand) Run(args []string) int {
@@ -117,12 +119,16 @@ func (c *NewCommand) Run(args []string) int {
117119
return 1
118120
}
119121

120-
bedrockRelease, err := github.DownloadRelease("roots/bedrock", "latest", path, filepath.Join(path, "site"))
121-
if err != nil {
122-
c.UI.Error("Aborting: error while downloading Bedrock")
123-
c.UI.Error(err.Error())
124-
c.UI.Error("\nThis could be a temporary network error. Please delete this project folder and try again.")
125-
return 1
122+
var bedrockRelease *github.Release
123+
124+
if !c.skipBedrock {
125+
bedrockRelease, err = github.DownloadRelease("roots/bedrock", "latest", path, filepath.Join(path, "site"))
126+
if err != nil {
127+
c.UI.Error("Aborting: error while downloading Bedrock")
128+
c.UI.Error(err.Error())
129+
c.UI.Error("\nThis could be a temporary network error. Please delete this project folder and try again.")
130+
return 1
131+
}
126132
}
127133

128134
if err := os.Chdir(path); err != nil {
@@ -184,7 +190,10 @@ func (c *NewCommand) Run(args []string) int {
184190

185191
fmt.Printf("\n%s project created with versions:\n", color.GreenString(c.name))
186192
fmt.Printf(" Trellis %s\n", trellisRelease.Version)
187-
fmt.Printf(" Bedrock v%s\n", bedrockRelease.Version)
193+
194+
if !c.skipBedrock {
195+
fmt.Printf(" Bedrock v%s\n", bedrockRelease.Version)
196+
}
188197

189198
return 0
190199
}
@@ -233,6 +242,7 @@ Options:
233242
--force (default: false) Forces the creation of the project even if the target path is not empty
234243
--name Main site name (the domain name). Bypasses the name prompt if specified. Example: mydomain.com
235244
--host Main site hostname. Bypasses the host prompt if specified. Example: mydomain.com or www.mydomain.com
245+
--skip-bedrock (default: false) Skip downloading Bedrock
236246
--skip-virtualenv (default: false) Skip creating a new virtual environment for this project
237247
--trellis-version (default: latest) Version of Trellis to start the project with. Options: "latest", "dev", or any version (such as "1.0.0")
238248
--vault-pass (default: .vault_pass) Path for the generated Vault pass file

0 commit comments

Comments
 (0)