harness-drone/shared/deploy/modulus.go

22 lines
574 B
Go
Raw Normal View History

package deploy
import (
"fmt"
2014-06-04 21:25:38 +00:00
"github.com/drone/drone/shared/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")
2014-02-23 23:10:01 +00:00
f.WriteCmd(fmt.Sprintf("modulus deploy -p '%s'", m.Project))
}