Class: Kettle::Family::Report
- Inherits:
-
Object
- Object
- Kettle::Family::Report
- Defined in:
- lib/kettle/family/report.rb
Instance Attribute Summary collapse
-
#branch_lanes ⇒ Object
readonly
Returns the value of attribute branch_lanes.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#family_mode ⇒ Object
readonly
Returns the value of attribute family_mode.
-
#family_name ⇒ Object
readonly
Returns the value of attribute family_name.
-
#members ⇒ Object
readonly
Returns the value of attribute members.
-
#order_mode ⇒ Object
readonly
Returns the value of attribute order_mode.
-
#release_target_branches ⇒ Object
readonly
Returns the value of attribute release_target_branches.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#selected_members ⇒ Object
readonly
Returns the value of attribute selected_members.
Instance Method Summary collapse
-
#initialize(family_name:, order_mode:, members:, selected_members:, config_path:, family_mode: nil, branch_lanes: {}, release_target_branches: [], command: nil, results: []) ⇒ Report
constructor
A new instance of Report.
- #success? ⇒ Boolean
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
- #to_text ⇒ Object
Constructor Details
#initialize(family_name:, order_mode:, members:, selected_members:, config_path:, family_mode: nil, branch_lanes: {}, release_target_branches: [], command: nil, results: []) ⇒ Report
Returns a new instance of Report.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kettle/family/report.rb', line 10 def initialize(family_name:, order_mode:, members:, selected_members:, config_path:, family_mode: nil, branch_lanes: {}, release_target_branches: [], command: nil, results: []) @family_name = family_name @family_mode = family_mode @order_mode = order_mode @members = members @selected_members = selected_members @config_path = config_path @command = command @results = results @branch_lanes = branch_lanes @release_target_branches = release_target_branches end |
Instance Attribute Details
#branch_lanes ⇒ Object (readonly)
Returns the value of attribute branch_lanes.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def branch_lanes @branch_lanes end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def command @command end |
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def config_path @config_path end |
#family_mode ⇒ Object (readonly)
Returns the value of attribute family_mode.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def family_mode @family_mode end |
#family_name ⇒ Object (readonly)
Returns the value of attribute family_name.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def family_name @family_name end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def members @members end |
#order_mode ⇒ Object (readonly)
Returns the value of attribute order_mode.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def order_mode @order_mode end |
#release_target_branches ⇒ Object (readonly)
Returns the value of attribute release_target_branches.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def release_target_branches @release_target_branches end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def results @results end |
#selected_members ⇒ Object (readonly)
Returns the value of attribute selected_members.
8 9 10 |
# File 'lib/kettle/family/report.rb', line 8 def selected_members @selected_members end |
Instance Method Details
#success? ⇒ Boolean
60 61 62 |
# File 'lib/kettle/family/report.rb', line 60 def success? results.all?(&:ok?) end |
#to_h ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kettle/family/report.rb', line 23 def to_h { "family" => family_name, "family_mode" => family_mode, "config_path" => config_path, "order_mode" => order_mode, "members" => members.map(&:to_h), "selected_members" => selected_members.map(&:name), "branch_lanes" => branch_lanes, "release_target_branches" => release_target_branches, "command" => command, "results" => results.map(&:to_h), "resume_hint" => resume_hint } end |
#to_json(*args) ⇒ Object
39 40 41 |
# File 'lib/kettle/family/report.rb', line 39 def to_json(*args) JSON.pretty_generate(to_h, *args) end |
#to_text ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/kettle/family/report.rb', line 43 def to_text lines = ["family: #{family_name}"] lines << "mode: #{family_mode}" if family_mode lines << "config: #{config_path || "none"}" lines << "order: #{order_mode}" lines << "command: #{command}" if command lines << "release targets: #{release_target_branches.join(", ")}" unless release_target_branches.empty? lines << "members:" selected_names = selected_members.map(&:name) members.each do |member| marker = selected_names.include?(member.name) ? "*" : "-" lines << " #{marker} #{member.name} #{member.version} #{member.root}" end append_results(lines) lines.join("\n") end |