Class: Commit
- Inherits:
-
Object
- Object
- Commit
- Includes:
- DataMapper::Resource
- Defined in:
- lib/models/commit.rb
Class Method Summary collapse
- .download! ⇒ Object
-
.last ⇒ Object
Helpers.
- .popular ⇒ Object
- .recent ⇒ Object
- .search(sha) ⇒ Object
- .unpopular ⇒ Object
Instance Method Summary collapse
-
#author_name ⇒ Object
Repository delegation methods.
- #awesome! ⇒ Object
- #awesome? ⇒ Boolean
- #awesome_score ⇒ Object
- #message ⇒ Object
- #suck! ⇒ Object
- #suck? ⇒ Boolean
- #suck_score ⇒ Object
Class Method Details
.download! ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/models/commit.rb', line 37 def self.download! last_commit = last last_sha = last_commit ? last_commit.sha : nil Grudge::Repository.latest_commits_since(last_sha) do |repo_commit| Commit.create!(:sha => repo_commit.sha, :committed_at => repo_commit.committer_date) end end |
.last ⇒ Object
Helpers
23 |
# File 'lib/models/commit.rb', line 23 def self.last; first(:order => [:committed_at.desc]); end |
.popular ⇒ Object
25 |
# File 'lib/models/commit.rb', line 25 def self.popular; first(20, :order => [:score.desc]); end |
.recent ⇒ Object
24 |
# File 'lib/models/commit.rb', line 24 def self.recent; first(20, :order => [:committed_at.desc]); end |
.search(sha) ⇒ Object
27 28 29 30 |
# File 'lib/models/commit.rb', line 27 def self.search(sha) object = Grudge::Repository.object(sha) first(:sha => object.sha) if object end |
.unpopular ⇒ Object
26 |
# File 'lib/models/commit.rb', line 26 def self.unpopular; first(20, :order => [:score.asc]); end |
Instance Method Details
#author_name ⇒ Object
Repository delegation methods
34 |
# File 'lib/models/commit.rb', line 34 def ; repository_object..name; end |
#awesome? ⇒ Boolean
15 |
# File 'lib/models/commit.rb', line 15 def awesome?; score > 0; end |
#awesome_score ⇒ Object
14 |
# File 'lib/models/commit.rb', line 14 def awesome_score; vote_score(:score.gt); end |
#message ⇒ Object
35 |
# File 'lib/models/commit.rb', line 35 def ; repository_object.; end |
#suck? ⇒ Boolean
19 |
# File 'lib/models/commit.rb', line 19 def suck?; score < 0; end |
#suck_score ⇒ Object
18 |
# File 'lib/models/commit.rb', line 18 def suck_score; vote_score(:score.lt); end |