Class: Todidnt::GitHistory
- Inherits:
-
Object
- Object
- Todidnt::GitHistory
- Defined in:
- lib/todidnt/git_history.rb
Instance Attribute Summary collapse
-
#blames ⇒ Object
Returns the value of attribute blames.
Instance Method Summary collapse
-
#initialize ⇒ GitHistory
constructor
A new instance of GitHistory.
- #timeline! ⇒ Object
Constructor Details
#initialize ⇒ GitHistory
Returns a new instance of GitHistory.
6 7 8 9 10 |
# File 'lib/todidnt/git_history.rb', line 6 def initialize @history = [] @blames = {} @unmatched_deletions = [] end |
Instance Attribute Details
#blames ⇒ Object
Returns the value of attribute blames.
4 5 6 |
# File 'lib/todidnt/git_history.rb', line 4 def blames @blames end |
Instance Method Details
#timeline! ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/todidnt/git_history.rb', line 12 def timeline! # TODO: It would probably be better/simpler to just Marshal the # GitHistory object itself. if Cache.exists?(:history) puts "Found cached history..." cache = Cache.load(:history) @history = cache.data[:history] @blames = cache.data[:blames] @unmatched_deletions = cache.data[:unmatched_deletions] last_commit = cache.data[:last_commit] end new_commit = analyze(last_commit) if new_commit != last_commit # If there's any new history, update the cache. to_cache = { last_commit: new_commit, history: @history, blames: @blames, unmatched_deletions: @unmatched_deletions } Cache.save(:history, to_cache) end if @unmatched_deletions.length > 0 puts "Warning: there are some unmatched TODO deletions." end bucket end |