Skip to content

Commit f0aad54

Browse files
author
Matt Zimmerman
committed
Import
0 parents  commit f0aad54

File tree

5 files changed

+106
-0
lines changed

5 files changed

+106
-0
lines changed

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem "ruby-trello", :git => "https://github.com/mdz/ruby-trello"

Gemfile.lock

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
GIT
2+
remote: https://github.com/mdz/ruby-trello
3+
revision: d0cbfa358cfb94f057b9b37a89f5ce71b6651155
4+
specs:
5+
ruby-trello (0.4.3)
6+
activemodel
7+
addressable (~> 2.3)
8+
json
9+
oauth (~> 0.4.5)
10+
rest-client (~> 1.6.7)
11+
12+
GEM
13+
remote: https://rubygems.org/
14+
specs:
15+
activemodel (3.2.8)
16+
activesupport (= 3.2.8)
17+
builder (~> 3.0.0)
18+
activesupport (3.2.8)
19+
i18n (~> 0.6)
20+
multi_json (~> 1.0)
21+
addressable (2.3.2)
22+
builder (3.0.3)
23+
i18n (0.6.1)
24+
json (1.7.5)
25+
mime-types (1.19)
26+
multi_json (1.3.6)
27+
oauth (0.4.7)
28+
rest-client (1.6.7)
29+
mime-types (>= 1.16)
30+
31+
PLATFORMS
32+
ruby
33+
34+
DEPENDENCIES
35+
ruby-trello!

Procfile

Whitespace-only changes.

env.sample

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
TRELLO_API_KEY=
2+
TRELLO_API_SECRET=
3+
TRELLO_API_TOKEN=
4+
OPS_BOARD_ID=

stats.rb

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
require 'trello'
2+
3+
include Trello
4+
include Trello::Authorization
5+
6+
Trello::Authorization.const_set :AuthPolicy, OAuthPolicy
7+
8+
OAuthPolicy.consumer_credential = OAuthCredential.new ENV['TRELLO_API_KEY'], ENV['TRELLO_API_SECRET']
9+
OAuthPolicy.token = OAuthCredential.new ENV['TRELLO_API_TOKEN'], nil
10+
11+
count_by_state = {}
12+
count_by_label = {}
13+
checklist_totals = [0,0]
14+
15+
board = Trello::Board.find(ENV['OPS_BOARD_ID'])
16+
board.lists.each do |list|
17+
next if list.name == 'Ideas'
18+
19+
count_by_state[list.name] = 0
20+
21+
list.cards.each do |card|
22+
23+
count_by_state[list.name] += 1
24+
labeled = false
25+
card.labels.each do |label|
26+
count_by_label[label.name] ||= 0
27+
count_by_label[label.name] += 1
28+
labeled = true
29+
end
30+
31+
count_by_label["Unlabeled"] ||= 0
32+
if not labeled
33+
count_by_label["Unlabeled"] += 1
34+
end
35+
36+
37+
states = Hash[card.check_item_states.map {|state| [state.item_id, state.state]}]
38+
39+
card.checklists.each do |checklist|
40+
checklist.items.each do |item|
41+
checklist_totals[0] += 1 if states[item.id] == 'complete'
42+
checklist_totals[1] += 1
43+
end
44+
end
45+
end
46+
end
47+
48+
49+
total = 0
50+
count_by_state.each do |state,count|
51+
puts "#{state} #{count}"
52+
total += count
53+
end
54+
puts "Total #{total}"
55+
puts
56+
57+
total = 0
58+
count_by_label.each do |label,count|
59+
puts "#{label} #{count}"
60+
total += count
61+
end
62+
puts
63+
64+
puts "Checklist items #{checklist_totals[0]} / #{checklist_totals[1]} (#{checklist_totals[0] * 100 / checklist_totals[1]}%)"

0 commit comments

Comments
 (0)