trello_effort_tracker 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.5
2
+ - Improved docs
3
+ - Improved use of this tool as a gem
4
+
1
5
  0.0.4
2
6
  - A card moved into a DONE column is closed
3
7
 
@@ -12,6 +16,6 @@
12
16
  - Should be able to open a Trello console with a rake task
13
17
  - Avoid running the script if already run for that period
14
18
  - Tracking data is now persisted in a mongo database
15
-
19
+
16
20
  0.0.1
17
21
  - Initial Release.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trello_effort_tracker (0.0.3)
4
+ trello_effort_tracker (0.0.4)
5
5
  bson_ext
6
6
  chronic
7
7
  google_drive
@@ -47,8 +47,8 @@ GEM
47
47
  json (1.7.6)
48
48
  jwt (0.1.5)
49
49
  multi_json (>= 1.0)
50
- mime-types (1.19)
51
- mongoid (3.0.19)
50
+ mime-types (1.20.1)
51
+ mongoid (3.0.20)
52
52
  activemodel (~> 3.1)
53
53
  moped (~> 1.2)
54
54
  origin (~> 1.0)
@@ -82,7 +82,7 @@ GEM
82
82
  rspec-expectations (2.12.1)
83
83
  diff-lcs (~> 1.1.3)
84
84
  rspec-mocks (2.12.2)
85
- ruby-trello (0.5.0)
85
+ ruby-trello (0.5.1)
86
86
  activemodel
87
87
  addressable (~> 2.3)
88
88
  json
data/README.md CHANGED
@@ -6,40 +6,42 @@
6
6
  ## What is Trello Effort Tracker?
7
7
  The purpose of this tool is to extract and track estimates and actual efforts on Trello cards.
8
8
  You simply notify all of your estimates and efforts tracked on your Trello cards using a conventional format.
9
- Trello Effort Tracker will extract and store these estimates and actual efforts to let you extract useful key metrics (e.g. estimate errors, remaining efforts, pair programming frequencies, and so on).
9
+ Trello Effort Tracker will extract and store these estimates and actual efforts to let you mine useful key metrics (e.g. estimate errors, remaining efforts, pair programming frequencies, and so on).
10
10
 
11
11
  ## Why Trello Effort Tracker?
12
12
  Trello is a very good surrogate for a physical team board: it's simple and effective, and it can really help when you have a distributed team.
