Class: Reissue::Runbook
- Inherits:
-
Object
- Object
- Reissue::Runbook
- Defined in:
- lib/reissue/runbook.rb
Overview
Maintains a post-release runbook file listing steps to perform after releasing a version. The file holds only the latest release.
Constant Summary collapse
- ITEM_PATTERN =
/^- (?:\[(?<checked>[ xX])\] )?(?<text>.+)$/
Instance Attribute Summary collapse
-
#runbook_file ⇒ Object
readonly
Returns the value of attribute runbook_file.
Instance Method Summary collapse
-
#finalize(version:, date:, trailer_items: []) ⇒ Object
Stamps the header with the release version and date, merging directly edited items with trailer items (deduplicated by text).
-
#generate(version: "Unreleased") ⇒ Object
(also: #clear)
Writes a header-only template for the given version.
-
#initialize(runbook_file) ⇒ Runbook
constructor
A new instance of Runbook.
-
#items ⇒ Object
Returns the text of each checklist item, without checkbox markers.
Constructor Details
#initialize(runbook_file) ⇒ Runbook
Returns a new instance of Runbook.
9 10 11 |
# File 'lib/reissue/runbook.rb', line 9 def initialize(runbook_file) @runbook_file = runbook_file end |
Instance Attribute Details
#runbook_file ⇒ Object (readonly)
Returns the value of attribute runbook_file.
13 14 15 |
# File 'lib/reissue/runbook.rb', line 13 def runbook_file @runbook_file end |
Instance Method Details
#finalize(version:, date:, trailer_items: []) ⇒ Object
Stamps the header with the release version and date, merging directly edited items with trailer items (deduplicated by text).
29 30 31 32 33 34 35 36 |
# File 'lib/reissue/runbook.rb', line 29 def finalize(version:, date:, trailer_items: []) merged = parsed_items texts = merged.map { |item| item[:text] } trailer_items.each do |text| merged << {text: text, checked: false} unless texts.include?(text) end File.write(runbook_file, template(heading(version, date), merged)) end |
#generate(version: "Unreleased") ⇒ Object Also known as: clear
Writes a header-only template for the given version.
16 17 18 |
# File 'lib/reissue/runbook.rb', line 16 def generate(version: "Unreleased") File.write(runbook_file, template(heading(version))) end |
#items ⇒ Object
Returns the text of each checklist item, without checkbox markers.
23 24 25 |
# File 'lib/reissue/runbook.rb', line 23 def items parsed_items.map { |item| item[:text] } end |