Class: FlashFlow::Merge::Status
- Inherits:
-
Object
- Object
- FlashFlow::Merge::Status
- Defined in:
- lib/flash_flow/merge/status.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#issue_tracker ⇒ Object
readonly
Returns the value of attribute issue_tracker.
-
#releases ⇒ Object
readonly
Returns the value of attribute releases.
-
#stories ⇒ Object
readonly
Returns the value of attribute stories.
Instance Method Summary collapse
- #branches ⇒ Object
-
#initialize(issue_tracker_config, branches_config, branch_info_file, git_config, opts = {}) ⇒ Status
constructor
A new instance of Status.
- #status ⇒ Object
- #status_html(filename = nil) ⇒ Object
Constructor Details
#initialize(issue_tracker_config, branches_config, branch_info_file, git_config, opts = {}) ⇒ Status
Returns a new instance of Status.
8 9 10 11 |
# File 'lib/flash_flow/merge/status.rb', line 8 def initialize(issue_tracker_config, branches_config, branch_info_file, git_config, opts={}) @issue_tracker = IssueTracker::Base.new(issue_tracker_config) @collection = Data::Base.new(branches_config, branch_info_file, ShadowGit.new(git_config)).collection end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
6 7 8 |
# File 'lib/flash_flow/merge/status.rb', line 6 def collection @collection end |
#issue_tracker ⇒ Object (readonly)
Returns the value of attribute issue_tracker.
6 7 8 |
# File 'lib/flash_flow/merge/status.rb', line 6 def issue_tracker @issue_tracker end |
#releases ⇒ Object (readonly)
Returns the value of attribute releases.
6 7 8 |
# File 'lib/flash_flow/merge/status.rb', line 6 def releases @releases end |
#stories ⇒ Object (readonly)
Returns the value of attribute stories.
6 7 8 |
# File 'lib/flash_flow/merge/status.rb', line 6 def stories @stories end |
Instance Method Details
#branches ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/flash_flow/merge/status.rb', line 45 def branches g = ReleaseGraph.build(collection.current_branches, issue_tracker) branch_hash = {} collection.current_branches.each_with_index do |branch, i| connected_branches = g.connected_branches(branch.ref) connected_stories = g.connected_stories(branch.ref) connected_releases = g.connected_releases(branch.ref) add_stories(connected_stories) add_releases(connected_releases) sub_g = ReleaseGraph.build(connected_branches, issue_tracker) graph_file = sub_g.output("/tmp/graph-#{i}.png") branch_hash[branch] = Hash.new.tap do |hash| hash[:name] = branch.ref hash[:branch_url] = collection.branch_link(branch) hash[:code_reviewed?] = collection.code_reviewed?(branch) hash[:can_ship?] = collection.can_ship?(branch) hash[:connected_branches] = connected_branches hash[:image] = graph_file hash[:my_stories] = branch.stories.to_a hash[:stories] = connected_stories hash[:releases] = connected_releases end end mark_as_shippable(branch_hash) branch_hash end |
#status ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flash_flow/merge/status.rb', line 13 def status filename = File.dirname(__FILE__) + '/merge_status.csv' checkmark = "\u2713".encode('utf-8') CSV.open(filename, 'w') do |f| f << ['Ready', 'Branch', 'Stories', 'Review', 'Can ship?'] branches.each do |_, branch_hash| f << [ branch_hash[:shippable?] ? checkmark : 'x', branch_hash[:name], unshippable_stories(branch_hash[:stories]).empty? ? checkmark : 'x', branch_hash[:code_reviewed?] ? checkmark : 'x', branch_hash[:can_ship?] ? checkmark : 'x' ] end end CSV.foreach(filename) { |row| puts '%-10s %-70s %-10s %-10s %-10s' % row } end |
#status_html(filename = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/flash_flow/merge/status.rb', line 33 def status_html(filename=nil) filename = File.dirname(__FILE__) + '/merge_status.html' @branches = branches template = ERB.new File.read(File.dirname(__FILE__) + '/merge_status.html.erb') html = template.result(binding) File.open(filename, 'w') do |f| f.puts html end `open #{filename}` end |