Merge pull request #116 from fiveisprime/modulus-deployments

Adds support for Modulus deployments
This commit is contained in:
Brad Rydzewski 2014-02-23 15:28:55 -08:00
commit dc478a4ca8
2 changed files with 25 additions and 0 deletions

View file

@ -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)
}

View file

@ -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))
}