Class: Integrity::Project
- Includes:
- DataMapper::Resource, Helpers::Deprecated, Helpers::Notifiers, Helpers::Push
- Defined in:
- lib/integrity/project.rb,
lib/integrity/project/push.rb,
lib/integrity/project/notifiers.rb,
lib/integrity/project/deprecated.rb
Defined Under Namespace
Modules: Helpers
Class Method Summary collapse
Instance Method Summary collapse
- #build(commit_identifier = "HEAD") ⇒ Object
- #human_readable_status ⇒ Object
- #last_commit ⇒ Object
- #previous_commits ⇒ Object
- #public=(flag) ⇒ Object
- #status ⇒ Object
Class Method Details
.only_public_unless(condition) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/integrity/project.rb', line 32 def self.only_public_unless(condition) if condition all else all(:public => true) end end |
Instance Method Details
#build(commit_identifier = "HEAD") ⇒ Object
40 41 42 43 44 |
# File 'lib/integrity/project.rb', line 40 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_status ⇒ Object
58 59 60 |
# File 'lib/integrity/project.rb', line 58 def human_readable_status last_commit && last_commit.human_readable_status end |
#last_commit ⇒ Object
46 47 48 |
# File 'lib/integrity/project.rb', line 46 def last_commit commits.first(:project_id => id, :order => [:committed_at.desc]) end |
#previous_commits ⇒ Object
50 51 52 |
# File 'lib/integrity/project.rb', line 50 def previous_commits commits.all(:project_id => id, :order => [:committed_at.desc]).tap {|commits| commits.shift } end |
#public=(flag) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/integrity/project.rb', line 62 def public=(flag) attribute_set(:public, case flag when "1", "0" then flag == "1" else !!flag end) end |
#status ⇒ Object
54 55 56 |
# File 'lib/integrity/project.rb', line 54 def status last_commit && last_commit.status end |