Class: Integrity::Project

Inherits:
Object show all
Includes:
DataMapper::Resource, Notifiers, Push
Defined in:
lib/integrity/project.rb,
lib/integrity/project/push.rb,
lib/integrity/project/notifiers.rb

Defined Under Namespace

Modules: Notifiers, Push

Instance Method Summary collapse

Methods included from Notifiers

#config_for, #enabled_notifiers, #notifies?, #update_notifiers

Methods included from Push

#push

Instance Method Details

#build(commit_identifier = "HEAD") ⇒ Object



30
31
32
33
34
35
# File 'lib/integrity/project.rb', line 30

def build(commit_identifier="HEAD")
  commit_identifier = head_of_remote_repo if commit_identifier == "HEAD"
  commit = find_or_create_commit_with_identifier(commit_identifier)

  Build.queue(commit)
end

#human_readable_statusObject



50
51
52
# File 'lib/integrity/project.rb', line 50

def human_readable_status
  last_commit && last_commit.human_readable_status
end

#last_commitObject



37
38
39
# File 'lib/integrity/project.rb', line 37

def last_commit
  commits.first(:project_id => id, :order => [:committed_at.desc])
end

#previous_commitsObject



41
42
43
44
# File 'lib/integrity/project.rb', line 41

def previous_commits
  commits.all(:project_id => id, :order => [:committed_at.desc]).
    tap {|commits| commits.shift }
end

#public=(flag) ⇒ Object



54
55
56
57
58
59
# File 'lib/integrity/project.rb', line 54

def public=(flag)
  attribute_set(:public, case flag
    when "1", "0" then flag == "1"
    else !!flag
  end)
end

#statusObject



46
47
48
# File 'lib/integrity/project.rb', line 46

def status
  last_commit && last_commit.status
end