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

Add --plot-to-board to plot command #184

Closed
wants to merge 5 commits into from
Closed
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
5 changes: 3 additions & 2 deletions lib/burndown_chart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ def read_data(filename)
doing_columns = @data['meta']['doing_columns']
@settings.doing_columns = doing_columns if doing_columns

not_done_columns = @data['meta']['not_done_columns']
@settings.not_done_columns = not_done_columns if not_done_columns
if @data['meta']['not_done_columns']
raise '`not_done_columns` is deprecated. Use `todo_columns` and `doing_columns` instead.'
end

@settings.swimlanes = @data['meta']['swimlanes'] || []
end
Expand Down
27 changes: 25 additions & 2 deletions lib/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,24 @@ def burndown
end
end

desc 'plot SPRINT-NUMBER [--output] [--no-tasks] [--with-fast-lane]', 'Plot burndown chart for given sprint'
desc 'plot SPRINT-NUMBER [--output] [--no-tasks] [--with-fast-lane] [--plot-to-board]', 'Plot burndown chart for given sprint'
option :output, aliases: :o, desc: 'Output directory', required: false
option 'with-fast-lane', desc: 'Plot Fast Lane with new cards bars', required: false, type: :boolean
option 'no-tasks', desc: 'Do not plot tasks line', required: false, type: :boolean
option :plot_to_board, type: :boolean, desc: 'Send the plotted data to the first card of Done column'
def plot(sprint_number)
process_global_options options
BurndownChart.plot(sprint_number, options)
if options[:plot_to_board]
begin
chart = BurndownChart.new @@settings
chart.update(options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also modifying the yml file, which we don't want to modify here. We only want to print the image and push it to the card.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help identifying the line at which it modifying the .yml file. And by .yml file do you mean burndown-data-01.yml file which is created at time of initialization

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inside of the update method.

Yes, the burndown-data-i.yaml file, where i is the number of the sprint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ana06 I dont see any change in the yml file. Please check now is it good to merge?

rescue TrolloloError => e
STDERR.puts e
exit 1
end
else
BurndownChart.plot(sprint_number, options)
end
end

desc 'backup', 'Create backup of board'
Expand All @@ -215,6 +226,18 @@ def list_backups
end
end

desc 'show-backlog', 'Show backlog of board'
option 'board-id', desc: 'Id of Trello board', required: true
def show_backlog
puts '| Title'

trello = TrelloWrapper.new(@@settings)
board = trello.board(options['board-id'])
board.planning_backlog_column.cards.each do |card|
puts "| #{card.name}"
end
end

desc 'show-backup', 'Show backup of board'
option 'board-id', desc: 'Id of Trello board', required: true
option 'show-descriptions', desc: 'Show descriptions of cards', required: false, type: :boolean
Expand Down
6 changes: 5 additions & 1 deletion lib/scrum_board.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def columns
@columns ||= @board_data['lists'].map{|x| Column.new(@board_data, x['id'], @settings)}
end

def planning_backlog_column
columns.select{ |column| column.name == @settings.scrum['list_names']['planning_backlog'] }.first
end

def todo_columns
columns.select{|c| @settings.todo_columns.include?(c.name)}
end
Expand Down Expand Up @@ -46,7 +50,7 @@ def done_cards
end

def open_columns
columns.select{ |col| @settings.not_done_columns.include?(col.name) }
todo_columns + doing_columns
end

def open_cards
Expand Down
3 changes: 1 addition & 2 deletions lib/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class Settings

attr_accessor :developer_public_key, :member_token, :board_aliases, :verbose,
:raw, :not_done_columns, :todo_columns, :doing_columns, :accepted_column_name_regex,
:raw, :todo_columns, :doing_columns, :accepted_column_name_regex,
:done_column_name_regex, :todo_column_name_regex, :scrum,
:no_task_checklists, :swimlanes

Expand All @@ -32,7 +32,6 @@ def initialize(config_file_path)
@member_token = @config['member_token']
@board_aliases = @config['board_aliases'] || {}
@scrum = OpenStruct.new(@config['scrum'] || scrum_defaults)
@not_done_columns = @config['not_done_columns'].freeze || ['Sprint Backlog', 'Doing']
@no_task_checklists = @config['no_task_checklists'].freeze || ['Feedback']
@todo_columns = @config['todo_columns'].freeze || ['Sprint Backlog']
@doing_columns = @config['doing_columns'].freeze || ['Doing']
Expand Down
14 changes: 7 additions & 7 deletions man/trollolo.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and cards and has functionality for extracting data for burndown charts.

`trollolo help [COMMAND]`

Displays help about the available trollolo commands. Can take a command as
Displays help about the available trollolo commands. Can take a command as
an argument to display detailed information about it.

### burndown-init -- Initialize burndown chart
Expand Down Expand Up @@ -77,8 +77,8 @@ BOARDS`.

`trollolo burndowns --board-list=<board list>`

Updates the burndown data for all boards specified in the YAML file in the
given directory. See the previous section for details on the update process.
Updates the burndown data for all boards specified in the YAML file in the
given directory. See the previous section for details on the update process.

### plot -- Plot burndown chart

Expand Down Expand Up @@ -130,7 +130,7 @@ part and API version as well as the credentials from the Trollolo configuration.

`trollolo backup --board-id=<board id>`

Save a local copy of a board as a JSON file. The backup will be stored in
Save a local copy of a board as a JSON file. The backup will be stored in
'~/.trollolo/backup/<board-id>/'.

### list-backups -- List all backups
Expand Down Expand Up @@ -171,7 +171,7 @@ be an attachment of the given card. If you want to use a new picture use

Get details of an organization.

### organization-members -- Get a list of organization member
### organization-members -- Get a list of organization member

`trollolo organization-members --org-name=<organization name>`

Expand Down Expand Up @@ -214,7 +214,7 @@ sprint is finished.
`trollolo set-priorities --board-id=<board id>`

Add 'P<n>: ' to the beginning of every cards title in the 'Backlog' list,
replacing old values if present. 'n' is the current position of the card in the list.
replacing old values if present. 'n' is the current position of the card in the list.


## EXAMPLES
Expand Down Expand Up @@ -287,7 +287,7 @@ progress, and a list with a name starting with `Done`. If there are multiple
lists starting with `Done` the first one is taken.

Other names of columns with work in progress can be set in the YAML file in the
`meta` section as an array of column names under the key `not_done_columns`.
`meta` section as an array of column names under the key `doing_columns`.

On work item cards the tool takes a bracketed number as suffix as size of the
item in story points. E.g. a card with the title `(3) Build magic tool` would
Expand Down
3 changes: 1 addition & 2 deletions spec/data/trollolorc
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
developer_public_key: mykey
member_token: mytoken
not_done_columns:
doing_columns:
- Blocked
- Doing
- In review
- Sprint Backlog
no_task_checklists:
- Definition of done
- Feedback
Expand Down
3 changes: 1 addition & 2 deletions spec/data/trollolorc_with_board_aliases
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
developer_public_key: mykey
member_token: mytoken
not_done_columns:
doing_columns:
- Blocked
- Doing
- In review
- Sprint Backlog
board_aliases:
MyTrelloBoard: 53186e8391ef8671265eba9d
149 changes: 100 additions & 49 deletions spec/data/vcr/sprint_planning_board.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions spec/unit/burndown_chart_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@
expect(@settings.doing_columns).to eq ['Doing', 'QA']
end

it 'reads not done columns' do
@chart.read_data given_file('burndown-data.yaml', from: 'burndown-data-with-config.yaml')
expect(@settings.not_done_columns).to eq ['Sprint Backlog', 'Doing', 'QA']
it 'reads not done columns and throws depecration error' do
expect do
@chart.read_data given_file('burndown-data.yaml', from: 'burndown-data-with-config.yaml')
end.to raise_error(/deprecated/)
end

it 'reads swimlanes' do
Expand Down
Loading