Fixed the WriteEnv usage and updated to allow for sudo if necessary.
This commit is contained in:
Matt Hernandez 2014-02-23 18:07:25 -05:00
parent 77e2837ff0
commit 492ac956ca

View file

@ -11,10 +11,11 @@ type Modulus struct {
} }
func (m *Modulus) Write(f *buildfile.Buildfile) { func (m *Modulus) Write(f *buildfile.Buildfile) {
f.writeEnv("MODULUS_TOKEN", m.Token) f.WriteEnv("MODULUS_TOKEN", m.Token)
// Install the Modulus command line interface then deploy the configured // Install the Modulus command line interface then deploy the configured
// project. // project.
f.WriteCmdSilent("npm install -g modulus") f.WriteCmdSilent("[ -f /usr/bin/sudo ] || npm install -g modulus")
f.WriteCmdSilent("[ -f /usr/bin/sudo ] && sudo npm install -g modulus")
f.WriteCmd(fmt.Sprintf("modulus deploy -p '%s'", m.App)) f.WriteCmd(fmt.Sprintf("modulus deploy -p '%s'", m.App))
} }