2014-02-23 20:02:53 +03:00
|
|
|
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) {
|
2014-02-24 02:07:25 +03:00
|
|
|
f.WriteEnv("MODULUS_TOKEN", m.Token)
|
2014-02-23 20:02:53 +03:00
|
|
|
|
|
|
|
// Install the Modulus command line interface then deploy the configured
|
|
|
|
// project.
|
2014-02-24 02:07:25 +03:00
|
|
|
f.WriteCmdSilent("[ -f /usr/bin/sudo ] || npm install -g modulus")
|
|
|
|
f.WriteCmdSilent("[ -f /usr/bin/sudo ] && sudo npm install -g modulus")
|
2014-02-24 02:10:01 +03:00
|
|
|
f.WriteCmd(fmt.Sprintf("modulus deploy -p '%s'", m.Project))
|
2014-02-23 20:02:53 +03:00
|
|
|
}
|