Class: Janky::Commit

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/janky/commit.rb

Instance Method Summary collapse

Instance Method Details

#build!(user, room_id = nil, compare = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/janky/commit.rb', line 10

def build!(user, room_id = nil, compare = nil)
  compare = repository.github_url("compare/#{sha1}^...#{sha1}")

  room_id = room_id.to_s
  if room_id.empty? || room_id == "0"
    room_id = repository.room_id
  end

  builds.create!(
    :compare   => compare,
    :user      => user,
    :commit    => self,
    :room_id   => room_id,
    :branch_id => repository.branch_for('master').id
  )
end

#last_buildObject



6
7
8
# File 'lib/janky/commit.rb', line 6

def last_build
  builds.last
end