taskmapper 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.document +5 -0
  2. data/.travis.yml +4 -0
  3. data/Gemfile +12 -0
  4. data/Gemfile.lock +52 -0
  5. data/LICENSE +20 -0
  6. data/NOTES +18 -0
  7. data/README.md +296 -0
  8. data/Rakefile +40 -0
  9. data/TODO +1 -0
  10. data/VERSION +1 -0
  11. data/bin/tm +7 -0
  12. data/examples/tm_example.rb +11 -0
  13. data/examples/tm_example_2.rb +11 -0
  14. data/examples/tm_example_3.rb +21 -0
  15. data/examples/tm_example_4.rb +17 -0
  16. data/lib/taskmapper.rb +53 -0
  17. data/lib/taskmapper/authenticator.rb +2 -0
  18. data/lib/taskmapper/cli/commands/config.rb +100 -0
  19. data/lib/taskmapper/cli/commands/console.rb +35 -0
  20. data/lib/taskmapper/cli/commands/generate.rb +112 -0
  21. data/lib/taskmapper/cli/commands/generate/provider.rb +5 -0
  22. data/lib/taskmapper/cli/commands/generate/provider/comment.rb +14 -0
  23. data/lib/taskmapper/cli/commands/generate/provider/project.rb +26 -0
  24. data/lib/taskmapper/cli/commands/generate/provider/provider.rb +25 -0
  25. data/lib/taskmapper/cli/commands/generate/provider/ticket.rb +12 -0
  26. data/lib/taskmapper/cli/commands/help.rb +9 -0
  27. data/lib/taskmapper/cli/commands/help/config +27 -0
  28. data/lib/taskmapper/cli/commands/help/console +13 -0
  29. data/lib/taskmapper/cli/commands/help/generate +19 -0
  30. data/lib/taskmapper/cli/commands/help/help +7 -0
  31. data/lib/taskmapper/cli/commands/help/project +13 -0
  32. data/lib/taskmapper/cli/commands/help/ticket +14 -0
  33. data/lib/taskmapper/cli/commands/project.rb +140 -0
  34. data/lib/taskmapper/cli/commands/ticket.rb +145 -0
  35. data/lib/taskmapper/cli/common.rb +28 -0
  36. data/lib/taskmapper/cli/init.rb +77 -0
  37. data/lib/taskmapper/comment.rb +97 -0
  38. data/lib/taskmapper/common.rb +81 -0
  39. data/lib/taskmapper/dummy/comment.rb +27 -0
  40. data/lib/taskmapper/dummy/dummy.rb +28 -0
  41. data/lib/taskmapper/dummy/project.rb +42 -0
  42. data/lib/taskmapper/dummy/ticket.rb +43 -0
  43. data/lib/taskmapper/exception.rb +2 -0
  44. data/lib/taskmapper/helper.rb +72 -0
  45. data/lib/taskmapper/project.rb +145 -0
  46. data/lib/taskmapper/provider.rb +82 -0
  47. data/lib/taskmapper/tester/comment.rb +18 -0
  48. data/lib/taskmapper/tester/project.rb +19 -0
  49. data/lib/taskmapper/tester/tester.rb +28 -0
  50. data/lib/taskmapper/tester/ticket.rb +19 -0
  51. data/lib/taskmapper/ticket.rb +154 -0
  52. data/spec/project_spec.rb +84 -0
  53. data/spec/rcov.opts +1 -0
  54. data/spec/spec.opts +1 -0
  55. data/spec/spec_helper.rb +9 -0
  56. data/spec/taskmapper-cli_spec.rb +60 -0
  57. data/spec/taskmapper-exception_spec.rb +160 -0
  58. data/spec/taskmapper_spec.rb +13 -0
  59. data/spec/ticket_spec.rb +56 -0
  60. data/taskmapper.gemspec +118 -0
  61. metadata +189 -0
