Navigation Menu

Skip to content

Commit

Permalink
POST /?branch=coupons to run on branch "coupons" instead of default
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Nov 14, 2010
1 parent 0153342 commit e59571e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/cijoe.rb
Expand Up @@ -89,7 +89,7 @@ def finish_build(status, output)

# run the build but make sure only one is running
# at a time (if new one comes in we will park it)
def build
def build(branch=nil)
if building?
# only if switched on to build all incoming requests
if !repo_config.buildallfile.to_s.empty?
Expand All @@ -103,7 +103,7 @@ def build
end
@current_build = Build.new(@project_path, @user, @project)
write_build 'current', @current_build
Thread.new { build! }
Thread.new { build!(branch) }
end

def open_pipe(cmd)
Expand All @@ -121,7 +121,8 @@ def open_pipe(cmd)
end

# update git then run the build
def build!
def build!(branch=nil)
@git_branch = branch
build = @current_build
output = ''
git_update
Expand Down Expand Up @@ -166,8 +167,9 @@ def git_user_and_project
end

def git_branch
return @git_branch if @git_branch
branch = repo_config.branch.to_s
branch == '' ? "master" : branch
@git_branch = branch == '' ? "master" : branch
end

# massage our repo
Expand Down
2 changes: 1 addition & 1 deletion lib/cijoe/server.rb
Expand Up @@ -29,7 +29,7 @@ class Server < Sinatra::Base
post '/?' do
payload = params[:payload].to_s
if payload.empty? || payload.include?(joe.git_branch)
joe.build
joe.build(params[:branch])
end
redirect request.path
end
Expand Down

0 comments on commit e59571e

Please sign in to comment.