Class: Janky::BuildRequest
- Inherits:
-
Object
- Object
- Janky::BuildRequest
- Defined in:
- lib/janky/build_request.rb
Class Method Summary collapse
Instance Method Summary collapse
- #branch ⇒ Object
- #commit ⇒ Object
- #handle ⇒ Object
-
#initialize(repo, branch_name, pusher, commit, compare, room_id) ⇒ BuildRequest
constructor
A new instance of BuildRequest.
Constructor Details
#initialize(repo, branch_name, pusher, commit, compare, room_id) ⇒ BuildRequest
Returns a new instance of BuildRequest.
16 17 18 19 20 21 22 23 |
# File 'lib/janky/build_request.rb', line 16 def initialize(repo, branch_name, pusher, commit, compare, room_id) @repo = repo @branch_name = branch_name @pusher = pusher @commit = commit @compare = compare @room_id = room_id end |
Class Method Details
.handle(repo_uri, branch_name, pusher, commit, compare, room_id) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/janky/build_request.rb', line 3 def self.handle(repo_uri, branch_name, pusher, commit, compare, room_id) repos = Repository.find_all_by_uri(repo_uri) repos.each do |repo| begin new(repo, branch_name, pusher, commit, compare, room_id).handle rescue Janky::Error => boom Exception.report(boom, :repo => repo.name) end end repos.size end |
Instance Method Details
#branch ⇒ Object
37 38 39 |
# File 'lib/janky/build_request.rb', line 37 def branch @repo.branch_for(@branch_name) end |
#commit ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/janky/build_request.rb', line 41 def commit @repo.commit_for( :sha1 => @commit.sha1, :url => @commit.url, :message => @commit., :author => @commit., :committed_at => @commit.committed_at ) end |
#handle ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/janky/build_request.rb', line 25 def handle current_build = commit.last_build build = branch.build_for(commit, @pusher, @room_id, @compare) if !current_build || (current_build && current_build.red?) if @repo.enabled? build.run Notifier.queued(build) end end end |