forked from scottsbaldwin/trello_lead_time
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.rb
49 lines (43 loc) · 2.26 KB
/
sample.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'trello_lead_time'
developer_public_key = 'YOUR TRELLO PUBLIC KEY'
member_token = 'YOUR TRELLO MEMBER TOKEN'
organization_name = 'fogcreek'
board_url = 'https://trello.com/b/nC8QJJoZ/trello-development'
source_lists = ['Live (4/8)', 'Live (3/17)', 'Live (3/3)', 'Live (2/11)', 'Live (1/14)']
queue_time_lists = ['Next Up']
cycle_time_lists = ['In Progress', 'Testing']
finance_type_labels = ['Feature', 'Bug']
list_name_matcher_for_done = /^Live/
TrelloLeadTime.configure do |cfg|
cfg.organization_name = organization_name
cfg.set_trello_key_and_token(developer_public_key, member_token)
cfg.queue_time_lists = queue_time_lists
cfg.cycle_time_lists = cycle_time_lists
cfg.finance_type_labels = finance_type_labels
cfg.list_name_matcher_for_done = list_name_matcher_for_done
end
puts "-" * 40
puts "Calculating metrics for:"
puts "#{board_url}"
puts "-" * 40
board = TrelloLeadTime::Board.from_url board_url
source_lists.each do |source_list|
totals = board.totals(source_list)
averages = board.averages(source_list)
puts "Overall metrics for: #{source_list}"
puts "\tAverage Card Age: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(averages[:age][:overall])}"
puts "\tAverage Lead Time: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(averages[:lead_time][:overall])}"
puts "\tAverage Queue Time: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(averages[:queue_time][:overall])}"
puts "\tAverage Cycle Time: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(averages[:lead_time][:overall])}"
puts ""
puts "\tTotal Card Age: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(totals[:age][:overall])}"
puts "\tTotal Lead Time: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(totals[:lead_time][:overall])}"
puts "\tTotal Queue Time: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(totals[:queue_time][:overall])}"
puts "\tTotal Cycle Time: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(totals[:lead_time][:overall])}"
puts ""
puts "\tFinance type breakdown (total lead time per label):"
totals[:lead_time][:finance_types].each do |label, value|
puts "\t\t#{label}: #{TrelloLeadTime::TimeHumanizer.humanize_seconds(value)}"
end
puts ""
end