示例#1
0
文件: test.go 项目: tomzhang/tugboat
func New(t testing.TB) *tugboat.Tugboat {
	config := tugboat.Config{}
	config.DB = "postgres://localhost/tugboat?sslmode=disable"

	tug, err := tugboat.New(config)
	if err != nil {
		t.Fatal(err)
	}
	tug.Providers = []tugboat.Provider{fake.NewProvider()}

	if err := tug.Reset(); err != nil {
		t.Fatal(err)
	}

	return tug
}
示例#2
0
文件: main.go 项目: tomzhang/tugboat
func newTugboat(c *cli.Context) (*tugboat.Tugboat, error) {
	config := tugboat.Config{}
	config.DB = c.String("db.url")
	config.Pusher.URL = c.String("pusher.url")
	config.GitHub.Token = c.String("github.token")
	config.ProviderSecret = []byte(c.String("provider.secret"))

	tug, err := tugboat.New(config)
	if err != nil {
		return tug, err
	}

	ps, err := newProviders(c)
	if err != nil {
		return tug, err
	}

	tug.Providers = ps
	tug.MatchEnvironment = c.String("environment")

	return tug, nil
}