|
| 1 | +class SprintDetails |
| 2 | + attr_reader :sprint_number, :recording, :slides |
| 3 | + |
| 4 | + def initialize(sprint_number, recording, slides) |
| 5 | + @sprint_number = sprint_number |
| 6 | + @recording = recording |
| 7 | + @slides = slides |
| 8 | + end |
| 9 | + |
| 10 | + def run |
| 11 | + generate_sprint_details |
| 12 | + copy_sprint_statistics |
| 13 | + end |
| 14 | + |
| 15 | + def root_dir |
| 16 | + @root_dir ||= File.expand_path("../..", __dir__) |
| 17 | + end |
| 18 | + |
| 19 | + def sprint_statistics_dir |
| 20 | + # TODO: This is gross, and we need this code in a better location |
| 21 | + @sprint_statistics_dir ||= File.expand_path("../sprint_statistics", root_dir) |
| 22 | + end |
| 23 | + |
| 24 | + def sprint_number_and_range |
| 25 | + @sprint_number_and_range ||= begin |
| 26 | + require_relative File.join(sprint_statistics_dir, "sprint_boundary_iterator") |
| 27 | + |
| 28 | + # TODO: There should be a class method on SprintBoundaryIterator that gets you the Sprint by number |
| 29 | + SprintBoundaryIterator.new.detect { |number, _range| number == sprint_number.to_i} |
| 30 | + end |
| 31 | + end |
| 32 | + |
| 33 | + def sprint_details_file |
| 34 | + @sprint_details_file ||= begin |
| 35 | + number, _range = sprint_number_and_range |
| 36 | + File.join(root_dir, "site/_sprints/#{number}.md") |
| 37 | + end |
| 38 | + end |
| 39 | + |
| 40 | + def sprint_statistics_file |
| 41 | + @sprint_statistics_file ||= begin |
| 42 | + number, _range = sprint_number_and_range |
| 43 | + File.join(root_dir, "site/_data/sprints/gh_#{sprint_number}.yaml") |
| 44 | + end |
| 45 | + end |
| 46 | + |
| 47 | + def generate_sprint_details |
| 48 | + number, range = sprint_number_and_range |
| 49 | + |
| 50 | + details = { |
| 51 | + "title" => "Sprint #{number} Details", |
| 52 | + "sprint_number" => number, |
| 53 | + "slides" => slides, |
| 54 | + "recording" => recording, |
| 55 | + "start_date" => range.begin, |
| 56 | + "end_date" => range.end, |
| 57 | + "review_date" => range.end + 2.days |
| 58 | + } |
| 59 | + details = details.to_yaml << "---\n" |
| 60 | + |
| 61 | + File.write(sprint_details_file, details) |
| 62 | + end |
| 63 | + |
| 64 | + def copy_sprint_statistics |
| 65 | + source_sprint_statistics_file = File.join(sprint_statistics_dir, "sprint_#{sprint_number}.yaml") |
| 66 | + FileUtils.cp(source_sprint_statistics_file, sprint_statistics_file) |
| 67 | + end |
| 68 | +end |
| 69 | + |
| 70 | +desc "Publish the given sprint number" |
| 71 | +task :publish_sprint, [:sprint_number] do |_task, args| |
| 72 | + sprint_number = args[:sprint_number] |
| 73 | + |
| 74 | + puts <<~EOS |
| 75 | + Follow these manual steps to prepare for publishing the Sprint: |
| 76 | +
|
| 77 | + Upload the recording to YouTube: |
| 78 | + 1. Download the cover slide of the Sprint Google Slide deck via |
| 79 | + File -> Download -> PNG image (.png, current slide) |
| 80 | + 2. Set the Title to "Sprint #{sprint_number}" |
| 81 | + 3. Set the Thumbnail to the cover slide downloaded in Step 1 |
| 82 | + 4. Set the Playlist to "Sprint Reviews" |
| 83 | + 5. Click Next until the Visibility tab, then set Save or Publish to "Public" |
| 84 | + 6. Click Publish |
| 85 | + 7. Copy the Video Link |
| 86 | + EOS |
| 87 | + puts |
| 88 | + print "Enter the recording link: " |
| 89 | + recording = STDIN.gets.chomp |
| 90 | + puts |
| 91 | + |
| 92 | + puts <<~EOS |
| 93 | + Upload the slide deck to SlideShare: |
| 94 | + 1. Download the full Sprint Google Slide deck via |
| 95 | + File -> Download -> Microsoft PowerPoint (.pptx) |
| 96 | + 2. Click Upload and choose the slide deck downloaded in Step 1 |
| 97 | + 3. Set the Title to "ManageIQ - Sprint #{sprint_number} Review - Slide Deck" |
| 98 | + 4. Set the Description to "ManageIQ Sprint #{sprint_number}" |
| 99 | + 5. Set the Category to "Software" |
| 100 | + 6. Click Publish |
| 101 | + 7. Copy the URL |
| 102 | + EOS |
| 103 | + puts |
| 104 | + print "Enter the slides link: " |
| 105 | + slides = STDIN.gets.chomp |
| 106 | + puts |
| 107 | + |
| 108 | + SprintDetails.new(sprint_number, recording, slides).run |
| 109 | +end |
| 110 | + |
| 111 | +desc "Generate a sprint details template for the given sprint number" |
| 112 | +task :generate_sprint_details_template, [:sprint_number] do |_task, args| |
| 113 | + sprint_number = args[:sprint_number] |
| 114 | + SprintDetails.new(sprint_number, nil, nil).generate_sprint_details |
| 115 | +end |
0 commit comments