コード例 #1
0
ファイル: deployer.go プロジェクト: brianz/empire
// NotifyTugboat wraps a Deployer to sent deployment logs and status updates to
// a Tugboat instance.
func NotifyTugboat(d Deployer, url string) *TugboatDeployer {
	c := tugboat.NewClient(nil)
	c.URL = url
	return &TugboatDeployer{
		deployer: d,
		client:   c,
	}
}
コード例 #2
0
ファイル: deployer.go プロジェクト: 4eek/empire
func newTugboatDeployer(d deployer, url string) *tugboatDeployer {
	c := tugboat.NewClient(nil)
	c.URL = url
	return &tugboatDeployer{
		deployer: d,
		client:   c,
	}
}
コード例 #3
0
ファイル: api_test.go プロジェクト: tomzhang/tugboat
// newTestClient will return a new heroku.Client that's configured to interact
// with a instance of the empire HTTP server.
func newTestClient(t testing.TB) (*tugboat.Client, *tugboat.Tugboat, *httptest.Server) {
	tug := tugboattest.New(t)

	s := httptest.NewServer(tugboattest.NewServer(tug))
	c := tugboat.NewClient(nil)
	u, err := url.Parse(s.URL)
	if err != nil {
		t.Fatal(err)
	}
	u.User = url.User("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJQcm92aWRlciI6Imhlcm9rdSJ9.HVBoIvRnGKR87odScLnkFWHi4pvSI8V7LJpjh00njBY")
	c.URL = u.String()

	return c, tug, s
}
コード例 #4
0
ファイル: main.go プロジェクト: tomzhang/tugboat
func deploy() error {
	raw, err := ioutil.ReadFile(*payload)
	if err != nil {
		return err
	}

	c := tugboat.NewClient(nil)
	c.URL = *url

	opts, err := tugboat.NewDeployOptsFromReader(bytes.NewReader(raw))
	if err != nil {
		return err
	}

	c.Deploy(context.Background(), opts, tugboat.ProviderFunc(perform))

	return nil
}
コード例 #5
0
ファイル: provider_test.go プロジェクト: carriercomm/empire
func Example() {
	// First, you'll want to create a tugboat.Client and point it at a
	// tugboat server.
	c := tugboat.NewClient(nil)

	// Options should be parsed from the github webhook.
	opts := tugboat.DeployOpts{
		ID:          1,
		Sha:         "827fecd2d36ebeaa2fd05aa8ef3eed1e56a8cd57",
		Ref:         "master",
		Environment: "staging",
		Description: "Deploying to staging",
		Repo:        "remind101/acme-inc",
	}

	// Calling Deploy will perform the deployment and record the
	// logs.
	if _, err := c.Deploy(context.TODO(), opts, tugboat.ProviderFunc(deploy)); err != nil {
		log.Fatal(err)
	}
}