cmd

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ROOT = "config"

ROOT config dir

Variables

View Source
var FLAG_FORMAT = cli.StringFlag{
	Name:   "format,f",
	Value:  "toml",
	Usage:  "file format, like: toml, yaml",
	EnvVar: "STAGE",
}
View Source
var FLAG_HOSTS = cli.StringSliceFlag{
	Name:   "hosts",
	Usage:  "hosts filter, like: 'deploy@host1.com,deploy@host2.com'",
	EnvVar: "HOSTS",
}
View Source
var FLAG_ROLES = cli.StringSliceFlag{
	Name:   "roles",
	Usage:  "roles filter, like: 'app,web'",
	EnvVar: "ROLES",
}
View Source
var FLAG_STAGE = cli.StringFlag{
	Name:   "stage,s",
	Value:  "test",
	Usage:  "stage name like: production, development, test",
	EnvVar: "STAGE",
}
View Source
var FLAG_TASK = cli.StringFlag{
	Name:   "task,t",
	Value:  "hello",
	Usage:  "task's name",
	EnvVar: "TASK",
}
View Source
var STAGES = path.Join(ROOT, "stages")

STAGES stages dir

View Source
var TASKS = path.Join(ROOT, "tasks")

TASKS tasks dir

Functions

func Action

func Action(fn func(*cli.Context, *Stage) error) cli.ActionFunc

Action command action, need: format, stage

Types

type Stage

type Stage struct {
	Name        string `toml:"-"`
	Description string `toml:"description"`
	//The path on the remote server where the application should be deployed.
	//default "/var/www/{{.Name}}"
	To string `toml:"deploy_to"`
	//The Source Control Management used.
	//default: :git
	//Currently :git are supported.
	ScmF string `toml:"scm"` //default git
	//URL to the repository.
	//Must be a valid URL for the used SCM.
	Repo string `toml:"repo_url"`
	//default master
	Branch string `toml:"branch"`
	//Listed files will be symlinked into each release directory during deployment.
	//default []
	Files []string `toml:"linked_files"`
	//Listed directories will be symlinked into the release directory during deployment.
	//default []
	Dirs []string `toml:"linked_dirs"`
	//Default shell environment used during command execution.
	//default {}
	Env map[string]string `toml:"default_env"`
	//The last n releases are kept for possible rollbacks.
	//default 5
	Keep uint `toml:"keep_releases"`
	//Temporary directory used during deployments to store data.
	//default /tmp
	Tmp   string `toml:"tmp"`
	Debug bool   `toml:"debug"`

	//split hosts by roles
	Roles map[string][]string `toml:"roles"`
	Keys  []string            `toml:"keys"`

	Logger  *logging.Logger `toml:"-"`
	Store   store.Store     `toml:"-"`
	Scm     scm.Scm         `toml:"-"`
	Signers []ssh.Signer    `toml:"-"`

	Version string `toml:"-"`
}

Stage load from config/stages/<name>.toml

func (*Stage) Hosts

func (p *Stage) Hosts(task *Task, roles, hosts []string) ([]string, error)

Hosts get ordered hosts

func (*Stage) Shared

func (p *Stage) Shared(n string) string

Shared shared path

type Task

type Task struct {
	Name        string   `toml:"-"`
	Description string   `toml:"description"`
	Hosts       []string `toml:"hosts"`
	Roles       []string `toml:"roles"`
	Script      []string `toml:"script"`
	Deploy      bool     `toml:"deploy"`
}

Task load from config/tasks/name>.toml

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL