2014-02-07 10:10:01 +00:00
|
|
|
package deploy
|
|
|
|
|
|
|
|
import (
|
2014-09-08 06:08:35 +00:00
|
|
|
"github.com/drone/drone/plugin/condition"
|
2014-06-04 21:25:38 +00:00
|
|
|
"github.com/drone/drone/shared/build/buildfile"
|
2014-02-07 10:10:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Nodejitsu struct {
|
2014-03-20 05:35:14 +00:00
|
|
|
App string `yaml:"app,omitempty"`
|
|
|
|
User string `yaml:"user,omitempty"`
|
|
|
|
Token string `yaml:"token,omitempty"`
|
2014-09-08 06:08:35 +00:00
|
|
|
|
|
|
|
Condition *condition.Condition `yaml:"when,omitempty"`
|
2014-02-07 10:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n *Nodejitsu) Write(f *buildfile.Buildfile) {
|
2014-03-20 07:33:45 +00:00
|
|
|
f.WriteEnv("username", n.User)
|
|
|
|
f.WriteEnv("apiToken", n.Token)
|
2014-02-07 10:10:01 +00:00
|
|
|
|
2014-03-20 05:35:14 +00:00
|
|
|
// Install the jitsu command line interface then
|
|
|
|
// deploy the configured app.
|
|
|
|
f.WriteCmdSilent("[ -f /usr/bin/sudo ] || npm install -g jitsu")
|
|
|
|
f.WriteCmdSilent("[ -f /usr/bin/sudo ] && sudo npm install -g jitsu")
|
|
|
|
f.WriteCmd("jitsu deploy")
|
2014-02-07 10:10:01 +00:00
|
|
|
}
|
2014-09-08 06:08:35 +00:00
|
|
|
|
|
|
|
func (n *Nodejitsu) GetCondition() *condition.Condition {
|
|
|
|
return n.Condition
|
|
|
|
}
|