diff --git a/pkg/plugin/deploy/deployment.go b/pkg/plugin/deploy/deployment.go index e45b3a94..fec3b28c 100644 --- a/pkg/plugin/deploy/deployment.go +++ b/pkg/plugin/deploy/deployment.go @@ -14,6 +14,7 @@ type Deploy struct { EngineYard *EngineYard `yaml:"engineyard,omitempty"` Git *Git `yaml:"git,omitempty"` Heroku *Heroku `yaml:"heroku,omitempty"` + Modulus *Modulus `yaml:"modulus,omitempty"` Nodejitsu *Nodejitsu `yaml:"nodejitsu,omitempty"` Openshift *Openshift `yaml:"openshift,omitempty"` SSH *SSH `yaml:"ssh,omitempty"` @@ -38,6 +39,9 @@ func (d *Deploy) Write(f *buildfile.Buildfile) { if d.Heroku != nil { d.Heroku.Write(f) } + if d.Modulus != nil { + d.Modulus.Write(f) + } if d.Nodejitsu != nil { d.Nodejitsu.Write(f) } diff --git a/pkg/plugin/deploy/modulus.go b/pkg/plugin/deploy/modulus.go new file mode 100644 index 00000000..02a41b6d --- /dev/null +++ b/pkg/plugin/deploy/modulus.go @@ -0,0 +1,21 @@ +package deploy + +import ( + "fmt" + "github.com/drone/drone/pkg/build/buildfile" +) + +type Modulus struct { + Project string `yaml:"project,omitempty"` + Token string `yaml:"token,omitempty"` +} + +func (m *Modulus) Write(f *buildfile.Buildfile) { + f.WriteEnv("MODULUS_TOKEN", m.Token) + + // Install the Modulus command line interface then deploy the configured + // project. + 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.Project)) +}