@@ -0,0 +1,5 @@
1
+ README.md
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source :rubygems
2
+
3
+ gem 'activeresource', '~> 3.0'
4
+ gem 'activesupport', '~> 3.0'
5
+ gem 'hashie', "~> 1.2"
6
+
7
+ group :test, :development do
8
+ gem 'rspec', '~> 2.0'
9
+ gem 'jeweler', "~> 1.8"
10
+ gem "simplecov", "~> 0.5", :platform => :ruby_19
11
+ gem "rcov", "~> 1.0", :platform => :ruby_18
12
+ end
@@ -0,0 +1,52 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (3.2.2)
5
+ activesupport (= 3.2.2)
6
+ builder (~> 3.0.0)
7
+ activeresource (3.2.2)
8
+ activemodel (= 3.2.2)
9
+ activesupport (= 3.2.2)
10
+ activesupport (3.2.2)
11
+ i18n (~> 0.6)
12
+ multi_json (~> 1.0)
13
+ builder (3.0.0)
14
+ diff-lcs (1.1.3)
15
+ git (1.2.5)
16
+ hashie (1.2.0)
17
+ i18n (0.6.0)
18
+ jeweler (1.8.3)
19
+ bundler (~> 1.0)
20
+ git (>= 1.2.5)
21
+ rake
22
+ rdoc
23
+ json (1.6.5)
24
+ multi_json (1.1.0)
25
+ rake (0.9.2.2)
26
+ rcov (1.0.0)
27
+ rdoc (3.12)
28
+ json (~> 1.4)
29
+ rspec (2.9.0)
30
+ rspec-core (~> 2.9.0)
31
+ rspec-expectations (~> 2.9.0)
32
+ rspec-mocks (~> 2.9.0)
33
+ rspec-core (2.9.0)
34
+ rspec-expectations (2.9.1)
35
+ diff-lcs (~> 1.1.3)
36
+ rspec-mocks (2.9.0)
37
+ simplecov (0.6.1)
38
+ multi_json (~> 1.0)
39
+ simplecov-html (~> 0.5.3)
40
+ simplecov-html (0.5.3)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ activeresource (~> 3.0)
47
+ activesupport (~> 3.0)
48
+ hashie (~> 1.2)
49
+ jeweler (~> 1.8)
50
+ rcov (~> 1.0)
51
+ rspec (~> 2.0)
52
+ simplecov (~> 0.5)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2010 The Hybrid Group
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/NOTES ADDED
@@ -0,0 +1,18 @@
1
+ This needs a documentation for implementing Providers and some guidelines on Provider stuff.
2
+
3
+ Environment variables and config files
4
+ ~/.taskmapper.yml
5
+
6
+
7
+ .taskmapper.yml
8
+ default: lighthouse
9
+ lighthouse:
10
+ token: 67dc50b88ea1e339eb72ba0e2b90573b6453d805
11
+ account: taskmapper
12
+ unfuddle:
13
+ username: xxx
14
+ password: xxx
15
+ subdomain: xxx
16
+
17
+
18
+
@@ -0,0 +1,296 @@
1
+ # taskmapper
2
+
3
+ taskmapper is a Gem which eases communication with various project and ticket management systems by providing a consistent Ruby API.
4
+
5
+ taskmapper let's you "remap" a system into the consistent taskmapper API, easily. For instance the description of an issue/ticket, might be named **description** in one system, and **problem-description** somewhere else. Via taskmapper, this would always be called **description**. The taskmapper remaps makes it easy for you to integrate different kinds of ticket systems, into your own system. You don't have to take care of all the different kinds of systems, and their different APIs. taskmapper handles all this *for* you, so you can focus on making your application awesome.
6
+
7
+ ## Installation
8
+
9
+ taskmapper is a Gem, so we can easily install it by using RubyGems:
10
+
11
+ gem install taskmapper
12
+
13
+ taskmapper depends on [Hashie](http://github.com/intridea/hashie), which is an amazing library which makes converting objects to hashes, and the other way around, a joy. It should be installed automatically whenever installing taskmapper.
14
+
15
+ ### Finding and installing a provider
16
+
17
+ taskmapper by itself won't do too much. You may want to install a provider, to retrieve a list of available providers issue the following command:
18
+
19
+ gem search taskmapper
20
+
21
+ You could then install for instance taskmapper-pivotal:
22
+
23
+ gem install taskmapper-pivotal
24
+
25
+ ## Usage
26
+
27
+ **Note:** The API may change, and the following may not be the final. Please keep yourself updated before you upgrade.
28
+
29
+ First, we instance a new class with the right set of options. In this example, we are authenticating with Pivotal Tracker.
30
+
31
+ pivotal = taskmapper.new(:pivotal, {:username => "john", :password => "seekrit"})
32
+
33
+ ### Grabbing a project
34
+
35
+ Now that we've got out taskmapper instance, let's go ahead and grab "testproject":
36
+
37
+ project = pivotal.project["testproject"]
38
+ #=> taskmapper::Project<#name="testproject"..>
39
+
40
+ *Project#[]* is an alias to *Project#find*:
41
+
42
+ project = pivotal.project.find "testproject"
43
+ #=> taskmapper::Project<#name="testproject"..>
44
+
45
+ Which translates into:
46
+
47
+ project = pivotal.project.find :name => "testproject"
48
+ #=> taskmapper::Project<#name="testproject"..>
49
+
50
+ That means you can actually look up a project by something else than the title, like the owner:
51
+
52
+ project = pivotal.project.find :owner => "Sirupsen"
53
+ #=> taskmapper::Project<#owner="sirupsen"..>
54
+
55
+ To retrieve all projects, simply pass no argument to find:
56
+
57
+ project = pivotal.project.find
58
+ #=> [taskmapper::Project<#..>,TaskMapper::Project<#..>,..]
59
+
60
+ ### Creating a ticket
61
+
62
+ Now that we grabbed the right project. Let's go ahead and create a ticket at this project:
63
+
64
+ project.ticket!(:title => "Test", :description => "Hello World")
65
+
66
+ We create our ticket with three properties.
67
+
68
+ ### Finding tickets
69
+
70
+ Alright, let's play with the projects tickets! Here we grab the ticket with the id of 22:
71
+
72
+ ticket = project.tickets(:id => 22)
73
+ #=> taskmapper::Ticket<#id=22..>
74
+
75
+ Like with projects, we can also find tickets by other attributes, like title, priority and so on, with tickets we do not use a find method though. Also as with projects, if no argument is passed, all tickets are retrieved:
76
+
77
+ tickets = project.tickets
78
+ #=> [taskmapper::Ticket<#..>,TaskMapper::Ticket<#..>,..]
79
+
80
+ ### Changing ticket attributes
81
+
82
+ Let's say that we're working on this ticket right now, so let's go ahead and change the status to reflect that:
83
+
84
+ ticket.status = :in_progress
85
+
86
+ Other valid ticket statuses include:
87
+
88
+ :closed, :accepted, :resolved
89
+
90
+ For the sake of example, we'll change the description as well, and then save the ticket.
91
+
92
+ ticket.description = "Changed description to something else!"
93
+ ticket.save
94
+
95
+ ### Closing a ticket
96
+
97
+ The issue was solved, let's make that official by closing the ticket with the appropriate resolution:
98
+
99
+ ticket.close(:resolution => "fixed", :description => "Fixed issue by doing x")
100
+
101
+ Note that you could close the ticket by changing all the attributes manually, like so:
102
+
103
+ ticket.status = :closed
104
+ ticket.resolution = "fixed"
105
+ ticket.resolution_description = "Fixed issue by doing x"
106
+ ticket.save
107
+
108
+ However, as closing a ticket with a resolution is such a common task, the other method is included because it may be more convenient.
109
+
110
+ ## Support
111
+
112
+ Currently taskmapper supports the following systems:
113
+
114
+ ### Pivotal Tracker
115
+
116
+ To use Pivotal Tracker with taskmapper, install it:
117
+ gem install taskmapper-pivotal
118
+
119
+ Then simply require it, and you are good to use Pivotal Tracker with taskmapper!
120
+
121
+ require 'taskmapper'
122
+ require 'taskmapper-pivotal'
123
+ unfuddle = taskmapper.new(:pivotal, {:username => "..", :password => ".."})
124
+
125
+ The source code is located at [taskmapper-pivotal](http://github.com/hybridgroup/taskmapper-pivotal)
126
+
127
+ ### Lighthouse
128
+
129
+ To use Lighthouse with taskmapper, install it:
130
+ gem install taskmapper-lighthouse
131
+
132
+ Then simply require it, and you are all set to use Lighthouse with taskmapper!
133
+
134
+ require 'taskmapper'
135
+ require 'taskmapper-lighthouse'
136
+ lighthouse = taskmapper.new(:lighthouse, {:username => "..", :password => ".."})
137
+
138
+ The source code is located at [taskmapper-lighthouse](http://github.com/hybridgroup/taskmapper-lighthouse)
139
+
140
+ ### Basecamp
141
+
142
+ To use Basecamp with taskmapper, install it:
143
+ gem install taskmapper-basecamp
144
+
145
+ Once you require it, then you are ready to use Basecamp with taskmapper
146
+
147
+ require 'taskmapper'
148
+ require 'taskmapper-basecamp'
149
+ basecamp = taskmapper.new(:basecamp, :domain => 'yourdomain.basecamphq.com', :username => 'you', :password => 'pass')
150
+
151
+ The source code is located at [taskmapper-basecamp](http://github.com/hybridgroup/taskmapper-basecamp)
152
+
153
+ ### Github
154
+
155
+ To use Github's issue tracking with taskmapper, install it:
156
+ gem install taskmapper-github
157
+
158
+ Once you require it, then you are ready to use Github and taskmapper
159
+
160
+ require 'taskmapper'
161
+ require 'taskmapper-github'
162
+ github = taskmapper.new(:github, :username => 'you', :password => 'pass')
163
+
164
+ The source code is located at [taskmapper-github](http://github.com/hybridgroup/taskmapper-github)
165
+
166
+ ### Unfuddle
167
+
168
+ To use Unfuddle with taskmapper, install it:
169
+ gem install taskmapper-unfuddle
170
+
171
+ Then simply require it, and you are good to use Unfuddle with taskmapper!
172
+
173
+ require 'taskmapper'
174
+ require 'taskmapper-unfuddle'
175
+ unfuddle = taskmapper.new(:unfuddle, {:username => "..", :password => "..", :account => ".."})
176
+
177
+ The source code is located at [taskmapper-unfuddle](http://github.com/hybridgroup/taskmapper-unfuddle)
178
+
179
+ ### Kanban Pad
180
+
181
+ To use Kanban Pad with taskmapper, install it:
182
+ gem install taskmapper-kanbanpad
183
+
184
+ Once you require it, you can connect to Kanban Pad using taskmapper!
185
+
186
+ require 'taskmapper'
187
+ require 'taskmapper-kanbanpad'
188
+ kanbanpad = taskmapper.new(:kanbanpad, {:username => "xx", :password => "xx"})
189
+
190
+ The source code is located at [taskmapper-kanbanpad](https://github.com/hybridgroup/taskmapper-kanbanpad)
191
+
192
+ ### Redmine
193
+
194
+ To use Redmine with taskmapper, install it:
195
+ gem install taskmapper-redmine
196
+
197
+ Just require it, and you are ready to use Redmine with taskmapper!
198
+
199
+ require 'taskmapper'
200
+ require 'taskmapper-redmine'
201
+ redmine = taskmapper.new(:redmine, {:username => "..", :password => "..", :server => ".."})
202
+
203
+ The source code is located at [taskmapper-redmine](http://github.com/hybridgroup/taskmapper-redmine)
204
+
205
+ ### Trac
206
+
207
+ To use Trac with taskmapper, install it:
208
+ gem install taskmapper-trac
209
+
210
+ Require it, and you are happening to call Trac with taskmapper!
211
+
212
+ require 'taskmapper'
213
+ require 'taskmapper-trac'
214
+ trac = taskmapper.new(:trac, {:username => "..", :password => "..", :url => ".."})
215
+
216
+ The source code is located at [taskmapper-trac](http://github.com/hybridgroup/taskmapper-trac)
217
+
218
+ ### Codaset
219
+
220
+ To use Codaset with taskmapper, install it:
221
+ gem install taskmapper-codaset
222
+
223
+ Require and you have connected to Codaset with taskmapper!
224
+
225
+ require 'taskmapper'
226
+ require 'taskmapper-codaset'
227
+ codaset = taskmapper.new(:codaset, {:username => "foo", :password => "bar", :client_id => "your_client_id", :client_secret => "your_client_secret"})
228
+
229
+ The source code is located at [taskmapper-codaset](http://github.com/hybridgroup/taskmapper-codaset)
230
+
231
+ ### Bugzilla
232
+
233
+ To use Bugzilla with taskmapper, install it:
234
+ gem install taskmapper-bugzilla
235
+
236
+ Require and you can talk to Bugzilla with taskmapper!
237
+
238
+ require 'taskmapper'
239
+ require 'taskmapper-bugzilla'
240
+ codaset = taskmapper.new(:bugzilla, {:username => "foo", :password => "bar", :url => "https://bugzilla.mozilla.org"})
241
+
242
+ The source code is located at [taskmapper-bugzilla](http://github.com/hybridgroup/taskmapper-bugzilla)
243
+
244
+ ## Creating a provider
245
+ Creating a provider consists of three steps:
246
+
247
+ * Run the generator like this:
248
+ tm generate myprovider
249
+ * Implement whatever is needed to connect to your desired backend
250
+ * Release it to RubyGems
251
+
252
+ ### Create the taskmapper provider
253
+ Thanks to a simple generator, it is easy to get started with a new provider. Run this from the command line:
254
+ tm generate myprovider
255
+
256
+ This will generate a new skeleton provider called taskmapper-myprovider in the current directory. Create a repo from that directory, and you can start implementing your provider.
257
+
258
+ Almost all APIs are different. And so are their Ruby providers. taskmapper attempts to create an universal API for ticket and project management systems, and thus, we need to map the functionality to the taskmapper API. This is the providers job. The provider is the glue between taskmapper, and the ticket management system's API.
259
+ Usually, your provider would rely on another library for the raw HTTP interaction. For instance, [taskmapper-lighthouse](http://github.com/hybridgroup/taskmapper-lighthouse) relies on ActiveResource in order to interact with the Lighthouse API. Look at it like this:
260
+
261
+ **taskmapper** -> **Provider** -> *(Ruby library)* -> **Site's API**
262
+
263
+ Provider being the *glue* between the site's API and taskmapper. The Ruby library is "optional" (though highly recommended as mentioned), therefore it is in parantheses.
264
+
265
+ An example of a provider could be [taskmapper-lighthouse](http://github.com/hybridgroup/taskmapper-lighthouse), an example of a Ruby library could be ActiveResource.
266
+
267
+ For now, look at [taskmapper-lighthouse](http://github.com/hybridgroup/taskmapper-lighthouse) as an example on how to create a provider. More detailed documentation will be available soon.
268
+
269
+ ### Release it
270
+ Simply release it to RubyGems.org, the name of the provider Gem should follow this simple naming rule:
271
+
272
+ taskmapper-<provider's name>
273
+
274
+ For instance if you set for a Github provider, it would be named:
275
+
276
+ taskmapper-github
277
+
278
+ This makes it easy for people to find providers, simply by issuing:
279
+
280
+ gem search -r taskmapper
281
+
282
+ They should be presented with a nice list of all available providers.
283
+
284
+ ## Note on Patches/Pull Requests
285
+
286
+ * Fork the project.
287
+ * Make your feature addition or bug fix.
288
+ * Add tests for it. This is important so we don't break it in a
289
+ future version unintentionally.
290
+ * Commit, do not mess with rakefile, version, or history.
291
+ (if you want to have your own version, that is fine but bump version in a commit by itself so we can ignore when we pull)
292
+ * Send us a pull request. Bonus points for feature branches.
293
+
294
+ ## Copyright
295
+
296
+ Copyright (c) 2010 [The Hybrid Group](http://hybridgroup.com). See LICENSE for details.
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "taskmapper"
8
+ gem.summary = %Q{TaskMapper provides a universal API to ticket tracking and project management systems.}
9
+ gem.description = %Q{TaskMapper provides a universal API to ticket tracking and project management systems.}
10
+ gem.email = "info@hybridgroup.com"
11
+ gem.homepage = "http://ticketrb.com"
12
+ gem.authors = ["kiafaldorius", "Sirupsen", "deadprogrammer"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
+ end
18
+
19
+ require 'rspec/core'
20
+ require 'rspec/core/rake_task'
21
+ RSpec::Core::RakeTask.new(:spec) do |spec|
22
+ spec.pattern = FileList['spec/**/*_spec.rb']
23
+ end
24
+
25
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
26
+ spec.pattern = 'spec/**/*_spec.rb'
27
+ spec.rcov = true
28
+ end
29
+
30
+ task :default => :spec
31
+
32
+ require 'rake/rdoctask'
33
+ Rake::RDocTask.new do |rdoc|
34
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
35
+
36
+ rdoc.rdoc_dir = 'rdoc'
37
+ rdoc.title = "taskmapper#{version}"
38
+ rdoc.rdoc_files.include('README*')
39
+ rdoc.rdoc_files.include('lib/**/*.rb')
40
+ end