taskmapper 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +152 -26
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/taskmapper.gemspec +5 -23
- metadata +20 -25
- data/bin/tm +0 -7
- data/lib/taskmapper/cli/commands/config.rb +0 -100
- data/lib/taskmapper/cli/commands/console.rb +0 -35
- data/lib/taskmapper/cli/commands/generate.rb +0 -112
- data/lib/taskmapper/cli/commands/generate/provider.rb +0 -5
- data/lib/taskmapper/cli/commands/generate/provider/comment.rb +0 -14
- data/lib/taskmapper/cli/commands/generate/provider/project.rb +0 -26
- data/lib/taskmapper/cli/commands/generate/provider/provider.rb +0 -25
- data/lib/taskmapper/cli/commands/generate/provider/ticket.rb +0 -12
- data/lib/taskmapper/cli/commands/help.rb +0 -9
- data/lib/taskmapper/cli/commands/help/config +0 -27
- data/lib/taskmapper/cli/commands/help/console +0 -13
- data/lib/taskmapper/cli/commands/help/generate +0 -19
- data/lib/taskmapper/cli/commands/help/help +0 -7
- data/lib/taskmapper/cli/commands/help/project +0 -13
- data/lib/taskmapper/cli/commands/help/ticket +0 -14
- data/lib/taskmapper/cli/commands/project.rb +0 -140
- data/lib/taskmapper/cli/commands/ticket.rb +0 -145
- data/lib/taskmapper/cli/common.rb +0 -28
- data/lib/taskmapper/cli/init.rb +0 -77
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,43 +1,168 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.2.
|
5
|
-
activesupport (= 3.2.
|
4
|
+
activemodel (3.2.13)
|
5
|
+
activesupport (= 3.2.13)
|
6
6
|
builder (~> 3.0.0)
|
7
|
-
activeresource (3.2.
|
8
|
-
activemodel (= 3.2.
|
9
|
-
activesupport (= 3.2.
|
10
|
-
activesupport (3.2.
|
11
|
-
i18n (
|
7
|
+
activeresource (3.2.13)
|
8
|
+
activemodel (= 3.2.13)
|
9
|
+
activesupport (= 3.2.13)
|
10
|
+
activesupport (3.2.13)
|
11
|
+
i18n (= 0.6.1)
|
12
12
|
multi_json (~> 1.0)
|
13
|
-
|
14
|
-
|
13
|
+
addressable (2.3.3)
|
14
|
+
basecamp (0.0.9)
|
15
|
+
activeresource (>= 2.3.0)
|
16
|
+
oauth2
|
17
|
+
xml-simple
|
18
|
+
bugherd-api (0.0.3)
|
19
|
+
activeresource
|
20
|
+
activesupport
|
21
|
+
builder (3.0.4)
|
22
|
+
crack (0.3.2)
|
23
|
+
diff-lcs (1.2.2)
|
24
|
+
faraday (0.8.7)
|
25
|
+
multipart-post (~> 1.1)
|
26
|
+
faraday_middleware (0.9.0)
|
27
|
+
faraday (>= 0.7.4, < 0.9)
|
28
|
+
gash (0.1.4)
|
29
|
+
open4 (>= 0.9.6)
|
15
30
|
git (1.2.5)
|
31
|
+
gli (2.5.5)
|
32
|
+
grancher (0.1.5)
|
33
|
+
gash
|
16
34
|
hashie (2.0.3)
|
17
|
-
|
18
|
-
|
35
|
+
httpauth (0.2.0)
|
36
|
+
i18n (0.6.1)
|
37
|
+
jeweler (1.8.4)
|
19
38
|
bundler (~> 1.0)
|
20
39
|
git (>= 1.2.5)
|
21
40
|
rake
|
22
41
|
rdoc
|
23
|
-
json (1.
|
24
|
-
|
25
|
-
|
42
|
+
json (1.7.7)
|
43
|
+
jwt (0.1.8)
|
44
|
+
multi_json (>= 1.5)
|
45
|
+
lighthouse-api (2.0)
|
46
|
+
activeresource (>= 3.0.0)
|
47
|
+
activesupport (>= 3.0.0)
|
48
|
+
multi_json (1.7.2)
|
49
|
+
multi_xml (0.5.3)
|
50
|
+
multipart-post (1.2.0)
|
51
|
+
netrc (0.7.7)
|
52
|
+
nokogiri (1.5.9)
|
53
|
+
oauth2 (0.9.1)
|
54
|
+
faraday (~> 0.8)
|
55
|
+
httpauth (~> 0.1)
|
56
|
+
jwt (~> 0.1.4)
|
57
|
+
multi_json (~> 1.0)
|
58
|
+
multi_xml (~> 0.5)
|
59
|
+
rack (~> 1.2)
|
60
|
+
octokit (1.24.0)
|
61
|
+
addressable (~> 2.2)
|
62
|
+
faraday (~> 0.8)
|
63
|
+
faraday_middleware (~> 0.9)
|
64
|
+
hashie (~> 2.0)
|
65
|
+
multi_json (~> 1.3)
|
66
|
+
netrc (~> 0.7.7)
|
67
|
+
open4 (1.3.0)
|
68
|
+
rack (1.5.2)
|
69
|
+
rainbow (1.1.4)
|
70
|
+
rake (0.9.6)
|
71
|
+
rally_rest_api (1.0.5)
|
26
72
|
rcov (1.0.0)
|
27
|
-
rdoc (3.12)
|
73
|
+
rdoc (3.12.2)
|
28
74
|
json (~> 1.4)
|
29
|
-
rspec (2.
|
30
|
-
rspec-core (~> 2.
|
31
|
-
rspec-expectations (~> 2.
|
32
|
-
rspec-mocks (~> 2.
|
33
|
-
rspec-core (2.
|
34
|
-
rspec-expectations (2.
|
35
|
-
diff-lcs (
|
36
|
-
rspec-mocks (2.
|
37
|
-
|
75
|
+
rspec (2.13.0)
|
76
|
+
rspec-core (~> 2.13.0)
|
77
|
+
rspec-expectations (~> 2.13.0)
|
78
|
+
rspec-mocks (~> 2.13.0)
|
79
|
+
rspec-core (2.13.1)
|
80
|
+
rspec-expectations (2.13.0)
|
81
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
82
|
+
rspec-mocks (2.13.1)
|
83
|
+
ruby-fogbugz (0.1.1)
|
84
|
+
crack
|
85
|
+
rubyzilla (0.1.1)
|
86
|
+
sdoc (0.3.20)
|
87
|
+
json (>= 1.1.3)
|
88
|
+
rdoc (~> 3.10)
|
89
|
+
simplecov (0.7.1)
|
38
90
|
multi_json (~> 1.0)
|
39
|
-
simplecov-html (~> 0.
|
40
|
-
simplecov-html (0.
|
91
|
+
simplecov-html (~> 0.7.1)
|
92
|
+
simplecov-html (0.7.1)
|
93
|
+
taskmapper (0.8.1)
|
94
|
+
activeresource (~> 3.0)
|
95
|
+
activesupport (~> 3.0)
|
96
|
+
hashie (~> 2.0)
|
97
|
+
taskmapper-basecamp (0.7.1)
|
98
|
+
basecamp
|
99
|
+
taskmapper (~> 0.8)
|
100
|
+
taskmapper-bugherd (0.1.0)
|
101
|
+
bugherd-api (~> 0.0)
|
102
|
+
taskmapper (~> 0.8)
|
103
|
+
taskmapper-bugzilla (0.3.0)
|
104
|
+
rubyzilla (~> 0.1)
|
105
|
+
taskmapper (~> 0.8)
|
106
|
+
taskmapper-cli (0.0.1)
|
107
|
+
gli (= 2.5.5)
|
108
|
+
rainbow
|
109
|
+
taskmapper
|
110
|
+
taskmapper-basecamp
|
111
|
+
taskmapper-bugherd
|
112
|
+
taskmapper-bugzilla
|
113
|
+
taskmapper-fogbugz
|
114
|
+
taskmapper-github
|
115
|
+
taskmapper-kanbanpad
|
116
|
+
taskmapper-lighthouse
|
117
|
+
taskmapper-pivotal
|
118
|
+
taskmapper-rally
|
119
|
+
taskmapper-redmine
|
120
|
+
taskmapper-trac
|
121
|
+
taskmapper-unfuddle
|
122
|
+
taskmapper-zendesk
|
123
|
+
terminal-table
|
124
|
+
taskmapper-fogbugz (0.4.0)
|
125
|
+
rake (~> 0.9)
|
126
|
+
ruby-fogbugz (~> 0.1)
|
127
|
+
taskmapper (~> 0.7)
|
128
|
+
taskmapper-github (0.11.4)
|
129
|
+
octokit
|
130
|
+
taskmapper (~> 0.8)
|
131
|
+
taskmapper-kanbanpad (0.8.1)
|
132
|
+
taskmapper (~> 0.8)
|
133
|
+
taskmapper-lighthouse (0.9.0)
|
134
|
+
addressable (~> 2.2)
|
135
|
+
lighthouse-api (~> 2.0)
|
136
|
+
taskmapper (~> 0.8)
|
137
|
+
xml-simple (~> 1.1)
|
138
|
+
taskmapper-pivotal (0.8.2)
|
139
|
+
taskmapper (~> 0.8)
|
140
|
+
taskmapper-rally (0.3.0)
|
141
|
+
rally_rest_api (~> 1.0)
|
142
|
+
taskmapper (~> 0.8)
|
143
|
+
taskmapper-redmine (0.5.1)
|
144
|
+
taskmapper (~> 0.8)
|
145
|
+
taskmapper-trac (0.6.1)
|
146
|
+
nokogiri
|
147
|
+
nokogiri (~> 1.5)
|
148
|
+
taskmapper (~> 0.8)
|
149
|
+
trac4r
|
150
|
+
trac4r (~> 1.2)
|
151
|
+
taskmapper-unfuddle (0.7.0)
|
152
|
+
addressable (~> 2.2)
|
153
|
+
taskmapper (~> 0.8)
|
154
|
+
taskmapper-zendesk (0.6.0)
|
155
|
+
taskmapper (~> 0.8)
|
156
|
+
terminal-table (1.4.5)
|
157
|
+
trac4r (1.2.4)
|
158
|
+
gli
|
159
|
+
gli (>= 1.1.0)
|
160
|
+
grancher
|
161
|
+
jeweler
|
162
|
+
rainbow
|
163
|
+
rainbow (>= 1.0.4)
|
164
|
+
sdoc
|
165
|
+
xml-simple (1.1.2)
|
41
166
|
|
42
167
|
PLATFORMS
|
43
168
|
ruby
|
@@ -50,3 +175,4 @@ DEPENDENCIES
|
|
50
175
|
rcov (~> 1.0)
|
51
176
|
rspec (~> 2.0)
|
52
177
|
simplecov (~> 0.5)
|
178
|
+
taskmapper-cli (= 0.0.1)
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/taskmapper.gemspec
CHANGED
@@ -5,14 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "taskmapper"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.9.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kiafaldorius", "Sirupsen", "deadprogrammer"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-08"
|
13
13
|
s.description = "TaskMapper provides a universal API to ticket tracking and project management systems."
|
14
14
|
s.email = "info@hybridgroup.com"
|
15
|
-
s.executables = ["tm"]
|
16
15
|
s.extra_rdoc_files = [
|
17
16
|
"LICENSE",
|
18
17
|
"README.md",
|
@@ -29,32 +28,12 @@ Gem::Specification.new do |s|
|
|
29
28
|
"Rakefile",
|
30
29
|
"TODO",
|
31
30
|
"VERSION",
|
32
|
-
"bin/tm",
|
33
31
|
"examples/tm_example.rb",
|
34
32
|
"examples/tm_example_2.rb",
|
35
33
|
"examples/tm_example_3.rb",
|
36
34
|
"examples/tm_example_4.rb",
|
37
35
|
"lib/taskmapper.rb",
|
38
36
|
"lib/taskmapper/authenticator.rb",
|
39
|
-
"lib/taskmapper/cli/commands/config.rb",
|
40
|
-
"lib/taskmapper/cli/commands/console.rb",
|
41
|
-
"lib/taskmapper/cli/commands/generate.rb",
|
42
|
-
"lib/taskmapper/cli/commands/generate/provider.rb",
|
43
|
-
"lib/taskmapper/cli/commands/generate/provider/comment.rb",
|
44
|
-
"lib/taskmapper/cli/commands/generate/provider/project.rb",
|
45
|
-
"lib/taskmapper/cli/commands/generate/provider/provider.rb",
|
46
|
-
"lib/taskmapper/cli/commands/generate/provider/ticket.rb",
|
47
|
-
"lib/taskmapper/cli/commands/help.rb",
|
48
|
-
"lib/taskmapper/cli/commands/help/config",
|
49
|
-
"lib/taskmapper/cli/commands/help/console",
|
50
|
-
"lib/taskmapper/cli/commands/help/generate",
|
51
|
-
"lib/taskmapper/cli/commands/help/help",
|
52
|
-
"lib/taskmapper/cli/commands/help/project",
|
53
|
-
"lib/taskmapper/cli/commands/help/ticket",
|
54
|
-
"lib/taskmapper/cli/commands/project.rb",
|
55
|
-
"lib/taskmapper/cli/commands/ticket.rb",
|
56
|
-
"lib/taskmapper/cli/common.rb",
|
57
|
-
"lib/taskmapper/cli/init.rb",
|
58
37
|
"lib/taskmapper/comment.rb",
|
59
38
|
"lib/taskmapper/common.rb",
|
60
39
|
"lib/taskmapper/dummy/comment.rb",
|
@@ -92,6 +71,7 @@ Gem::Specification.new do |s|
|
|
92
71
|
s.add_runtime_dependency(%q<activeresource>, ["~> 3.0"])
|
93
72
|
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0"])
|
94
73
|
s.add_runtime_dependency(%q<hashie>, ["~> 2.0"])
|
74
|
+
s.add_runtime_dependency(%q<taskmapper-cli>, ["= 0.0.1"])
|
95
75
|
s.add_development_dependency(%q<rspec>, ["~> 2.0"])
|
96
76
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
|
97
77
|
s.add_development_dependency(%q<simplecov>, ["~> 0.5"])
|
@@ -100,6 +80,7 @@ Gem::Specification.new do |s|
|
|
100
80
|
s.add_dependency(%q<activeresource>, ["~> 3.0"])
|
101
81
|
s.add_dependency(%q<activesupport>, ["~> 3.0"])
|
102
82
|
s.add_dependency(%q<hashie>, ["~> 2.0"])
|
83
|
+
s.add_dependency(%q<taskmapper-cli>, ["= 0.0.1"])
|
103
84
|
s.add_dependency(%q<rspec>, ["~> 2.0"])
|
104
85
|
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
105
86
|
s.add_dependency(%q<simplecov>, ["~> 0.5"])
|
@@ -109,6 +90,7 @@ Gem::Specification.new do |s|
|
|
109
90
|
s.add_dependency(%q<activeresource>, ["~> 3.0"])
|
110
91
|
s.add_dependency(%q<activesupport>, ["~> 3.0"])
|
111
92
|
s.add_dependency(%q<hashie>, ["~> 2.0"])
|
93
|
+
s.add_dependency(%q<taskmapper-cli>, ["= 0.0.1"])
|
112
94
|
s.add_dependency(%q<rspec>, ["~> 2.0"])
|
113
95
|
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
114
96
|
s.add_dependency(%q<simplecov>, ["~> 0.5"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskmapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-04-
|
14
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activeresource
|
@@ -61,6 +61,22 @@ dependencies:
|
|
61
61
|
- - ~>
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '2.0'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: taskmapper-cli
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - '='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.0.1
|
72
|
+
type: :runtime
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - '='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.0.1
|
64
80
|
- !ruby/object:Gem::Dependency
|
65
81
|
name: rspec
|
66
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,8 +144,7 @@ dependencies:
|
|
128
144
|
description: TaskMapper provides a universal API to ticket tracking and project management
|
129
145
|
systems.
|
130
146
|
email: info@hybridgroup.com
|
131
|
-
executables:
|
132
|
-
- tm
|
147
|
+
executables: []
|
133
148
|
extensions: []
|
134
149
|
extra_rdoc_files:
|
135
150
|
- LICENSE
|
@@ -146,32 +161,12 @@ files:
|
|
146
161
|
- Rakefile
|
147
162
|
- TODO
|
148
163
|
- VERSION
|
149
|
-
- bin/tm
|
150
164
|
- examples/tm_example.rb
|
151
165
|
- examples/tm_example_2.rb
|
152
166
|
- examples/tm_example_3.rb
|
153
167
|
- examples/tm_example_4.rb
|
154
168
|
- lib/taskmapper.rb
|
155
169
|
- lib/taskmapper/authenticator.rb
|
156
|
-
- lib/taskmapper/cli/commands/config.rb
|
157
|
-
- lib/taskmapper/cli/commands/console.rb
|
158
|
-
- lib/taskmapper/cli/commands/generate.rb
|
159
|
-
- lib/taskmapper/cli/commands/generate/provider.rb
|
160
|
-
- lib/taskmapper/cli/commands/generate/provider/comment.rb
|
161
|
-
- lib/taskmapper/cli/commands/generate/provider/project.rb
|
162
|
-
- lib/taskmapper/cli/commands/generate/provider/provider.rb
|
163
|
-
- lib/taskmapper/cli/commands/generate/provider/ticket.rb
|
164
|
-
- lib/taskmapper/cli/commands/help.rb
|
165
|
-
- lib/taskmapper/cli/commands/help/config
|
166
|
-
- lib/taskmapper/cli/commands/help/console
|
167
|
-
- lib/taskmapper/cli/commands/help/generate
|
168
|
-
- lib/taskmapper/cli/commands/help/help
|
169
|
-
- lib/taskmapper/cli/commands/help/project
|
170
|
-
- lib/taskmapper/cli/commands/help/ticket
|
171
|
-
- lib/taskmapper/cli/commands/project.rb
|
172
|
-
- lib/taskmapper/cli/commands/ticket.rb
|
173
|
-
- lib/taskmapper/cli/common.rb
|
174
|
-
- lib/taskmapper/cli/init.rb
|
175
170
|
- lib/taskmapper/comment.rb
|
176
171
|
- lib/taskmapper/common.rb
|
177
172
|
- lib/taskmapper/dummy/comment.rb
|
@@ -210,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
205
|
version: '0'
|
211
206
|
segments:
|
212
207
|
- 0
|
213
|
-
hash:
|
208
|
+
hash: -2038018928188683418
|
214
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
210
|
none: false
|
216
211
|
requirements:
|
data/bin/tm
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
# The command method call implementation
|
2
|
-
# This sets the option parser and passes the parsed options to the subcommands
|
3
|
-
def config(options)
|
4
|
-
ARGV << '--help' if ARGV.length == 0
|
5
|
-
begin
|
6
|
-
OptionParser.new do |opts|
|
7
|
-
opts.banner = 'Usage: ticket -p PROVIDER [options] config [config_options]'
|
8
|
-
opts.separator ''
|
9
|
-
opts.separator 'Options:'
|
10
|
-
|
11
|
-
opts.on('-a', '--add', 'Add a new entry to the configuration file based on taskmapper options.') do
|
12
|
-
options[:subcommand] = 'add'
|
13
|
-
end
|
14
|
-
|
15
|
-
opts.on('-e', '--edit', 'Edit an existing entry to the configuration file based on taskmapper options') do
|
16
|
-
options[:subcommand] = 'edit'
|
17
|
-
end
|
18
|
-
|
19
|
-
opts.on('-p', '--set-default-provider', 'Set the current provider as the default.', 'Requires provider to be specified, otherwise unsets the default') do
|
20
|
-
options[:subcommand] = 'set_default_provider'
|
21
|
-
end
|
22
|
-
|
23
|
-
opts.separator ''
|
24
|
-
opts.separator 'Other options:'
|
25
|
-
|
26
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
27
|
-
puts opts
|
28
|
-
exit
|
29
|
-
end
|
30
|
-
end.parse(ARGV)
|
31
|
-
rescue OptionParser::MissingArgument => exception
|
32
|
-
puts "ticket #{options[:original_argv].join(' ')}\n\n"
|
33
|
-
puts "Error: An option was called that requires an argument, but was not given one"
|
34
|
-
puts exception.message
|
35
|
-
end
|
36
|
-
send(options[:subcommand], options)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Called on --add. It adds a new entry to the config file and will refuse if it already exists
|
40
|
-
def add(options)
|
41
|
-
require_provider unless options[:provider]
|
42
|
-
provider = options[:provider]
|
43
|
-
config_file = File.expand_path(options[:config])
|
44
|
-
config = if File.exists?(config_file)
|
45
|
-
YAML.load_file(config_file)
|
46
|
-
else
|
47
|
-
{}
|
48
|
-
end
|
49
|
-
if config[provider]
|
50
|
-
puts "#{provider} has already been specfied in #{options[:config]}. Refusing to add. Use --edit instead."
|
51
|
-
exit 1
|
52
|
-
end
|
53
|
-
config[provider] = {}
|
54
|
-
config[provider]['authentication'] = options[:authentication] || {}
|
55
|
-
config[provider]['project'] = options[:project] if options[:project]
|
56
|
-
File.open(config_file, 'w') do |out|
|
57
|
-
YAML.dump(config, out)
|
58
|
-
end
|
59
|
-
puts "Wrote #{provider} to #{config_file}"
|
60
|
-
exit
|
61
|
-
end
|
62
|
-
|
63
|
-
# Called on --edit. It updates and edits an entry. If the entry is non-existent, it will add it.
|
64
|
-
def edit(options)
|
65
|
-
require_provider unless options[:provider]
|
66
|
-
provider = options[:provider]
|
67
|
-
config_file = File.expand_path(options[:config])
|
68
|
-
config = if File.exist?(config_file)
|
69
|
-
YAML.load_file(config_file)
|
70
|
-
else
|
71
|
-
{}
|
72
|
-
end
|
73
|
-
config[provider] ||= {}
|
74
|
-
config[provider]['authentication'] = options[:authentication] || {}
|
75
|
-
config[provider]['project'] = options[:project] if options[:project]
|
76
|
-
File.open(config_file, 'w') do |out|
|
77
|
-
YAML.dump(config, out)
|
78
|
-
end
|
79
|
-
puts "Wrote #{provider} to #{config_file}"
|
80
|
-
exit
|
81
|
-
end
|
82
|
-
|
83
|
-
# Called on --set-default-provider. It sets the current provider as the default
|
84
|
-
def set_default_provider(options)
|
85
|
-
provider = options[:provider]
|
86
|
-
config = YAML.load_file(config_file = File.expand_path(options[:config]))
|
87
|
-
puts "Warning! #{provider} is not defined in #{config_file}" unless provider.nil? or config[provider]
|
88
|
-
config['default'] = provider
|
89
|
-
File.open(config_file, 'w') do |out|
|
90
|
-
YAML.dump(config, out)
|
91
|
-
end
|
92
|
-
puts "Default provider has been set to '#{provider}'"
|
93
|
-
exit
|
94
|
-
end
|
95
|
-
|
96
|
-
# Called when a provider is not given.
|
97
|
-
def require_provider
|
98
|
-
puts "Provider must be specified!"
|
99
|
-
exit 1
|
100
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# the console command
|
2
|
-
def console(options)
|
3
|
-
send(:open_irb, options, ARGV)
|
4
|
-
end
|
5
|
-
|
6
|
-
# the actual method to do the irb opening
|
7
|
-
def open_irb(options, argv)
|
8
|
-
tm_lib = File.dirname(__FILE__) + '/../../../taskmapper.rb'
|
9
|
-
irb_name = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
|
10
|
-
requires = "-r rubygems -r #{tm_lib} "
|
11
|
-
cmd = ''
|
12
|
-
if File.exist?(config = File.expand_path(options[:config]))
|
13
|
-
ENV['TASKMAPPER_CONFIG']=config
|
14
|
-
end
|
15
|
-
providers = !options[:provider].nil? ? [options[:provider]] : YAML.load_file(config).keys
|
16
|
-
providers.delete 'default'
|
17
|
-
require 'rubygems'
|
18
|
-
require 'taskmapper'
|
19
|
-
providers.inject(requires) do |mem, p|
|
20
|
-
begin
|
21
|
-
require "taskmapper-#{p}"
|
22
|
-
requires << "-r taskmapper-#{p} "
|
23
|
-
rescue Exception => exception
|
24
|
-
#puts exception
|
25
|
-
begin
|
26
|
-
require "#{p}"
|
27
|
-
requires << "-r #{p} "
|
28
|
-
rescue Exception => exception
|
29
|
-
warn "Could not require the '#{p}' provider. Is it installed?"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
cmd << "#{irb_name} #{requires} --simple-prompt #{ARGV.join(' ')}"
|
34
|
-
exec cmd
|
35
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# The generate command
|
2
|
-
def generate(options)
|
3
|
-
if ARGV.length == 0
|
4
|
-
ARGV << '--help'
|
5
|
-
else
|
6
|
-
provider_name = ARGV.shift
|
7
|
-
if provider_name.start_with? '_'
|
8
|
-
options[:provider] = provider_name[1..-1]
|
9
|
-
options[:provider_dir] = options[:provider]
|
10
|
-
else
|
11
|
-
options[:provider] = provider_name
|
12
|
-
options[:provider_dir] = 'taskmapper-' + options[:provider]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
options[:mkdir] = true
|
16
|
-
begin
|
17
|
-
OptionParser.new do |opts|
|
18
|
-
opts.banner = 'Usage: tm generate PROVIDER_NAME [--lib-directory DIR] [--jeweler [jeweler_options]]'
|
19
|
-
opts.separator ''
|
20
|
-
opts.separator 'Options:'
|
21
|
-
|
22
|
-
opts.on('-J', '--jeweler [JEWELER_OPTIONS]', 'Sets the working ticket') do |option|
|
23
|
-
options[:jeweler] = ARGV
|
24
|
-
options[:mkdir] = false
|
25
|
-
end
|
26
|
-
|
27
|
-
opts.on('-L', '--lib-directory DIR', 'Put the skeleton files inside this directory', ' * This assumes the directory already exists') do |dir|
|
28
|
-
options[:lib] = dir
|
29
|
-
options[:mkdir] = false
|
30
|
-
end
|
31
|
-
|
32
|
-
opts.separator ''
|
33
|
-
opts.separator 'Other options:'
|
34
|
-
|
35
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
36
|
-
puts opts
|
37
|
-
exit
|
38
|
-
end
|
39
|
-
opts.separator ''
|
40
|
-
opts.separator 'NOTE: taskmapper- will be prepended to your provider name'
|
41
|
-
opts.separator 'unless you set the first character as _ (it will be removed)'
|
42
|
-
end.order!
|
43
|
-
rescue OptionParser::MissingArgument => exception
|
44
|
-
puts "tm #{options[:original_argv].join(' ')}\n\n"
|
45
|
-
puts "Error: An option was called that requires an argument, but was not given one"
|
46
|
-
puts exception.message
|
47
|
-
rescue OptionParser::InvalidOption => exception
|
48
|
-
options[:jeweler] = exception.recover(ARGV)
|
49
|
-
options[:mkdir] = false
|
50
|
-
end
|
51
|
-
options[:lib] ||= options[:provider_dir] + '/lib/'
|
52
|
-
create_directories(options)
|
53
|
-
copy_skeleton(options)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Copy over the skeleton files
|
57
|
-
def copy_skeleton(options)
|
58
|
-
skeleton_path = File.dirname(__FILE__) + '/generate/'
|
59
|
-
provider = File.read(skeleton_path + 'provider.rb').gsub('yoursystem', options[:provider].downcase)
|
60
|
-
create_file(options, options[:provider_dir] + '.rb', provider)
|
61
|
-
skeleton_path << 'provider/'
|
62
|
-
provider = File.read(skeleton_path + 'provider.rb').gsub('Yoursystem', options[:provider].capitalize).gsub('yoursystem', options[:provider].downcase)
|
63
|
-
create_file(options, 'provider/' + options[:provider].downcase + '.rb', provider)
|
64
|
-
%w(project.rb ticket.rb comment.rb).each do |p|
|
65
|
-
provider = File.read(skeleton_path + p).gsub('Yoursystem', options[:provider].capitalize).gsub('yoursystem', options[:provider].downcase)
|
66
|
-
create_file(options, 'provider/' + p, provider)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Create the directories so copy_skeleton can do its job
|
71
|
-
def create_directories(options)
|
72
|
-
if options[:jeweler]
|
73
|
-
jeweler_options = options[:jeweler].inject('') do |mem, j|
|
74
|
-
j="'#{j}'" if j.include?(' ')
|
75
|
-
mem + j + ' '
|
76
|
-
end
|
77
|
-
puts "Running jeweler #{jeweler_options} #{options[:provider_dir]}"
|
78
|
-
puts `jeweler #{jeweler_options} #{options[:provider_dir]}`
|
79
|
-
elsif options[:mkdir]
|
80
|
-
begin
|
81
|
-
Dir.mkdir(options[:provider_dir])
|
82
|
-
puts "\tcreate\t#{options[:provider_dir]}"
|
83
|
-
rescue Exception => e
|
84
|
-
puts "\t#{e.message}"
|
85
|
-
end
|
86
|
-
begin
|
87
|
-
Dir.mkdir(options[:lib])
|
88
|
-
puts "\tcreate\t#{options[:lib]}"
|
89
|
-
rescue Exception => e
|
90
|
-
puts "\t#{e.message}"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
begin
|
94
|
-
Dir.mkdir(options[:lib] + '/provider')
|
95
|
-
puts "\tcreate\t#{options[:lib] + 'provider'}"
|
96
|
-
rescue Exception => e
|
97
|
-
puts "\t#{e.message}"
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
# Create files
|
102
|
-
def create_file(options, filename, data)
|
103
|
-
file_path = options[:lib] + '/' + filename
|
104
|
-
if File.exist?(file_path) and File.size(file_path) > 0
|
105
|
-
puts "\texists with content...skipping\t#{filename}"
|
106
|
-
return false;
|
107
|
-
end
|
108
|
-
puts "\tcreate\t#{filename}"
|
109
|
-
f = File.open(file_path, 'a+')
|
110
|
-
f.write data
|
111
|
-
f.close
|
112
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module TaskMapper::Provider
|
2
|
-
module Yoursystem
|
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
|
-
#API = Yoursystem::Comment # The class to access the api's comments
|
10
|
-
# declare needed overloaded methods here
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module TaskMapper::Provider
|
2
|
-
module Yoursystem
|
3
|
-
# Project class for taskmapper-yoursystem
|
4
|
-
#
|
5
|
-
#
|
6
|
-
class Project < TaskMapper::Provider::Base::Project
|
7
|
-
#API = Yoursystem::Project # The class to access the api's projects
|
8
|
-
# declare needed overloaded methods here
|
9
|
-
|
10
|
-
|
11
|
-
# copy from this.copy(that) copies that into this
|
12
|
-
def copy(project)
|
13
|
-
project.tickets.each do |ticket|
|
14
|
-
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
15
|
-
ticket.comments.each do |comment|
|
16
|
-
copy_ticket.comment!(:body => comment.body)
|
17
|
-
sleep 1
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module TaskMapper::Provider
|
2
|
-
# This is the Yoursystem Provider for taskmapper
|
3
|
-
module Yoursystem
|
4
|
-
include TaskMapper::Provider::Base
|
5
|
-
#TICKET_API = Yoursystem::Ticket # The class to access the api's tickets
|
6
|
-
#PROJECT_API = Yoursystem::Project # The class to access the api's projects
|
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(:yoursystem, auth)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Providers must define an authorize method. This is used to initialize and set authentication
|
14
|
-
# parameters to access the API
|
15
|
-
def authorize(auth = {})
|
16
|
-
@authentication ||= TaskMapper::Authenticator.new(auth)
|
17
|
-
# Set authentication parameters for whatever you're using to access the API
|
18
|
-
end
|
19
|
-
|
20
|
-
# declare needed overloaded methods here
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module TaskMapper::Provider
|
2
|
-
module Yoursystem
|
3
|
-
# Ticket class for taskmapper-yoursystem
|
4
|
-
#
|
5
|
-
|
6
|
-
class Ticket < TaskMapper::Provider::Base::Ticket
|
7
|
-
#API = Yoursystem::Ticket # The class to access the api's tickets
|
8
|
-
# declare needed overloaded methods here
|
9
|
-
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# The help command.
|
2
|
-
def help(options)
|
3
|
-
cmd = ARGV.shift || 'help'
|
4
|
-
page = File.dirname(__FILE__) + '/help/' + cmd
|
5
|
-
if File.exist?(page)
|
6
|
-
puts File.read(page)
|
7
|
-
puts "\nFor parameter listing and details, try executing the command with --help.\n\ttm #{cmd} --help"
|
8
|
-
end
|
9
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
This command is used to configure taskmapper settings for use in your terminal.
|
2
|
-
|
3
|
-
By default, taskmapper searches for the config information in a file named 'taskmapper.yml' in the current directory. Next it searches for 'config/taskmapper.yml' and if that fails, it uses the home directory's ~/.taskmapper.yml (note the . in front on this one). There is also the TASKMAPPER environment variable that you can set to point to another configuration file anywhere if necessary.
|
4
|
-
|
5
|
-
This command helps facilitate the creation of a taskmapper.yml.
|
6
|
-
|
7
|
-
Warning: Due to the way the authentication is parsed, if any keys or values contain a comma (,) or colin (:), it can not be parsed through the -A command. Usually this isn't a problem, and if it is, it can be resolved though putting the values in a config file.
|
8
|
-
|
9
|
-
Example:
|
10
|
-
tm -c ~/.taskmapper.yml -p dummy -A username:cheese,password:cakes -P 555 config --add
|
11
|
-
tm -p dummy config --set-default-provider
|
12
|
-
|
13
|
-
The format for taskmapper.yml is:
|
14
|
-
default: <default provider>
|
15
|
-
<provider name>:
|
16
|
-
authentication:
|
17
|
-
<authentication information>
|
18
|
-
project: <project>
|
19
|
-
[...]
|
20
|
-
|
21
|
-
For example, a taskmapper.yml with the Dummy provider would look something like this:
|
22
|
-
default: dummy
|
23
|
-
dummy:
|
24
|
-
authentication:
|
25
|
-
username: name
|
26
|
-
password: doesnt-matter
|
27
|
-
project: 555
|
@@ -1,13 +0,0 @@
|
|
1
|
-
This command is used to open an irb session with the taskmapper.
|
2
|
-
|
3
|
-
The configuration for this command should mostly be dependent on the taskmapper.yml files.
|
4
|
-
See taskmapper help config for more information on how to set it up.
|
5
|
-
|
6
|
-
Example:
|
7
|
-
tm console
|
8
|
-
tm -p dummy console
|
9
|
-
tm -p dummy console -d --tracer
|
10
|
-
|
11
|
-
By default, it attempts to load all providers listed in the config unless a provider is explicitly given.
|
12
|
-
|
13
|
-
All options passed to console is passed to the irb session. See irb --help for those options and their details
|
@@ -1,19 +0,0 @@
|
|
1
|
-
This command is used to generate a new provider.
|
2
|
-
|
3
|
-
It generates some basic files to get you started on creating your own provider.
|
4
|
-
|
5
|
-
NOTE: This command, in an attempt to keep provider names consistent, will prepend 'taskmapper-' to the given provider name. You can cancel this by prepending a _ before your provider name, which will be removed if found.
|
6
|
-
|
7
|
-
If you have not created a gem directory or skeleton and want to use Jeweler (http://github.com/technicalpickles/jeweler) you can execute:
|
8
|
-
|
9
|
-
$ tm generate myprovider --jeweler [JEWELER ARGS]
|
10
|
-
|
11
|
-
And it will create your whole directory and skeleton using jeweler.
|
12
|
-
|
13
|
-
If you like the old "classic" gem creation process or are using some other gem processor, you can create the directory to store your files, cd into it and run this command to put the skeleton files inside the directory's lib/.
|
14
|
-
|
15
|
-
Example:
|
16
|
-
mkdir myprovider myprovider/lib
|
17
|
-
cd myprovider
|
18
|
-
[...]
|
19
|
-
tm generate myprovider
|
@@ -1,13 +0,0 @@
|
|
1
|
-
This command is used to work with projects.
|
2
|
-
|
3
|
-
It can be used to do any of the CRUD actions with projects that are provided by the provider.
|
4
|
-
|
5
|
-
It will attempt to load data through the config files if they are available. See 'tm help config' for more information.
|
6
|
-
|
7
|
-
Examples:
|
8
|
-
tm -p lighthouse -A account:taskmapper,token:abc project --create name "new project"
|
9
|
-
tm project --read 946
|
10
|
-
tm --project 946 project --read
|
11
|
-
tm -p dummy -A "user:common coder,pass:w3rd out" project --destroy 712
|
12
|
-
tm -p dummy -P 712 project --destroy
|
13
|
-
tm -p dummy project --update name "new project name" description "this is the project description"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
This command is used to work with tickets.
|
2
|
-
|
3
|
-
It can be used to do any of the CRUD actions with projects that are provided by the provider.
|
4
|
-
|
5
|
-
It will attempt to load data through the config files if they are available. See 'tm help config' for more information.
|
6
|
-
|
7
|
-
If any of the keys or values contain a space, you will have to enclose that key or value in quotes. For example, if you set name to ProjectName it does not need to be quoted, but if you set name to Project Name it will have to be quoted to "Project Name" or 'Project Name'
|
8
|
-
|
9
|
-
Examples:
|
10
|
-
tm -p lighthouse -A account:taskmapper,token:abc ticket --create name "new ticket" description "this is a new ticket"
|
11
|
-
tm --project 946 ticket --read --ticket 2
|
12
|
-
tm -p dummy -A "user:common coder,pass: w3rd out" ticket --destroy --ticket 12
|
13
|
-
tm -p dummy -P 712 ticket --destroy --ticket 4
|
14
|
-
tm -p dummy project --ticket 6 --update attribute value name "free dummies"
|
@@ -1,140 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
# The command method call for project
|
3
|
-
# This sets the option parser and passes the parsed options to the subcommands
|
4
|
-
def project(options)
|
5
|
-
ARGV << '--help' if ARGV.length == 0
|
6
|
-
begin
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = 'Usage: tm -p PROVIDER [options] project [project_options]'
|
9
|
-
opts.separator ''
|
10
|
-
opts.separator 'Options:'
|
11
|
-
|
12
|
-
opts.on('-C', '--create ATTRIBUTES', 'Create a new project') do |attribute|
|
13
|
-
options[:project_attributes] = {attribute => ARGV.shift}.merge(attributes_hash(ARGV))
|
14
|
-
options[:subcommand] = 'create'
|
15
|
-
end
|
16
|
-
|
17
|
-
opts.on('-R', '--read [PROJECT]', 'Read out project and its attributes') do |id|
|
18
|
-
options[:project] = id if id
|
19
|
-
options[:subcommand] = 'read'
|
20
|
-
end
|
21
|
-
|
22
|
-
opts.on('-U', '--update ATTRIBUTES', 'Update project information') do |attribute|
|
23
|
-
options[:project_attributes] = {attribute => ARGV.shift}.merge(attributes_hash(ARGV))
|
24
|
-
options[:subcommand] = 'update'
|
25
|
-
end
|
26
|
-
|
27
|
-
opts.on('-D', '--destroy [PROJECT]', 'Destroy the project. Not reversible!') do |id|
|
28
|
-
options[:project] = id if id
|
29
|
-
options[:subcommand] = 'destroy'
|
30
|
-
end
|
31
|
-
|
32
|
-
opts.on('-I', '--info [PROJECT_ID]', 'Get project info. Same as --read. ') do |id|
|
33
|
-
options[:project] = id if id
|
34
|
-
options[:subcommand] = 'read'
|
35
|
-
end
|
36
|
-
|
37
|
-
opts.on('-S', '--search [ATTRIBUTES]', 'Search for a project based on attributes') do |attribute|
|
38
|
-
options[:project_attributes] = attribute ? {attribute => ARGV.shift}.merge(attributes_hash(ARGV)) : {}
|
39
|
-
options[:subcommand] = 'search'
|
40
|
-
end
|
41
|
-
|
42
|
-
opts.on('-L', '--list-all', 'List all projects. Same as --search without any parameters') do
|
43
|
-
options[:project_attributes] = {}
|
44
|
-
options[:subcommand] = 'search'
|
45
|
-
end
|
46
|
-
|
47
|
-
opts.on('-P', '--project [PROJECT_ID]', 'Set the project id') do |id|
|
48
|
-
options[:project] = id
|
49
|
-
end
|
50
|
-
|
51
|
-
opts.separator ''
|
52
|
-
opts.separator 'Other options:'
|
53
|
-
|
54
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
55
|
-
puts opts
|
56
|
-
exit
|
57
|
-
end
|
58
|
-
end.order!
|
59
|
-
rescue OptionParser::MissingArgument => exception
|
60
|
-
puts "tm #{options[:original_argv].join(' ')}\n\n"
|
61
|
-
puts "Error: An option was called that requires an argument, but was not given one"
|
62
|
-
puts exception.message
|
63
|
-
end
|
64
|
-
parse_config!(options)
|
65
|
-
begin
|
66
|
-
require 'taskmapper'
|
67
|
-
require "taskmapper-#{options[:provider]}"
|
68
|
-
rescue
|
69
|
-
require options[:provider]
|
70
|
-
end
|
71
|
-
send(options[:subcommand], options)
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
# The create subcommand
|
76
|
-
def create(options)
|
77
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
78
|
-
project = tm.project.create(options[:project_attributes])
|
79
|
-
read_project project
|
80
|
-
exit
|
81
|
-
end
|
82
|
-
|
83
|
-
# The read subcommand
|
84
|
-
def read(options)
|
85
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
86
|
-
project = tm.project.find(options[:project])
|
87
|
-
read_project project
|
88
|
-
exit
|
89
|
-
end
|
90
|
-
|
91
|
-
# The update subcommand
|
92
|
-
def update(options)
|
93
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
94
|
-
project = tm.project.find(options[:project])
|
95
|
-
if project.update!(options[:project_attributes])
|
96
|
-
puts "Successfully updated Project #{project.name} (#{project.id})"
|
97
|
-
else
|
98
|
-
puts "Sorry, it seems there was an error when trying to update the attributes"
|
99
|
-
end
|
100
|
-
read_project project
|
101
|
-
exit
|
102
|
-
end
|
103
|
-
|
104
|
-
# The destroy subcommand.
|
105
|
-
def destroy(options)
|
106
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
107
|
-
project = tm.project.find(options[:project])
|
108
|
-
puts "Are you sure you want to delete Project #{project.name} (#{project.id})? (yes/no) [no]"
|
109
|
-
ARGV.clear
|
110
|
-
confirm = readline.chomp.downcase
|
111
|
-
if confirm != 'y' and confirm != 'yes'
|
112
|
-
puts "Did not receive a 'yes' confirmation. Exiting..."
|
113
|
-
exit
|
114
|
-
elsif project.destroy
|
115
|
-
puts "Successfully deleted Project #{project.name} (#{project.id})"
|
116
|
-
else
|
117
|
-
puts "Sorry, it seems there was an error when trying to delete the project"
|
118
|
-
end
|
119
|
-
exit
|
120
|
-
end
|
121
|
-
|
122
|
-
# The search and list subcommands
|
123
|
-
def search(options)
|
124
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
125
|
-
projects = tm.projects(options[:project_attributes])
|
126
|
-
puts "Found #{projects.length} projects"
|
127
|
-
projects.each_with_index do |project, index|
|
128
|
-
puts "#{index+1}) Project #{project.name} (#{project.id})"
|
129
|
-
#read_project project
|
130
|
-
#puts
|
131
|
-
end
|
132
|
-
exit
|
133
|
-
end
|
134
|
-
|
135
|
-
# A utility method used to output project attributes
|
136
|
-
def read_project(project)
|
137
|
-
project.system_data[:client].attributes.sort.each do |key, value|
|
138
|
-
puts "#{key} : #{value}"
|
139
|
-
end
|
140
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
# The command method call for project
|
3
|
-
# This sets the option parser and passes the parsed options to the subcommands
|
4
|
-
def ticket(options)
|
5
|
-
ARGV << '--help' if ARGV.length == 0
|
6
|
-
begin
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = 'Usage: tm -p PROVIDER -P PROJECT [options] ticket [ticket_options]'
|
9
|
-
opts.separator ''
|
10
|
-
opts.separator 'Options:'
|
11
|
-
|
12
|
-
opts.on('-T', '--ticket TICKET', 'Sets the working ticket') do |id|
|
13
|
-
options[:ticket] = id
|
14
|
-
end
|
15
|
-
opts.on('-C', '--create ATTRIBUTES', 'Create a new ticket') do |attribute|
|
16
|
-
options[:ticket_attributes] = {attribute => ARGV.shift}.merge(attributes_hash(ARGV))
|
17
|
-
options[:subcommand] = 'create'
|
18
|
-
end
|
19
|
-
|
20
|
-
opts.on('-R', '--read [TICKET]', 'Read out ticket and its attributes. Requires --ticket to be set') do |id|
|
21
|
-
options[:ticket] = id if id
|
22
|
-
options[:subcommand] = 'read'
|
23
|
-
end
|
24
|
-
|
25
|
-
opts.on('-U', '--update ATTRIBUTES', 'Update ticket information. Requires --ticket to be set') do |attribute|
|
26
|
-
options[:ticket_attributes] = {attribute => ARGV.shift}.merge(attributes_hash(ARGV))
|
27
|
-
options[:subcommand] = 'update'
|
28
|
-
end
|
29
|
-
|
30
|
-
opts.on('-D', '--destroy', 'Destroy/Delete the ticket. Not reversible! Requires --ticket to be set') do
|
31
|
-
options[:subcommand] = 'destroy'
|
32
|
-
end
|
33
|
-
|
34
|
-
opts.on('-I', '--info', 'Get ticket info. Same as --read. ') do
|
35
|
-
options[:subcommand] = 'read'
|
36
|
-
end
|
37
|
-
|
38
|
-
opts.on('-S', '--search [ATTRIBUTES]', 'Search for a ticket based on attributes') do |attribute|
|
39
|
-
options[:ticket_attributes] = attribute ? {attribute => ARGV.shift}.merge(attributes_hash(ARGV)) : {}
|
40
|
-
options[:subcommand] = 'search'
|
41
|
-
end
|
42
|
-
|
43
|
-
opts.on('-L', '--list-all', 'List all tickets. Same as --search without any parameters') do
|
44
|
-
options[:ticket_attributes] = {}
|
45
|
-
options[:subcommand] = 'search'
|
46
|
-
end
|
47
|
-
|
48
|
-
opts.on('-P', '--project [PROJECT_ID]', 'Set the project id') do |id|
|
49
|
-
options[:project] = id
|
50
|
-
end
|
51
|
-
|
52
|
-
opts.separator ''
|
53
|
-
opts.separator 'Other options:'
|
54
|
-
|
55
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
56
|
-
puts opts
|
57
|
-
exit
|
58
|
-
end
|
59
|
-
end.order!
|
60
|
-
rescue OptionParser::MissingArgument => exception
|
61
|
-
puts "tm #{options[:original_argv].join(' ')}\n\n"
|
62
|
-
puts "Error: An option was called that requires an argument, but was not given one"
|
63
|
-
puts exception.message
|
64
|
-
end
|
65
|
-
parse_config!(options)
|
66
|
-
begin
|
67
|
-
require 'taskmapper'
|
68
|
-
require "taskmapper-#{options[:provider]}"
|
69
|
-
rescue
|
70
|
-
require options[:provider]
|
71
|
-
end
|
72
|
-
send(options[:subcommand], options)
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
# The create subcommand
|
77
|
-
def create(options)
|
78
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
79
|
-
ticket = tm.ticket.create(options[:ticket_attributes].merge({:project_id => options[:project]}))
|
80
|
-
read_ticket ticket
|
81
|
-
exit
|
82
|
-
end
|
83
|
-
|
84
|
-
# The read subcommand
|
85
|
-
def read(options)
|
86
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
87
|
-
project = tm.project(options[:project])
|
88
|
-
ticket = project.ticket(options[:ticket])
|
89
|
-
read_ticket ticket
|
90
|
-
exit
|
91
|
-
end
|
92
|
-
|
93
|
-
# The update subcommand
|
94
|
-
def update(options)
|
95
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
96
|
-
project = tm.project(options[:project])
|
97
|
-
ticket = project.ticket(options[:ticket])
|
98
|
-
if ticket.update!(options[:ticket_attributes])
|
99
|
-
puts "Successfully updated Ticket #{ticket.title} (#{ticket.id})"
|
100
|
-
else
|
101
|
-
puts "Sorry, it seems there was an error when trying to update the attributes"
|
102
|
-
end
|
103
|
-
read_ticket ticket
|
104
|
-
exit
|
105
|
-
end
|
106
|
-
|
107
|
-
# The destroy subcommand.
|
108
|
-
def destroy(options)
|
109
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
110
|
-
project = tm.project(options[:project])
|
111
|
-
ticket = project.ticket(options[:ticket])
|
112
|
-
puts "Are you sure you want to delete Ticket #{ticket.title} (#{ticket.id})? (yes/no) [no]"
|
113
|
-
ARGV.clear
|
114
|
-
confirm = readline.chomp.downcase
|
115
|
-
if confirm != 'y' and confirm != 'yes'
|
116
|
-
puts "Did not receive a 'yes' confirmation. Exiting..."
|
117
|
-
exit
|
118
|
-
elsif ticket.destroy
|
119
|
-
puts "Successfully deleted Ticket #{ticket.title} (#{ticket.id})"
|
120
|
-
else
|
121
|
-
puts "Sorry, it seems there was an error when trying to delete the project"
|
122
|
-
end
|
123
|
-
exit
|
124
|
-
end
|
125
|
-
|
126
|
-
# The search and list subcommands
|
127
|
-
def search(options)
|
128
|
-
tm = TaskMapper.new(options[:provider], options[:authentication])
|
129
|
-
project = tm.project(options[:project])
|
130
|
-
tickets = project.tickets(options[:ticket_attributes])
|
131
|
-
puts "Found #{tickets.length} tickets"
|
132
|
-
tickets.each_with_index do |ticket, index|
|
133
|
-
puts "#{index+1}) Ticket #{ticket.title} (#{ticket.id})"
|
134
|
-
#read_ticket ticket
|
135
|
-
#puts
|
136
|
-
end
|
137
|
-
exit
|
138
|
-
end
|
139
|
-
|
140
|
-
# A utility method used to output project attributes
|
141
|
-
def read_ticket(ticket)
|
142
|
-
ticket.system_data[:client].attributes.sort.each do |key, value|
|
143
|
-
puts "#{key} : #{value}"
|
144
|
-
end
|
145
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# Parses the configuration information and puts it into options
|
2
|
-
def parse_config!(options)
|
3
|
-
config = YAML.load_file File.expand_path(options[:config])
|
4
|
-
provider = (options[:provider] ||= config['default'] || config.keys.first)
|
5
|
-
if provider and provider.length > 0
|
6
|
-
options[:project] ||= config[provider]['project']
|
7
|
-
options[:authentication] ||= config[provider]['authentication']
|
8
|
-
end
|
9
|
-
options
|
10
|
-
end
|
11
|
-
|
12
|
-
# A utility method used to separate name:value pairs
|
13
|
-
def attributes_hash(kvlist)
|
14
|
-
require 'enumerator' if RUBY_VERSION < "1.8.7"
|
15
|
-
if kvlist.is_a?(String)
|
16
|
-
kvlist.split(',').inject({}) do |mem, kv|
|
17
|
-
key, value = kv.split(':')
|
18
|
-
mem[key] = value
|
19
|
-
mem
|
20
|
-
end
|
21
|
-
elsif kvlist.is_a?(Array)
|
22
|
-
mem = {}
|
23
|
-
kvlist.each_slice(2) do |k, v|
|
24
|
-
mem[k] = v
|
25
|
-
end
|
26
|
-
mem
|
27
|
-
end
|
28
|
-
end
|
data/lib/taskmapper/cli/init.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
require 'yaml'
|
5
|
-
require File.dirname(__FILE__) + '/common.rb'
|
6
|
-
|
7
|
-
|
8
|
-
commands ={ 'help' => 'Get the help text for a particular command',
|
9
|
-
'console' => 'Open up a taskmapper console session',
|
10
|
-
'config' => 'Setup and configure a taskmapper.yml file',
|
11
|
-
'ticket' => 'Work with tickets (create, edit, delete, etc)',
|
12
|
-
'project' => 'Work with projects (create, edit, delete, etc)',
|
13
|
-
'generate' => 'Generate skeleton library files for a new provider',
|
14
|
-
}
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
helptext = lambda {
|
19
|
-
helpmsg = "\nAvailable commands:\n"
|
20
|
-
commands.sort.inject(helpmsg) { |mem, cmd| mem << "\t#{cmd.join(" \t")}\n" }
|
21
|
-
helpmsg << "\nSee 'tm help COMMAND' for more information on a specific command."
|
22
|
-
}
|
23
|
-
|
24
|
-
ARGV << '--help' if ARGV.length == 0
|
25
|
-
|
26
|
-
options = {:original_argv => ARGV.dup}
|
27
|
-
|
28
|
-
if File.exist?(options[:config] = File.expand_path('taskmapper.yml'))
|
29
|
-
elsif File.exist?(options[:config] = File.expand_path('config/taskmapper.yml'))
|
30
|
-
elsif ENV['TASKMAPPER_CONFIG'] and File.exist?(options[:config] = File.expand_path(ENV['TASKMAPPER_CONFIG']))
|
31
|
-
else
|
32
|
-
options[:config] = File.expand_path('~/.taskmapper.yml')
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
OptionParser.new do |opts|
|
37
|
-
opts.banner = 'Usage: tm [options] COMMAND [command_options]'
|
38
|
-
opts.separator ''
|
39
|
-
opts.separator 'Options:'
|
40
|
-
|
41
|
-
opts.on('-c', '--config CONFIG', 'Use CONFIG as the configuration file. default: ~/.taskmapper.yml') do |c|
|
42
|
-
options[:config] = c
|
43
|
-
end
|
44
|
-
|
45
|
-
opts.on('-p', '--provider PROVIDER', 'Specifies the provider') { |p| options[:provider] = p }
|
46
|
-
|
47
|
-
opts.on('-A', '--authentication AUTH',
|
48
|
-
'Specifies authentication information, comma-separated list of name:value pairs.',
|
49
|
-
'Note: The whole list must be enclosed in quotes if there are any spaces.') do |a|
|
50
|
-
options[:authentication] = attributes_hash(a)
|
51
|
-
end
|
52
|
-
|
53
|
-
opts.on('-P', '--project PROJECT', 'Specifies the working project') { |p| options[:project] = p }
|
54
|
-
|
55
|
-
opts.separator ''
|
56
|
-
opts.separator 'Other options:'
|
57
|
-
|
58
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
59
|
-
puts opts
|
60
|
-
puts helptext.call
|
61
|
-
exit
|
62
|
-
end
|
63
|
-
end.order!
|
64
|
-
rescue OptionParser::MissingArgument => exception
|
65
|
-
puts "tm #{ARGV.join(' ')}\n\n"
|
66
|
-
puts "Error: An option was called that requires an argument, but was not given one"
|
67
|
-
puts exception.message
|
68
|
-
end
|
69
|
-
|
70
|
-
command = ARGV.shift
|
71
|
-
if commands[command]
|
72
|
-
require File.dirname(__FILE__) + '/commands/' + command
|
73
|
-
send(command, options)
|
74
|
-
else
|
75
|
-
puts "'#{command}' is not a taskmapper command\n\n", helptext.call
|
76
|
-
exit
|
77
|
-
end
|