13
13
  That said, Trello does not (still) offer a way to track time estimated and actually spent on cards, though many people [ask for that feature](https://trello.com/card/time-tracking/4d5ea62fd76aa1136000000c/1054) on Trello's development board.
14
14
 
15
- We had the need to add time tracking to Trello, so we define a simple convention to track estimates and efforts on cards: we use a predefined board member (let's call him 'tracking user') which we sent special notifications to (we call them 'tracking notifications').
16
- This 'tracking user' will then receives estimates and efforts notifications, and Trello Effort Tracker will collect them in a simple domain model, backed on a persistent storage.
17
- Moreover, a web app will be soon available to properly present card estimates and efforts. We're working on it.
15
+ Having that precise need, we defined a simple convention to track estimates and efforts on cards: we use a predefined board member (let's call him 'tracking user') which we sent special notifications to (we call them 'tracking notifications').
16
+ This 'tracking user' will then receives estimates and efforts notifications, and Trello Effort Tracker will collect and store them.
17
+ Moreover, a web app will be soon available to properly present card estimates and efforts (we're working on it).
18
18
 
19
19
  ## More details
20
- All you need to have to start using Trello Effort Tracker is a Trello account, a Trello board and a board member to use as 'tracking user'.
20
+ All you need to have to start using Trello Effort Tracker is a Trello account, a Trello board and a board member to use as 'tracking user'.
21
21
  You'll also need to know your Trello developer key and generate a proper auth token to have access to the trackinguser's notifications.
22
22
  To see how to have these two keys, see [the following section](#api_key).
23
23
 
24
- The Trello API is used behind the scenes to read data from the team board.
25
- Trello Effort Tracker uses the awesome [Trello API Ruby wrapper](https://github.com/jeremytregunna/ruby-trello) for this purpose.
24
+ The Trello API is used behind the scenes to read data from the team board. Trello Effort Tracker uses the awesome [Trello API Ruby wrapper](https://github.com/jeremytregunna/ruby-trello) for this purpose.
26
25
 
27
- ## Installation
26
+ ## Usage
27
+ This tool can be used as a standalone gem or cloning this git repo.
28
28
 
29
- ```
30
- # gem install trello_effort_tracker
29
+ ### Installation as a ruby gem
30
+
31
+ ```shell
32
+ gem install trello_effort_tracker
31
33
  ```
32
34
 
33
- Full Disclosure: This library is still work-in-progress, so if you find anything missing or not functioning as you expect it to, please [open an issue on github](https://github.com/xpepper/trello_effort_tracker/issues).
35
+ ### Installation cloning the repo
34
36
 
35
- ## Requirements
36
- * [mongoDB](http://www.mongodb.org/) - mac users with homebrew will just run 'brew install mongodb' to have mongoDB installed on their machine.
37
- * [rvm](https://rvm.io/rvm/install/) (optional)
37
+ ```shell
38
+ git clone git://github.com/xpepper/trello_effort_tracker.git
39
+ ```
38
40
 
39
- ## Setup
40
- Copy the config template
41
+ Then cd in the lib and copy the config template
41
42
 
42
43
  ```shell
44
+ cd trello_effort_tracker
43
45
  cp config/config.template.yaml config/config.yml
44
46
  ```
45
47
 
@@ -59,6 +61,15 @@ Then run bundle to get all the required gems:
59
61
  bundle install
60
62
  ```
61
63
 
64
+
65
+ Full Disclosure: this library is still work-in-progress, so if you find anything missing or not functioning as you expect it to, please [open an issue on github](https://github.com/xpepper/trello_effort_tracker/issues).
66
+
67
+ ## Requirements
68
+ * [mongoDB](http://www.mongodb.org/) - macosx users with homebrew will just run 'brew install mongodb' to have mongoDB installed on their machine.
69
+ * (optional) [rvm](https://rvm.io/rvm/install/) is useful (but optional) for development
70
+
71
+
72
+
62
73
  ### <a id="api_key"></a>Where do I get an API key?
63
74
  Log in to Trello with your account and visit [https://trello.com/1/appKey/generate](https://trello.com/1/appKey/generate) to get your developer\_public\_key.
64
75
 
@@ -75,7 +86,7 @@ The best way is to use one of the rake task defined, e.g.
75
86
  ```ruby
76
87
  rake 'run:today[test]' # will extract today's tracked data and store on the test db
77
88
 
78
- rake run:today # will extract today's tracked data and store on the default (that is development) db
89
+ rake run:today # will extract today's tracked data and store on the default (that is development) db
79
90
 
80
91
  rake 'run:from_day[2012-11-1, production]' # will extract tracked data starting from November the 1st, 2012 and store them into the production db
81
92
  ```
@@ -83,22 +94,70 @@ rake 'run:from_day[2012-11-1, production]' # will extract tracked data starting
83
94
  Or you may just create a TrelloTracker instance and execute its track method.
84
95
 
85
96
  ```ruby
97
+ require 'trello_effort_tracker'
98
+
86
99
  tracker = TrelloTracker.new
87
100
  tracker.track
88
101
  ```
89
- You can set the Trello's auth params in three ways
90
102
 
91
- * setting the three auth params via environment variables (ENV object)
92
- * passing into the constructor a hash containing the auth values, e.g.
93
- * using the config.yml (which remains the default mode)
103
+ ### Configuration params
104
+ ### Mongo storage configuration
105
+ Tracking data collected from Trello are stored in a MongoDB database.
106
+
107
+ There are two env variables you can set to configure mongodb
108
+
109
+ - `MONGOID_ENV` defines which mongodb env is actually used (development, test, production). Development is the default mongo environment.
110
+ - `MONGOID_CONFIG_PATH` defines the path to the mongoid configuration file (default is `config/mongoid.yml`)
111
+
112
+ A standard mongoid.yml is the following:
113
+
114
+ ```yml
115
+ development:
116
+ sessions:
117
+ default:
118
+ database: trello_effort_tracker_dev
119
+ hosts:
120
+ - localhost:27017
121
+ test:
122
+ sessions:
123
+ default:
124
+ database: trello_effort_tracker_test
125
+ hosts:
126
+ - localhost:27017
127
+ production:
128
+ autocreate_indexes: true
129
+ persist_in_safe_mode: true
130
+
131
+ sessions:
132
+ default:
133
+ database: trello_effort_tracker_production
134
+ hosts:
135
+ - localhost:27017
136
+ ```
137
+
138
+ #### Trello configuration params
139
+ You can set the Trello's configuration params in three ways.
140
+ Through the following environment variables (ENV object):
141
+
142
+ ```
143
+ access_token_key
144
+ developer_public_key
145
+ tracker_username
146
+ ```
147
+
148
+ Passing into the constructor a hash containing the auth values:
94
149
 
95
150
  ```ruby
96
151
  tracker = TrelloTracker.new(
97
- "developer_public_key" => "487635b55e6fe9021902fa763b4d101a",
98
- "access_token_key" => "33bed56f2a12a49c9ba1c2d6ad3e2002e11a34358c3f3fe260d7fba746a06203")
152
+ developer_public_key: "487635b55e6fe9021902fa763b4d101a",
153
+ access_token_key: "33bed56f2a12a49c9ba1c2d6ad3e2002e11a34358c3f3fe260d7fba746a06203",
154
+ tracker_username: "my_personal_tracker")
99
155
 
100
156
  tracker.track
101
157
  ```
158
+
159
+ Or using the config.yml (which is the actual fallback mode, useful in development mode).
160
+
102
161
  ### Console
103
162
  You can open a irb console with the ruby-trello gem and this gem loaded, so that you can query the db or the Trello API and play with them
104
163
 
@@ -106,9 +165,11 @@ You can open a irb console with the ruby-trello gem and this gem loaded, so that
106
165
  rake console
107
166
  ```
108
167
 
109
- ### Storage configuration
110
- Tracking data collected from Trello are stored in a MongoDB, as configured in config/mongoid.yml.
111
- To define which mongodb env is actually used, just set the MONGOID_ENV env variable. Development is the default mongo environment.
168
+ The default env is development. To load a console in the (e.g.) production db env, execute:
169
+
170
+ ```ruby
171
+ rake "console[production]"
172
+ ```
112
173
 
113
174
  ### Estimate format convention
114
175
  To set an estimate on a card, a Trello user should send a notification from that card to the tracker username, e.g.
@@ -160,6 +221,8 @@ Sending a tracking notification with the word DONE
160
221
 
161
222
  will mark the card as closed.
162
223
 
224
+ Moreover, a card moved into a DONE column (the name of the Trello list contains the word "Done") is automatically marked as done.
225
+
163
226
  ## Database import/export
164
227
  To export the db you can execute something like:
165
228
 
@@ -226,4 +289,4 @@ The best way to get your changes merged back into core is as follows:
226
289
  1. Push the branch up to GitHub
227
290
  1. Send a pull request for your branch
228
291
 
229
- [@pierodibello](http://twitter.com/pierodibello)
292
+ [@pierodibello](http://twitter.com/pierodibello)
data/Rakefile CHANGED
@@ -5,7 +5,6 @@ RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
7
  task :specs => :spec
8
- task :c => :console
9
8
 
10
9
  desc "Open an irb session preloaded with this library, e.g. rake 'console[production]' will open a irb session with the production db env"
11
10
  task :console, [:db_env] do |t, args|
@@ -13,6 +12,10 @@ task :console, [:db_env] do |t, args|
13
12
  sh "export MONGOID_ENV=#{args.db_env}; irb -rubygems -I lib -r trello_effort_tracker.rb -r startup_trello.rb"
14
13
  end
15
14
 
15
+ task :c, [:db_env] do |t, args|
16
+ Rake::Task[:console].invoke(args.db_env)
17
+ end
18
+
16
19
  namespace :spec do
17
20
  desc "Run fast specs"
18
21
  RSpec::Core::RakeTask.new(:fast) do |t|
@@ -28,7 +28,8 @@ class TrackedCard
28
28
  def self.update_or_create_with(trello_card)
29
29
  tracked_card = find_or_create_by(trello_id: trello_card.id)
30
30
  trello_card.attributes.delete(:id)
31
- updated_successfully = tracked_card.update_attributes(trello_card.attributes.merge(done: trello_card.in_done_column?))
31
+ tracked_card_attributes = trello_card.attributes.merge(done: trello_card.in_done_column?)
32
+ updated_successfully = tracked_card.update_attributes(tracked_card_attributes)
32
33
  return tracked_card if updated_successfully
33
34
  end
34
35
 
@@ -4,12 +4,12 @@ module TrelloAuthorize
4
4
 
5
5
  def authorize_on_trello(auth_params={})
6
6
  %w{developer_public_key access_token_key}.each do |key|
7
- auth_params[key] ||= ENV[key] || authorization_params_from_config_file[key]
7
+ auth_params[key.to_sym] ||= ENV[key] || authorization_params_from_config_file[key]
8
8
  end
9
9
 
10
10
  Trello.configure do |config|
11
- config.developer_public_key = auth_params["developer_public_key"]
12
- config.member_token = auth_params["access_token_key"]
11
+ config.developer_public_key = auth_params[:developer_public_key]
12
+ config.member_token = auth_params[:access_token_key]
13
13
  end
14
14
  end
15
15
 
@@ -1,7 +1,7 @@
1
1
  module TrelloConfiguration
2
2
 
3
- def tracker_username
4
- @tracker_username ||= ENV["tracker_username"] || configuration["tracker_username"]
3
+ def tracker_username(forced_tracker_username=nil)
4
+ @tracker_username ||= forced_tracker_username || ENV["tracker_username"] || configuration["tracker_username"]
5
5
  end
6
6
 
7
7
  def authorization_params_from_config_file
@@ -9,9 +9,9 @@ module TrelloConfiguration
9
9
  end
10
10
 
11
11
  class Database
12
- def self.load_env(db_env)
12
+ def self.load_env(db_env, mongoid_configuration_path=nil)
13
13
  ENV['MONGOID_ENV'] = db_env
14
- Mongoid.load!("config/mongoid.yml", db_env)
14
+ Mongoid.load!(mongoid_configuration_path || "config/mongoid.yml", db_env)
15
15
  Trello.logger.info "Mongo db env: #{db_env.color(:green)}."
16
16
  end
17
17
  end
@@ -4,8 +4,9 @@ class TrelloTracker
4
4
 
5
5
  trap("SIGINT") { exit! }
6
6
 
7
- def initialize(custom_auth_params = {})
8
- authorize_on_trello(custom_auth_params)
7
+ def initialize(custom_config_params = {})
8
+ authorize_on_trello(custom_config_params)
9
+ tracker_username(custom_config_params[:tracker_username])
9
10
  end
10
11
 
11
12
  def track(starting_date=Date.today)
@@ -1,3 +1,3 @@
1
1
  class TrelloEffortTracker
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -4,6 +4,7 @@ require 'set'
4
4
  require 'yaml'
5
5
  require 'chronic'
6
6
  require 'mongoid'
7
+ require 'forwardable'
7
8
 
8
9
  require 'trello_effort_tracker/mongoid_helper'
9
10
  require 'trello_effort_tracker/trello_configuration'
@@ -24,6 +25,6 @@ require 'trello_effort_tracker/google_docs_exporter'
24
25
  require 'patches/trello/member'
25
26
  require 'patches/trello/card'
26
27
 
27
- TrelloConfiguration::Database.load_env(ENV['MONGOID_ENV'] || "development")
28
+ TrelloConfiguration::Database.load_env(ENV['MONGOID_ENV'] || "development", ENV['MONGOID_CONFIG_PATH'])
28
29
 
29
- Trello.logger.level = Logger::DEBUG
30
+ Trello.logger.level = Logger::DEBUG
@@ -13,14 +13,14 @@ describe TrelloTracker do
13
13
 
14
14
  let(:config) {
15
15
  # auth params for trackinguser_for_test/testinguser!
16
- OpenStruct.new(tracker_username: "trackinguser_for_test",
17
- developer_key: "ef7c400e711057d7ba5e00be20139a33",
18
- access_token: "9047d8fdbfdc960d41910673e300516cc8630dd4967e9b418fc27e410516362e")
16
+ OpenStruct.new(tracker: "trackinguser_for_test",
17
+ dev_key: "ef7c400e711057d7ba5e00be20139a33",
18
+ token: "9047d8fdbfdc960d41910673e300516cc8630dd4967e9b418fc27e410516362e")
19
19
  }
20
20
 
21
21
  it "tracks some estimates and efforts", :needs_valid_configuration => true do
22
- with_trackinguser(config.tracker_username) do
23
- tracker = TrelloTracker.new("developer_public_key" => config.developer_key, "access_token_key" => config.access_token)
22
+ without_logging do
23
+ tracker = TrelloTracker.new(tracker_username: config.tracker, developer_public_key: config.dev_key, access_token_key: config.token)
24
24
  tracker.track(DateTime.parse("2013-01-28"))
25
25
  end
26
26
 
@@ -53,16 +53,13 @@ describe TrelloTracker do
53
53
 
54
54
  private
55
55
 
56
- def with_trackinguser(tracking_user, &block)
57
- original_tracker = ENV["tracker_username"]
56
+ def without_logging(&block)
58
57
  original_error_level = Trello.logger.level
59
58
 
60
59
  begin
61
- ENV["tracker_username"] = tracking_user
62
60
  Trello.logger.level = Logger::WARN
63
61
  block.call unless block.nil?
64
62
  ensure
65
- ENV["tracker_username"] = original_tracker
66
63
  Trello.logger.level = original_error_level
67
64
  end
68
65
  end
@@ -19,7 +19,7 @@ describe TrelloAuthorize do
19
19
  ENV["developer_public_key"] = ENV["access_token_key"] = "anything"
20
20
  YAML.should_receive(:load_file).never
21
21
 
22
- authorize_on_trello("developer_public_key" => "custom_dpk", "access_token_key" => "custom_atk")
22
+ authorize_on_trello(developer_public_key: "custom_dpk", access_token_key: "custom_atk")
23
23
 
24
24
  Trello.client.auth_policy.developer_public_key.should == "custom_dpk"
25
25
  Trello.client.auth_policy.member_token.should == "custom_atk"
@@ -31,7 +31,7 @@ describe TrelloAuthorize do
31
31
 
32
32
  YAML.should_receive(:load_file).never
33
33
 
34
- authorize_on_trello("any" => "thing")
34
+ authorize_on_trello(any: "thing")
35
35
 
36
36
  Trello.client.auth_policy.developer_public_key.should == "my_dpk"
37
37
  Trello.client.auth_policy.member_token.should == "my_atk"
@@ -43,7 +43,7 @@ describe TrelloAuthorize do
43
43
  config_hash = {"trello" => { "developer_public_key" => "any_dpk", "access_token_key" => "any_atk"}}
44
44
  YAML.should_receive(:load_file).with("config/config.yml").and_return(config_hash)
45
45
 
46
- authorize_on_trello("any" => "thing")
46
+ authorize_on_trello(any: "thing")
47
47
 
48
48
  Trello.client.auth_policy.developer_public_key.should == "any_dpk"
49
49
  Trello.client.auth_policy.member_token.should == "any_atk"
@@ -11,22 +11,22 @@ describe TrelloConfiguration do
11
11
 
12
12
  authorization_params_from_config_file["developer_public_key"].should == "any_dpk"
13
13
  authorization_params_from_config_file["access_token_key"].should == "any_atk"
14
- end
14
+ end
15
15
  end
16
-
16
+
17
17
  describe "#tracker_username" do
18
18
  before(:each) do
19
19
  @original = ENV["tracker_username"]
20
20
  end
21
-
21
+
22
22
  after(:each) do
23
23
  ENV["tracker_username"] = @original
24
24
  end
25
-
25
+
26
26
  it "searches for the trello tracker username first from an env var" do
27
27
  ENV["tracker_username"] = "my_tracker"
28
28
  YAML.should_receive(:load_file).never
29
-
29
+
30
30
  tracker_username.should == "my_tracker"
31
31
  end
32
32
 
@@ -34,10 +34,10 @@ describe TrelloConfiguration do
34
34
  ENV["tracker_username"] = nil
35
35
  config_hash = {"tracker_username" => "my_trello_tracker" }
36
36
  YAML.should_receive(:load_file).with("config/config.yml").and_return(config_hash)
37
-
37
+
38
38
  tracker_username.should == "my_trello_tracker"
39
39
  end
40
-
40
+
41
41
  end
42
42
 
43
43
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe TrelloTracker do
4
+
5
+ before(:each) do
6
+ @original = ENV["tracker_username"]
7
+ ENV["tracker_username"] = "my_tracker"
8
+ end
9
+
10
+ after(:each) do
11
+ ENV["tracker_username"] = @original
12
+ end
13
+
14
+ it "force the trello tracker username in the constructor" do
15
+ tracker = TrelloTracker.new(tracker_username: "any_other_tracker")
16
+
17
+ tracker.tracker_username.should == "any_other_tracker"
18
+ end
19
+
20
+ it "takes the tracker username from the ENV var tracker_username" do
21
+ tracker = TrelloTracker.new
22
+
23
+ tracker.tracker_username.should == "my_tracker"
24
+ end
25
+
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_effort_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-03 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-trello
@@ -182,6 +182,7 @@ files:
182
182
  - spec/tracking_factory_spec.rb
183
183
  - spec/trello_authorize_spec.rb
184
184
  - spec/trello_configuration_spec.rb
185
+ - spec/trello_tracker_spec.rb
185
186
  - trello_effort_tracker.gemspec
186
187
  homepage: http://xplayer.wordpress.com
187
188
  licenses: []