Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional burndown generation on trollolo scrum end-sprint #204

Merged
merged 3 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/cli/scrum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ def prioritize
EOT
option 'board-id', desc: 'Id of the board', required: true
option 'target-board-id', desc: 'Id of the target board', required: true
option 'burndown-update', desc: 'Generate new burndown data', type: :boolean, default: false
def end_sprint
CliSettings.process_global_options options
CliSettings.require_trello_credentials

s = Scrum::SprintCleaner.new(CliSettings.settings)
s.cleanup(CliSettings.board_id(options['board-id']),
CliSettings.board_id(options['target-board-id']))
boards = Scrum::Boards.new(CliSettings.settings.scrum)
cleaner = Scrum::SprintCleaner.new(CliSettings.settings)
cleaner.setup_boards(sprint_board: boards.sprint_board(CliSettings.board_from_id(options['board-id'])),
target_board: CliSettings.board_from_id(options['target-board-id']))
cleaner.cleanup(run_burndown: options['burndown-update'])
end

desc 'start', 'Move the planning backlog to the sprint board'
Expand Down
6 changes: 3 additions & 3 deletions lib/scrum/sprint_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module Scrum
class SprintCleaner < TrelloService
include BoardLocator

def cleanup(set_last_sprint_label: false)
def cleanup(set_last_sprint_label: false, run_burndown: false)
load

gen_burndown
gen_burndown if run_burndown

move_cards(@board.backlog_list, set_last_sprint_label)
move_cards(@board.doing_list, set_last_sprint_label) if @board.doing_list
Expand Down Expand Up @@ -64,7 +64,7 @@ def gen_burndown
chart = BurndownChart.new(@settings)
begin
chart.update({})
puts 'New burndown data was generated automatically.'
puts "Updated data for sprint #{chart.sprint}"
rescue TrolloloError => e
if e.message =~ /(burndown-data-)\d*.yaml' (not found)/
puts e.message + '. Skipping automatic burndown generation.'
Expand Down
15 changes: 11 additions & 4 deletions spec/unit/scrum/sprint_cleaner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
end

it 'moves remaining cards to target board' do
expect(STDOUT).to receive(:puts).exactly(4).times
expect(STDOUT).to receive(:puts).exactly(3).times
expect(old_story_card).to receive(:move_to_board).with(target_board, ready_for_estimation).exactly(3).times
expect(old_story_card).to receive(:add_label).exactly(3).times
sprint_cleaner.cleanup(set_last_sprint_label: true)
end
end

it 'moves remaining cards to target board' do
expect(STDOUT).to receive(:puts).exactly(4).times
expect(STDOUT).to receive(:puts).exactly(3).times
expect(old_story_card).to receive(:move_to_board).with(target_board, ready_for_estimation).exactly(3).times
sprint_cleaner.cleanup
end
Expand All @@ -70,11 +70,18 @@
allow_any_instance_of(BurndownChart).to receive(:update)
end

it 'generates new burndown data' do
it 'does not generate new burndown data per default' do
expect(old_story_card).to receive(:move_to_board).with(target_board, ready_for_estimation).exactly(3).times
expect do
sprint_cleaner.cleanup
end.to output(/^(New burndown data was generated automatically)/).to_stdout
end.not_to output(/^(Update data for sprint 1)/).to_stdout
end

it 'generates new burndown data when run_burndown parameter is true' do
expect(old_story_card).to receive(:move_to_board).with(target_board, ready_for_estimation).exactly(3).times
expect do
sprint_cleaner.cleanup(run_burndown: true)
end.to output(/^(Update data for sprint 1)*/).to_stdout
end
end

Expand Down