taskmapper-redmine 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rbenv-gemsets +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +50 -0
- data/LICENSE +22 -0
- data/README.md +64 -0
- data/Rakefile +41 -0
- data/VERSION +1 -0
- data/lib/provider/api-extensions.rb +22 -0
- data/lib/provider/comment.rb +13 -0
- data/lib/provider/project.rb +48 -0
- data/lib/provider/redmine.rb +32 -0
- data/lib/provider/ticket.rb +108 -0
- data/lib/redmine/redmine-api.rb +39 -0
- data/lib/taskmapper-redmine.rb +6 -0
- data/spec/comments_spec.rb +5 -0
- data/spec/fixtures/issues.xml +1 -0
- data/spec/fixtures/issues/1.xml +1 -0
- data/spec/fixtures/projects.xml +23 -0
- data/spec/fixtures/projects/test-repo12.xml +12 -0
- data/spec/projects_spec.rb +58 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/taskmapper-redmine_spec.rb +18 -0
- data/spec/tickets_spec.rb +64 -0
- data/ticketmaster-redmine.gemspec +77 -0
- metadata +135 -0
data/.rbenv-gemsets
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ticketmaster-redmine
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.2@taskmapper-redmine --create
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "taskmapper", "~> 0.8"
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "rspec", "~> 2.8"
|
11
|
+
gem "jeweler", "~> 1.6"
|
12
|
+
gem "simplecov", "~> 0.5", :platforms => :ruby_19
|
13
|
+
gem "rcov", "~> 1.0", :platforms => :ruby_18
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.2.3)
|
5
|
+
activesupport (= 3.2.3)
|
6
|
+
builder (~> 3.0.0)
|
7
|
+
activeresource (3.2.3)
|
8
|
+
activemodel (= 3.2.3)
|
9
|
+
activesupport (= 3.2.3)
|
10
|
+
activesupport (3.2.3)
|
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.6.4)
|
19
|
+
bundler (~> 1.0)
|
20
|
+
git (>= 1.2.5)
|
21
|
+
rake
|
22
|
+
multi_json (1.0.4)
|
23
|
+
rake (0.9.2.2)
|
24
|
+
rcov (1.0.0)
|
25
|
+
rspec (2.8.0)
|
26
|
+
rspec-core (~> 2.8.0)
|
27
|
+
rspec-expectations (~> 2.8.0)
|
28
|
+
rspec-mocks (~> 2.8.0)
|
29
|
+
rspec-core (2.8.0)
|
30
|
+
rspec-expectations (2.8.0)
|
31
|
+
diff-lcs (~> 1.1.2)
|
32
|
+
rspec-mocks (2.8.0)
|
33
|
+
simplecov (0.5.4)
|
34
|
+
multi_json (~> 1.0.3)
|
35
|
+
simplecov-html (~> 0.5.3)
|
36
|
+
simplecov-html (0.5.3)
|
37
|
+
taskmapper (0.8.0)
|
38
|
+
activeresource (~> 3.0)
|
39
|
+
activesupport (~> 3.0)
|
40
|
+
hashie (~> 1.2)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
jeweler (~> 1.6)
|
47
|
+
rcov (~> 1.0)
|
48
|
+
rspec (~> 2.8)
|
49
|
+
simplecov (~> 0.5)
|
50
|
+
taskmapper (~> 0.8)
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2010 YOU
|
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
|
+
NONE
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# taskmapper-redmine
|
2
|
+
|
3
|
+
This is a provider for [taskmapper](http://ticketrb.com). It provides interoperability with [Redmine](http://www.redmine.org) and it's issue tracking system through the taskmapper gem.
|
4
|
+
|
5
|
+
# Usage and Examples
|
6
|
+
|
7
|
+
First we have to instantiate a new taskmapper instance, your redmine installation should have api access enable:
|
8
|
+
redmine = taskmapper.new(:redmine, {:server => 'http://redmine-server', :username => "foo", :password => "bar"})
|
9
|
+
|
10
|
+
If you do not pass in the server, username and password, you won't get any information.
|
11
|
+
|
12
|
+
== Finding Projects(Repositories)
|
13
|
+
|
14
|
+
You can find your own projects by doing:
|
15
|
+
|
16
|
+
projects = redmine.projects # Will return all your repositories
|
17
|
+
projects = redmine.projects(['your_repo1', 'your_repo2']) # You must use your projects identifier
|
18
|
+
project = redmine.project('your_repo') # Also use project identifier in here
|
19
|
+
|
20
|
+
== Finding Tickets(Issues)
|
21
|
+
|
22
|
+
tickets = project.tickets # All open issues
|
23
|
+
ticket = project.ticket(<issue_number>)
|
24
|
+
|
25
|
+
== Open Tickets
|
26
|
+
|
27
|
+
ticket = project.ticket!({:subject=> "New ticket", :description=> "Body for the very new ticket"})
|
28
|
+
|
29
|
+
= Update a ticket
|
30
|
+
|
31
|
+
ticket.subject = "New title"
|
32
|
+
ticket.description = "New Description"
|
33
|
+
ticket.save
|
34
|
+
|
35
|
+
## Requirements
|
36
|
+
|
37
|
+
* rubygems (obviously)
|
38
|
+
* taskmapper gem (latest version preferred)
|
39
|
+
* jeweler gem (only if you want to repackage and develop)
|
40
|
+
|
41
|
+
The taskmapper gem should automatically be installed during the installation of this gem if it is not already installed.
|
42
|
+
|
43
|
+
## Other Notes
|
44
|
+
|
45
|
+
Since this and the taskmapper gem is still primarily a work-in-progress, minor changes may be incompatible with previous versions. Please be careful about using and updating this gem in production.
|
46
|
+
|
47
|
+
If you see or find any issues, feel free to open up an issue report.
|
48
|
+
|
49
|
+
|
50
|
+
## Note on Patches/Pull Requests
|
51
|
+
|
52
|
+
* Fork the project.
|
53
|
+
* Make your feature addition or bug fix.
|
54
|
+
* Add tests for it. This is important so we don't break it in a
|
55
|
+
future version unintentionally.
|
56
|
+
* Commit, do not mess with rakefile, version, or history.
|
57
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself so we can ignore when I pull)
|
58
|
+
* Send us a pull request. Bonus points for topic branches.
|
59
|
+
|
60
|
+
## Copyright
|
61
|
+
|
62
|
+
Copyright (c) 2010 The Hybrid Group. See LICENSE for details.
|
63
|
+
|
64
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "taskmapper-redmine"
|
8
|
+
gem.summary = %Q{taskmapper Provider for Redmine}
|
9
|
+
gem.description = %Q{Allows taskmapper to interact with Your System.}
|
10
|
+
gem.email = "rafael@hybridgroup.com"
|
11
|
+
gem.homepage = "http://github.com/hybridgroup/taskmapper-redmine"
|
12
|
+
gem.authors = ["Rafael George"]
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rspec/core'
|
21
|
+
require 'rspec/core/rake_task'
|
22
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
23
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
24
|
+
end
|
25
|
+
|
26
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
27
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
28
|
+
spec.rcov = true
|
29
|
+
end
|
30
|
+
|
31
|
+
task :default => :spec
|
32
|
+
|
33
|
+
require 'rake/rdoctask'
|
34
|
+
Rake::RDocTask.new do |rdoc|
|
35
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
36
|
+
|
37
|
+
rdoc.rdoc_dir = 'rdoc'
|
38
|
+
rdoc.title = "taskmapper-redmine#{version}"
|
39
|
+
rdoc.rdoc_files.include('README*')
|
40
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
41
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#Reopening class to add ticket master espesific behavior without mixing it with RadmineAPI
|
2
|
+
class RedmineAPI::Issue
|
3
|
+
def to_ticket_hash
|
4
|
+
return :id => id.to_i,
|
5
|
+
:title => subject,
|
6
|
+
:created_at => created_on,
|
7
|
+
:updated_at => updated_on,
|
8
|
+
:project_id => project.id.to_i,
|
9
|
+
:status => status.name,
|
10
|
+
:priority => priority.name,
|
11
|
+
:priority_id => priority.id.to_i,
|
12
|
+
:requestor => author.name,
|
13
|
+
:assignee => author.name
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_with(ticket)
|
17
|
+
self.subject = ticket.title
|
18
|
+
self.project_id = ticket.project_id
|
19
|
+
self.description = ticket.description
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module TaskMapper::Provider
|
2
|
+
module Redmine
|
3
|
+
# The comment class for taskmapper-yoursystem
|
4
|
+
#
|
5
|
+
# Do any mapping between taskmapper and your system's comment model here
|
6
|
+
# versions of the ticket.
|
7
|
+
#
|
8
|
+
class Comment < TaskMapper::Provider::Base::Comment
|
9
|
+
# declare needed overloaded methods here
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module TaskMapper::Provider
|
2
|
+
module Redmine
|
3
|
+
# Project class for taskmapper-yoursystem
|
4
|
+
#
|
5
|
+
#
|
6
|
+
class Project < TaskMapper::Provider::Base::Project
|
7
|
+
# declare needed overloaded methods here
|
8
|
+
API = RedmineAPI::Project
|
9
|
+
|
10
|
+
def initialize(*object)
|
11
|
+
if object.first
|
12
|
+
object = object.first
|
13
|
+
unless object.is_a? Hash
|
14
|
+
hash = {:id => object.id,
|
15
|
+
:name => object.name,
|
16
|
+
:description => object.description,
|
17
|
+
:identifier => object.identifier,
|
18
|
+
:created_at => object.created_on,
|
19
|
+
:updated_at => object.updated_on}
|
20
|
+
|
21
|
+
else
|
22
|
+
hash = object
|
23
|
+
end
|
24
|
+
super hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# copy from this.copy(that) copies that into this
|
29
|
+
def copy(project)
|
30
|
+
project.tickets.each do |ticket|
|
31
|
+
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
32
|
+
ticket.comments.each do |comment|
|
33
|
+
copy_ticket.comment!(:body => comment.body)
|
34
|
+
sleep 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def id
|
40
|
+
self[:id]
|
41
|
+
end
|
42
|
+
|
43
|
+
def identifier
|
44
|
+
self[:identifier]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module TaskMapper::Provider
|
2
|
+
# This is the Yoursystem Provider for taskmapper
|
3
|
+
module Redmine
|
4
|
+
include TaskMapper::Provider::Base
|
5
|
+
PROJECT_API = RedmineAPI::Project
|
6
|
+
TICKET_API = RedmineAPI::Issue
|
7
|
+
|
8
|
+
# This is for cases when you want to instantiate using TaskMapper::Provider::Yoursystem.new(auth)
|
9
|
+
def self.new(auth = {})
|
10
|
+
TaskMapper.new(:redmine, auth)
|
11
|
+
end
|
12
|
+
|
13
|
+
# declare needed overloaded methods here
|
14
|
+
def authorize(auth = {})
|
15
|
+
@authentication ||= TaskMapper::Authenticator.new(auth)
|
16
|
+
auth = @authentication
|
17
|
+
if auth.server.blank? and auth.token.blank?
|
18
|
+
raise "Please you should provide server and token"
|
19
|
+
end
|
20
|
+
|
21
|
+
RedmineAPI.authenticate(auth.server, auth.token)
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid?
|
25
|
+
begin
|
26
|
+
RedmineAPI::Project.find(:all).size >= 0
|
27
|
+
rescue
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module TaskMapper::Provider
|
2
|
+
module Redmine
|
3
|
+
# Ticket class for taskmapper-yoursystem
|
4
|
+
#
|
5
|
+
API = RedmineAPI::Issue
|
6
|
+
|
7
|
+
class Ticket < TaskMapper::Provider::Base::Ticket
|
8
|
+
# declare needed overloaded methods here
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
case args.first
|
12
|
+
when Hash then super args.first
|
13
|
+
when RedmineAPI::Issue then super args.first.to_ticket_hash
|
14
|
+
else raise ArgumentError.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def created_at
|
19
|
+
self[:created_on]
|
20
|
+
end
|
21
|
+
|
22
|
+
def updated_at
|
23
|
+
self[:updated_on]
|
24
|
+
end
|
25
|
+
|
26
|
+
def project_id
|
27
|
+
self[:project_id]
|
28
|
+
end
|
29
|
+
|
30
|
+
def status
|
31
|
+
self[:status].name
|
32
|
+
end
|
33
|
+
|
34
|
+
def priority
|
35
|
+
self[:priority].name
|
36
|
+
end
|
37
|
+
|
38
|
+
def requestor
|
39
|
+
self[:author].name
|
40
|
+
end
|
41
|
+
|
42
|
+
def assignee
|
43
|
+
self[:author].name
|
44
|
+
end
|
45
|
+
|
46
|
+
def id
|
47
|
+
self[:id].to_i
|
48
|
+
end
|
49
|
+
|
50
|
+
def description
|
51
|
+
self[:description]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.find_by_id(project_id, ticket_id)
|
55
|
+
self.new API.find(:first, :id => ticket_id)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.find_by_attributes(project_id, attributes = {})
|
59
|
+
issues = API.find(:all, attributes_for_request(project_id, attributes))
|
60
|
+
issues.collect { |issue| self.new issue }
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.attributes_for_request(project_id, options)
|
64
|
+
hash = {:params => {:project_id => project_id}}.merge!(options)
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.create(attributes)
|
68
|
+
ticket = self.new(attributes)
|
69
|
+
ticket if ticket.save
|
70
|
+
end
|
71
|
+
|
72
|
+
def save
|
73
|
+
to_issue.new? ? to_issue.save : update
|
74
|
+
end
|
75
|
+
|
76
|
+
def comments
|
77
|
+
warn "Redmine doesn't support comments"
|
78
|
+
[]
|
79
|
+
end
|
80
|
+
|
81
|
+
def comment
|
82
|
+
warn "Redmine doesn't support comments"
|
83
|
+
nil
|
84
|
+
end
|
85
|
+
|
86
|
+
def comment!
|
87
|
+
warn "Redmine doesn't support comments"
|
88
|
+
[]
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
def find_issue
|
93
|
+
issue = API.find id, :params => {:project_id => self.project_id}
|
94
|
+
raise TaskMapper::Exception.new "Ticket with #{id} was not found" unless issue
|
95
|
+
issue
|
96
|
+
end
|
97
|
+
|
98
|
+
def update
|
99
|
+
find_issue.update_with(self).save
|
100
|
+
end
|
101
|
+
|
102
|
+
def to_issue
|
103
|
+
API.new.update_with(self)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_resource'
|
4
|
+
|
5
|
+
|
6
|
+
module RedmineAPI
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_reader :token
|
11
|
+
def authenticate(server, token)
|
12
|
+
@token = token
|
13
|
+
@server = server
|
14
|
+
self::Base.site = server
|
15
|
+
end
|
16
|
+
|
17
|
+
def resources
|
18
|
+
@resources ||= []
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Base < ActiveResource::Base
|
23
|
+
self.format = :xml
|
24
|
+
def self.inherited(base)
|
25
|
+
RedmineAPI.resources << base
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.headers
|
29
|
+
{"X-Redmine-API-Key" => RedmineAPI.token}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Issue < Base
|
34
|
+
end
|
35
|
+
|
36
|
+
class Project < Base
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><issues type="array" total_count="1" limit="25" offset="0"><issue><id>1</id><project name="test-repo" id="1"/><tracker name="Bug" id="1"/><status name="New" id="1"/><priority name="Normal" id="4"/><author name="Redmine Admin" id="1"/><subject>test-issue</subject><description></description><start_date>2010-12-22</start_date><due_date></due_date><done_ratio>0</done_ratio><estimated_hours></estimated_hours><created_on>2010-12-22T17:55:58-06:00</created_on><updated_on>2010-12-22T17:55:58-06:00</updated_on></issue></issues>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><issue><id>1</id><project name="test-repo" id="1"/><tracker name="Bug" id="1"/><status name="New" id="1"/><priority name="Normal" id="4"/><author name="Redmine Admin" id="1"/><subject>test-issue</subject><description></description><start_date>2010-12-22</start_date><due_date></due_date><done_ratio>0</done_ratio><estimated_hours></estimated_hours><spent_hours>0.0</spent_hours><created_on>2010-12-22T17:55:58-06:00</created_on><updated_on>2010-12-22T17:55:58-06:00</updated_on></issue>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<projects type="array">
|
2
|
+
<project>
|
3
|
+
<id>1</id>
|
4
|
+
<name>Redmine</name>
|
5
|
+
<identifier>redmine</identifier>
|
6
|
+
<description>
|
7
|
+
Redmine is a flexible project management web application written using Ruby on Rails framework.
|
8
|
+
</description>
|
9
|
+
<created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
|
10
|
+
<updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
|
11
|
+
</project>
|
12
|
+
<project>
|
13
|
+
<id>2</id>
|
14
|
+
<name>Redmine</name>
|
15
|
+
<identifier>redmine</identifier>
|
16
|
+
<description>
|
17
|
+
Redmine is a flexible project management web application written using Ruby on Rails framework.
|
18
|
+
</description>
|
19
|
+
<homepage></homepage>
|
20
|
+
<created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
|
21
|
+
<updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
|
22
|
+
</project>
|
23
|
+
</projects>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project id="1">
|
3
|
+
<name>Redmine</name>
|
4
|
+
<identifier>test-repo12</identifier>
|
5
|
+
<description>
|
6
|
+
Redmine is a flexible project management web application written using Ruby on Rails framework.
|
7
|
+
</description>
|
8
|
+
<homepage></homepage>
|
9
|
+
<created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
|
10
|
+
<updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
|
11
|
+
</project>
|
12
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe TaskMapper::Provider::Redmine::Project do
|
4
|
+
before(:each) do
|
5
|
+
headers = {'X-Redmine-API-Key' => 'abcdefghijk', 'Accept' => 'application/xml'}
|
6
|
+
headers_post_put = {'Authorization' => 'Basic Y29yZWQ6MTIzNDU2', 'Content-Type' => 'application/xml'}
|
7
|
+
@project_id = '1'
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/projects/1.xml', headers, fixture_for('projects/test-repo12'), 200
|
11
|
+
mock.put '/projects/1.xml', headers_post_put, '', 200
|
12
|
+
mock.post '/projects.xml', headers_post_put, '', 200
|
13
|
+
end
|
14
|
+
|
15
|
+
@taskmapper = TaskMapper.new :redmine, :server => 'http://demo.redmine.org/', :token => 'abcdefghijk'
|
16
|
+
@klass = TaskMapper::Provider::Redmine::Project
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to load all projects" do
|
20
|
+
@taskmapper.projects.should be_an_instance_of(Array)
|
21
|
+
@taskmapper.projects.first.should be_an_instance_of(@klass)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to load projects from an array of id's" do
|
25
|
+
@projects = @taskmapper.projects([@project_id])
|
26
|
+
@projects.should be_an_instance_of(Array)
|
27
|
+
@projects.first.should be_an_instance_of(@klass)
|
28
|
+
@projects.first.id.should == @project_id
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to load all projects from attributes" do
|
32
|
+
@projects = @taskmapper.projects(:identifier => 'redmine')
|
33
|
+
@projects.should be_an_instance_of(Array)
|
34
|
+
@projects.first.should be_an_instance_of(@klass)
|
35
|
+
@projects.first.identifier.should == 'redmine'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should be able to find a project" do
|
39
|
+
@taskmapper.project.should == @klass
|
40
|
+
@taskmapper.project.find(@project_id).should be_an_instance_of(@klass)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to find a project by identifier" do
|
44
|
+
@taskmapper.project(@project_id).should be_an_instance_of(@klass)
|
45
|
+
@taskmapper.project(@project_id).id.should == @project_id
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to update and save a project" do
|
49
|
+
pending
|
50
|
+
@project = @taskmapper.project(@project_id)
|
51
|
+
@project.update!(:name => 'named').should == true
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should be able to create a new project" do
|
55
|
+
pending
|
56
|
+
@project = @taskmapper.project!(:name => 'newtest', :identifier => 'dumb', :description => 'hithere').should be_an_instance_of(@klass)
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'taskmapper'
|
5
|
+
require 'taskmapper-redmine'
|
6
|
+
require 'rspec'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.color_enabled = true
|
10
|
+
end
|
11
|
+
|
12
|
+
def fixture_for(name)
|
13
|
+
File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.xml')
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe TaskMapper::Provider::Redmine do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
headers = {'Authorization' => 'Basic Y29yZWQ6YWZkZA==', 'Accept' => 'application/xml'}
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/projects.xml', headers, fixture_for('projects'), 200
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be able to instantiate a new instance" do
|
13
|
+
taskmapper = TaskMapper.new(:redmine, :server => 'http://redmine.server', :token => 'kdkjkladkaldj')
|
14
|
+
taskmapper.should be_an_instance_of(TaskMapper)
|
15
|
+
taskmapper.should be_a_kind_of(TaskMapper::Provider::Redmine)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe TaskMapper::Provider::Redmine::Ticket do
|
4
|
+
before(:each) do
|
5
|
+
headers = {'X-Redmine-API-Key' => 'abcdefghijk', 'Accept' => 'application/xml'}
|
6
|
+
headers_post_put = {'X-Redmine-API-Key' => 'abcdefghijk', 'Content-Type' => 'application/xml'}
|
7
|
+
@project_id = 1
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/projects/1.xml', headers, fixture_for('projects/test-repo12'), 200
|
11
|
+
mock.get '/issues.xml?project_id=1', headers, fixture_for('issues'), 200
|
12
|
+
mock.get '/issues.xml', headers, fixture_for('issues'), 200
|
13
|
+
mock.get '/issues/1.xml', headers, fixture_for('issues/1'), 200
|
14
|
+
mock.put '/issues/1.xml', headers_post_put, '', 200
|
15
|
+
mock.post '/issues.xml', headers_post_put, '', 200
|
16
|
+
end
|
17
|
+
|
18
|
+
@taskmapper = TaskMapper.new :redmine, :server => 'http://demo.redmine.org/', :token => 'abcdefghijk'
|
19
|
+
@project = @taskmapper.project(@project_id)
|
20
|
+
@klass = TaskMapper::Provider::Redmine::Ticket
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to load all tickets" do
|
24
|
+
@project.tickets.should be_an_instance_of(Array)
|
25
|
+
@project.tickets.first.should be_an_instance_of(@klass)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be able to load all tickets based on an array of id's" do
|
29
|
+
@tickets = @project.tickets([1])
|
30
|
+
@tickets.should be_an_instance_of(Array)
|
31
|
+
@tickets.first.should be_an_instance_of(@klass)
|
32
|
+
@tickets.first.title.should == 'test-issue'
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should be able to load all tickets based on attributes" do
|
36
|
+
@tickets = @project.tickets(:id => 1)
|
37
|
+
@tickets.should be_an_instance_of(Array)
|
38
|
+
@tickets.first.should be_an_instance_of(@klass)
|
39
|
+
@tickets.first.title.should == 'test-issue'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return the ticket class" do
|
43
|
+
@project.ticket.should == @klass
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to load a single ticket" do
|
47
|
+
@ticket = @project.ticket(1)
|
48
|
+
@ticket.should be_an_instance_of(@klass)
|
49
|
+
@ticket.title.should == 'test-issue'
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be able to update and save a ticket" do
|
53
|
+
@ticket = @project.ticket(1)
|
54
|
+
@ticket.description = 'hello'
|
55
|
+
@ticket.save.should == true
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to create a ticket" do
|
59
|
+
@ticket = @project.ticket!(:title => 'Ticket #12', :description => 'Body')
|
60
|
+
@ticket.should be_an_instance_of(@klass)
|
61
|
+
@ticket.project_id.should_not be_nil
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "taskmapper-redmine"
|
8
|
+
s.version = "0.3.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Rafael George"]
|
12
|
+
s.date = "2012-04-19"
|
13
|
+
s.description = "Allows taskmapper to interact with Your System."
|
14
|
+
s.email = "rafael@hybridgroup.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".rbenv-gemsets",
|
21
|
+
".rvmrc",
|
22
|
+
".travis.yml",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/provider/api-extensions.rb",
|
30
|
+
"lib/provider/comment.rb",
|
31
|
+
"lib/provider/project.rb",
|
32
|
+
"lib/provider/redmine.rb",
|
33
|
+
"lib/provider/ticket.rb",
|
34
|
+
"lib/redmine/redmine-api.rb",
|
35
|
+
"lib/taskmapper-redmine.rb",
|
36
|
+
"spec/comments_spec.rb",
|
37
|
+
"spec/fixtures/issues.xml",
|
38
|
+
"spec/fixtures/issues/1.xml",
|
39
|
+
"spec/fixtures/projects.xml",
|
40
|
+
"spec/fixtures/projects/test-repo12.xml",
|
41
|
+
"spec/projects_spec.rb",
|
42
|
+
"spec/spec.opts",
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"spec/taskmapper-redmine_spec.rb",
|
45
|
+
"spec/tickets_spec.rb",
|
46
|
+
"taskmapper-redmine.gemspec"
|
47
|
+
]
|
48
|
+
s.homepage = "http://github.com/hybridgroup/taskmapper-redmine"
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = "1.8.17"
|
51
|
+
s.summary = "taskmapper Provider for Redmine"
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
+
s.add_runtime_dependency(%q<taskmapper>, ["~> 0.7.0"])
|
58
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8"])
|
59
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
|
60
|
+
s.add_development_dependency(%q<simplecov>, ["~> 0.5"])
|
61
|
+
s.add_development_dependency(%q<rcov>, ["~> 1.0"])
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<taskmapper>, ["~> 0.7.0"])
|
64
|
+
s.add_dependency(%q<rspec>, ["~> 2.8"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6"])
|
66
|
+
s.add_dependency(%q<simplecov>, ["~> 0.5"])
|
67
|
+
s.add_dependency(%q<rcov>, ["~> 1.0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<taskmapper>, ["~> 0.7.0"])
|
71
|
+
s.add_dependency(%q<rspec>, ["~> 2.8"])
|
72
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6"])
|
73
|
+
s.add_dependency(%q<simplecov>, ["~> 0.5"])
|
74
|
+
s.add_dependency(%q<rcov>, ["~> 1.0"])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: taskmapper-redmine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.4.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rafael George
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-05-14 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: taskmapper
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0.8"
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "2.8"
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: jeweler
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "1.6"
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: simplecov
|
50
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0.5"
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rcov
|
61
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "1.0"
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *id005
|
70
|
+
description: Allows taskmapper to interact with Your System.
|
71
|
+
email: rafael@hybridgroup.com
|
72
|
+
executables: []
|
73
|
+
|
74
|
+
extensions: []
|
75
|
+
|
76
|
+
extra_rdoc_files:
|
77
|
+
- LICENSE
|
78
|
+
- README.md
|
79
|
+
files:
|
80
|
+
- .rbenv-gemsets
|
81
|
+
- .rvmrc
|
82
|
+
- .travis.yml
|
83
|
+
- Gemfile
|
84
|
+
- Gemfile.lock
|
85
|
+
- LICENSE
|
86
|
+
- README.md
|
87
|
+
- Rakefile
|
88
|
+
- VERSION
|
89
|
+
- lib/provider/api-extensions.rb
|
90
|
+
- lib/provider/comment.rb
|
91
|
+
- lib/provider/project.rb
|
92
|
+
- lib/provider/redmine.rb
|
93
|
+
- lib/provider/ticket.rb
|
94
|
+
- lib/redmine/redmine-api.rb
|
95
|
+
- lib/taskmapper-redmine.rb
|
96
|
+
- spec/comments_spec.rb
|
97
|
+
- spec/fixtures/issues.xml
|
98
|
+
- spec/fixtures/issues/1.xml
|
99
|
+
- spec/fixtures/projects.xml
|
100
|
+
- spec/fixtures/projects/test-repo12.xml
|
101
|
+
- spec/projects_spec.rb
|
102
|
+
- spec/spec.opts
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/taskmapper-redmine_spec.rb
|
105
|
+
- spec/tickets_spec.rb
|
106
|
+
- ticketmaster-redmine.gemspec
|
107
|
+
homepage: http://github.com/hybridgroup/taskmapper-redmine
|
108
|
+
licenses: []
|
109
|
+
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: "0"
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: "0"
|
127
|
+
requirements: []
|
128
|
+
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 1.8.17
|
131
|
+
signing_key:
|
132
|
+
specification_version: 3
|
133
|
+
summary: taskmapper Provider for Redmine
|
134
|
+
test_files: []
|
135
|
+
|