From fc01782554033612f4d1571d7aa078d3ed91d2c0 Mon Sep 17 00:00:00 2001 From: Alex Suraci Date: Mon, 24 Feb 2014 15:41:14 -0800 Subject: [PATCH] add constructor for Builder this makes it easier to track required dependencies as they change (todo: actually, like, use it for required dependencies) --- cmd/drone/drone.go | 4 ++-- pkg/build/build.go | 4 ++++ pkg/queue/queue.go | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/drone/drone.go b/cmd/drone/drone.go index 9fdc6b3c..c12e3ef2 100644 --- a/cmd/drone/drone.go +++ b/cmd/drone/drone.go @@ -174,7 +174,7 @@ func run(path string) { // loop through and create builders for _, b := range builds { //script.Builds { - builder := build.Builder{} + builder := build.New() builder.Build = b builder.Repo = &code builder.Key = key @@ -186,7 +186,7 @@ func run(path string) { builder.Stdout = &buf } - builders = append(builders, &builder) + builders = append(builders, builder) } switch *parallel { diff --git a/pkg/build/build.go b/pkg/build/build.go index b086d4f4..ba8d3969 100644 --- a/pkg/build/build.go +++ b/pkg/build/build.go @@ -35,6 +35,10 @@ type BuildState struct { // Max RAM, Max Swap, Disk space, and more. } +func New() *Builder { + return &Builder{} +} + // Builder represents a build process being prepared // to run. type Builder struct { diff --git a/pkg/queue/queue.go b/pkg/queue/queue.go index e931c46f..cadaee93 100644 --- a/pkg/queue/queue.go +++ b/pkg/queue/queue.go @@ -3,7 +3,7 @@ package queue import ( "bytes" "fmt" - bldr "github.com/drone/drone/pkg/build" + "github.com/drone/drone/pkg/build" "github.com/drone/drone/pkg/build/git" r "github.com/drone/drone/pkg/build/repo" "github.com/drone/drone/pkg/build/script" @@ -134,7 +134,7 @@ func (b *BuildTask) execute() error { } // execute the build - builder := bldr.Builder{} + builder := build.New() builder.Build = b.Script builder.Repo = &r.Repo{Path: b.Repo.URL, Branch: b.Commit.Branch, Commit: b.Commit.Hash, PR: b.Commit.PullRequest, Dir: filepath.Join("/var/cache/drone/src", b.Repo.Slug), Depth: git.GitDepth(b.Script.Git)} builder.Key = []byte(b.Repo.PrivateKey) @@ -225,7 +225,7 @@ func updateGitHubStatus(repo *Repo, commit *Commit) error { } client := github.New(user.GithubToken) - client.ApiUrl = settings.GitHubApiUrl; + client.ApiUrl = settings.GitHubApiUrl var url string url = settings.URL().String() + "/" + repo.Slug + "/commit/" + commit.Hash