class FlashFlow::Data::Base
Attributes
collection[R]
Public Class Methods
new(branch_config, filename, git, opts={})
click to toggle source
# File lib/flash_flow/data/base.rb, line 19 def initialize(branch_config, filename, git, opts={}) @git = git @store = Store.new(filename, git, opts) @collection = initialize_collection(branch_config) end
Public Instance Methods
initialize_collection(branch_config)
click to toggle source
# File lib/flash_flow/data/base.rb, line 25 def initialize_collection(branch_config) stored_collection = Collection.from_hash(stored_branches) if branch_config && !branch_config.empty? collection = Collection.fetch(branch_config) # Order matters. We are marking the PRs as current, not the branches stored in the json collection.mark_all_as_current collection = collection.reverse_merge(stored_collection) else collection = stored_collection collection.mark_all_as_current end collection.branches.delete_if { |k, v| TimeHelper.massage_time(v.updated_at) < Time.now - TimeHelper.two_weeks } collection end
merged_branches()
click to toggle source
# File lib/flash_flow/data/base.rb, line 68 def merged_branches @collection.reverse_merge(Collection.from_hash({}, stored_branches)) end
pending_release()
click to toggle source
# File lib/flash_flow/data/base.rb, line 80 def pending_release releases.detect { |r| r['status'] == 'Pending' } end
ready_to_merge_release()
click to toggle source
# File lib/flash_flow/data/base.rb, line 84 def ready_to_merge_release releases.detect { |r| r['status'] == 'Ready to merge' } end
releases()
click to toggle source
# File lib/flash_flow/data/base.rb, line 64 def releases @releases ||= stored_data['releases'] || [] end
save!()
click to toggle source
# File lib/flash_flow/data/base.rb, line 48 def save! @store.write(to_hash) end
saved_branches()
click to toggle source
# File lib/flash_flow/data/base.rb, line 76 def saved_branches Collection.from_hash(stored_branches).to_a end
stored_branches()
click to toggle source
# File lib/flash_flow/data/base.rb, line 60 def stored_branches @stored_branches ||= stored_data['branches'] || {} end
stored_data()
click to toggle source
# File lib/flash_flow/data/base.rb, line 72 def stored_data @stored_data ||= @store.get end
to_hash()
click to toggle source
# File lib/flash_flow/data/base.rb, line 52 def to_hash { 'version' => FlashFlow::VERSION, 'branches' => @collection.to_hash, 'releases' => releases } end
version()
click to toggle source
# File lib/flash_flow/data/base.rb, line 44 def version stored_data['version'] end