assembla_cli 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.assemblarc.sample +10 -0
- data/README.md +71 -26
- data/assembla_cli.gemspec +3 -2
- data/bin/assembla +242 -35
- data/lib/assembla_cli.rb +52 -14
- data/lib/assembla_cli/irbrc +16 -0
- data/lib/assembla_cli/version.rb +1 -1
- metadata +25 -6
- data/.assemblarc +0 -0
data/.assemblarc.sample
ADDED
data/README.md
CHANGED
|
@@ -1,38 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
| | |_)
|
|
2
|
+
_` | __| __| _ \ __ `__ \ __ \ | _` | __| | |
|
|
3
|
+
( |\__ \\__ \ __/ | | | | | | ( | ( | |
|
|
4
|
+
\__,_|____/____/\___|_| _| _|_.__/ _|\__,_| \___|_|_|
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
## Installation
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
gem install assembla_cli
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
123 high new just another bug
|
|
9
|
-
321 low test an easy fix
|
|
10
|
+
## Alternative Installation
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
git clone git@github.com:azendal/assembla_cli.git
|
|
13
|
+
cd assembla_cli
|
|
14
|
+
bundle
|
|
15
|
+
gem build assembla_cli.gemspec
|
|
16
|
+
gem i assembla_cli-0.0.1.gem
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
# label
|
|
16
|
-
0 invalid
|
|
17
|
-
1 new
|
|
18
|
-
2 test
|
|
19
|
-
3 fixed
|
|
18
|
+
## Configuration
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
> ticket //shows the current ticket summary
|
|
23
|
-
> comment "some comment or reason i already fixed this before ...."
|
|
20
|
+
echo -e "<username>\n<password>" >> ~/.assembla_cli
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
## Project configuration
|
|
23
|
+
|
|
24
|
+
cd /path/to/project
|
|
25
|
+
touch .assemblarc
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
#sample configuration
|
|
28
|
+
{
|
|
29
|
+
"space" : "space",
|
|
30
|
+
"report_id" : "12341",
|
|
31
|
+
"zebra_colors" : {
|
|
32
|
+
"color1" : "black_background",
|
|
33
|
+
"color2" : "blue_background"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
gem build assembla_cli.gemspec
|
|
31
|
-
gem i assembla_cli-0.0.1.gem
|
|
37
|
+
## Use
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
assembla
|
|
40
|
+
assembla> change_space 'Space'
|
|
41
|
+
|
|
42
|
+
assembla(Space)> change_report
|
|
43
|
+
+--------+-------------------------------+
|
|
44
|
+
| id | name |
|
|
45
|
+
+--------+-------------------------------+
|
|
46
|
+
| 12 | By Person - Open |
|
|
47
|
+
| 32 | My Open tickets |
|
|
48
|
+
+--------+-------------------------------+
|
|
49
|
+
select report number> 32
|
|
50
|
+
|
|
51
|
+
assembla(Space)> my_tickets
|
|
52
|
+
+--------+-------------+------------+-------------------+----------------------------------------+
|
|
53
|
+
| NUMBER | PRIORITY | MILESTONE | STATUS | SUMMARY |
|
|
54
|
+
+--------+-------------+------------+-------------------+----------------------------------------+
|
|
55
|
+
| 5 | Highest (1) | Release | Working | Add some feature |
|
|
56
|
+
| 1 | Normal (3) | Release | New | Improve some other feature |
|
|
57
|
+
| 2 | Normal (3) | Release | New | Remove unused method x |
|
|
58
|
+
| 7 | High (2) | Refactor | New | Abstract method x into a factory |
|
|
59
|
+
+--------+-------------+------------+-------------------+----------------------------------------+
|
|
60
|
+
|
|
61
|
+
assembla(Space)> ticket 5
|
|
62
|
+
assembla(Space)> comment "will be fixed soon"
|
|
63
|
+
assembla(Space)> status 'test'
|
|
64
|
+
|
|
65
|
+
assembla(Space)> ticket 1
|
|
66
|
+
|
|
67
|
+
## Full configured use
|
|
34
68
|
|
|
35
69
|
$ assembla
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
70
|
+
assembla(Space)> my_tickets
|
|
71
|
+
+--------+-------------+------------+-------------------+----------------------------------------+
|
|
72
|
+
| NUMBER | PRIORITY | MILESTONE | STATUS | SUMMARY |
|
|
73
|
+
+--------+-------------+------------+-------------------+----------------------------------------+
|
|
74
|
+
| 5 | Highest (1) | Release | Working | Add some feature |
|
|
75
|
+
| 1 | Normal (3) | Release | New | Improve some other feature |
|
|
76
|
+
| 2 | Normal (3) | Release | New | Remove unused method x |
|
|
77
|
+
| 7 | High (2) | Refactor | New | Abstract method x into a factory |
|
|
78
|
+
+--------+-------------+------------+-------------------+----------------------------------------+
|
|
79
|
+
|
|
80
|
+
## Getting help
|
|
81
|
+
|
|
82
|
+
assembla> commands
|
|
83
|
+
assembla> h
|
data/assembla_cli.gemspec
CHANGED
|
@@ -5,8 +5,8 @@ require "assembla_cli/version"
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
6
|
s.name = "assembla_cli"
|
|
7
7
|
s.version = AssemblaCli::VERSION
|
|
8
|
-
s.authors = ["azendal", "ktlacaelel", "edgarjs"]
|
|
9
|
-
s.email = ["
|
|
8
|
+
s.authors = ["azendal", "ktlacaelel", "edgarjs", "luisgodinez", "chubas"]
|
|
9
|
+
s.email = ["trasvina@gmail.com", "ktlacaelel@gmail.com", "edgar.js@gmail.com", "luisgodinez@gmail.com", "chubas7@gmail.com"]
|
|
10
10
|
s.homepage = "https://github.com/azendal/assembla_cli/"
|
|
11
11
|
s.summary = %q{A CLI to use Assembla for easy usage}
|
|
12
12
|
s.description = %q{A CLI to use Assembla for easy usage}
|
|
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
|
|
|
22
22
|
s.add_runtime_dependency "hashie"
|
|
23
23
|
s.add_runtime_dependency "httparty"
|
|
24
24
|
s.add_runtime_dependency "isna"
|
|
25
|
+
s.add_runtime_dependency "highline"
|
|
25
26
|
end
|
data/bin/assembla
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
|
4
4
|
require 'assembla_cli'
|
|
5
5
|
|
|
6
|
+
extend Hirb::Console
|
|
7
|
+
|
|
6
8
|
# TODO: Prompt for credentials and create this file if not exists
|
|
7
9
|
# TODO: Move authentication to another class or module
|
|
8
|
-
|
|
9
|
-
Assembla.login(username, password)
|
|
10
|
-
# Assembla.space('space name')
|
|
11
|
-
# Assembla.my_report('personal report id')
|
|
10
|
+
__assembla_rc = "#{ENV['HOME']}/.assembla_cli"
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
unless File.exists?(__assembla_rc)
|
|
13
|
+
puts "No configuration file found. Please input credentials."
|
|
14
|
+
File.open(__assembla_rc, 'w') do |file|
|
|
15
|
+
file.puts Assembla.setup_credentials
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
username, password = File.read(__assembla_rc).split
|
|
20
|
+
|
|
21
|
+
@cfg = {
|
|
22
|
+
'username' => username,
|
|
23
|
+
'password' => password,
|
|
24
|
+
"zebra_colors" => {
|
|
25
|
+
"color1" => "black_background",
|
|
26
|
+
"color2" => "blue_background"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@cfg = @cfg.merge MultiJson.decode(File.read(Dir.pwd + '/.assemblarc')) if File.exists?(Dir.pwd + '/.assemblarc')
|
|
31
|
+
|
|
32
|
+
Assembla.login(@cfg['username'], @cfg['password']) if @cfg['username'] && @cfg['password']
|
|
33
|
+
Assembla.space(@cfg['space']) if @cfg['space']
|
|
34
|
+
Assembla.my_report_id(@cfg['report_id']) if @cfg['report_id']
|
|
14
35
|
|
|
15
36
|
# Statuses dont change a log, so keep them cached to make ticket
|
|
16
37
|
# listing faster.
|
|
@@ -19,7 +40,7 @@ def status_translations
|
|
|
19
40
|
end
|
|
20
41
|
|
|
21
42
|
def milestone_translation
|
|
22
|
-
@milestone_translation ||= Assembla.milestones['milestones']
|
|
43
|
+
@milestone_translation ||= Assembla.milestones['milestones'] || []
|
|
23
44
|
end
|
|
24
45
|
|
|
25
46
|
def clean_cache
|
|
@@ -27,9 +48,9 @@ def clean_cache
|
|
|
27
48
|
@status_translations
|
|
28
49
|
end
|
|
29
50
|
|
|
30
|
-
def priority_string number
|
|
31
|
-
['', 'Highest (1)', 'High (2)', 'Normal (3)', 'Low (4)', 'Lowest (5)'][number]
|
|
32
|
-
end
|
|
51
|
+
def priority_string number
|
|
52
|
+
['', 'Highest (1)', 'High (2)', 'Normal (3)', 'Low (4)', 'Lowest (5)'][number]
|
|
53
|
+
end
|
|
33
54
|
|
|
34
55
|
# Translates a status-id into its status-name equivalent.
|
|
35
56
|
def status_string number
|
|
@@ -51,45 +72,231 @@ def milestone_string number
|
|
|
51
72
|
'Unknown'
|
|
52
73
|
end
|
|
53
74
|
|
|
54
|
-
def
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
def ticket_change_comment_string comment
|
|
76
|
+
c = YAML::load(comment).flatten
|
|
77
|
+
if c.count == 3
|
|
78
|
+
"#{c[0]} changed from: #{c[1]} to: #{c[2]}"
|
|
79
|
+
else
|
|
80
|
+
"Change: #{c.to_s}"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def reports
|
|
85
|
+
all_reports = Assembla.custom_reports['custom_reports']
|
|
86
|
+
table all_reports['user_reports'] + all_reports['team_reports'], :fields => ['id', 'name']
|
|
87
|
+
end
|
|
58
88
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
89
|
+
def change_report
|
|
90
|
+
reports
|
|
91
|
+
print "select report number> "
|
|
92
|
+
id = gets.chomp
|
|
93
|
+
Assembla.my_report_id id
|
|
94
|
+
end
|
|
64
95
|
|
|
96
|
+
def my_report
|
|
97
|
+
if Assembla.my_report_id.nil?
|
|
98
|
+
change_report
|
|
99
|
+
end
|
|
100
|
+
hash = Assembla.custom_report(Assembla.my_report_id)['tickets']
|
|
101
|
+
print_tickets hash
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def my_tickets
|
|
105
|
+
print_tickets Assembla.my_tickets['tickets']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def tickets
|
|
109
|
+
hash = Assembla.tickets['tickets']
|
|
110
|
+
print_tickets hash
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def print_table hash, fields = [], headers = {}
|
|
65
114
|
# Print data
|
|
66
|
-
table = Hirb::Helpers::AutoTable.render(hash, :fields => headers)
|
|
67
|
-
c =
|
|
115
|
+
table = Hirb::Helpers::AutoTable.render(hash, :fields => fields, :headers => headers, :description => false)
|
|
116
|
+
c = @cfg['zebra_colors']['color1']
|
|
117
|
+
i = 0;
|
|
118
|
+
|
|
68
119
|
table.each_line do |line|
|
|
69
|
-
|
|
70
|
-
|
|
120
|
+
if i > 2
|
|
121
|
+
c = c == @cfg['zebra_colors']['color1'] ? @cfg['zebra_colors']['color2'] : @cfg['zebra_colors']['color1']
|
|
122
|
+
end
|
|
123
|
+
puts line.chomp.to_ansi.white.send(c)
|
|
124
|
+
i = i + 1
|
|
71
125
|
end
|
|
72
|
-
|
|
73
|
-
# clean_cache
|
|
126
|
+
|
|
74
127
|
nil
|
|
75
128
|
end
|
|
76
129
|
|
|
130
|
+
def print_tickets hash
|
|
131
|
+
# Prepare table data.
|
|
132
|
+
headers = {
|
|
133
|
+
'number' => 'NUMBER',
|
|
134
|
+
'priority_name' => 'PRIORITY',
|
|
135
|
+
'milestone_name' => 'MILESTONE',
|
|
136
|
+
'status_name' => 'STATUS',
|
|
137
|
+
'assigned_to_name' => 'ASSIGNED TO',
|
|
138
|
+
'summary' => 'SUMMARY'
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
fields = ['number', 'priority_name', 'milestone_name', 'status_name', 'assigned_to_name', 'summary']
|
|
142
|
+
|
|
143
|
+
hash.each { |row| row['priority_name'] = priority_string(row['priority']) }
|
|
144
|
+
hash.each { |row| row['milestone_name'] = milestone_string(row['milestone_id']) }
|
|
145
|
+
hash.each { |row| row['assigned_to_name'] = row['assigned_to'] ? row['assigned_to']['name'] : '' }
|
|
146
|
+
|
|
147
|
+
print_table hash, fields, headers
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def print_ticket
|
|
151
|
+
ticket = Assembla.ticket['ticket']
|
|
152
|
+
hash = []
|
|
153
|
+
hash[0] = {:col1 => 'id', :col2 => ticket['number'], :col3 => ''}
|
|
154
|
+
hash[1] = {:col1 => 'summary', :col2 => ticket['summary'], :col3 => ''}
|
|
155
|
+
hash[2] = {:col1 => 'description', :col2 => ticket['description'], :col3 => ''}
|
|
156
|
+
hash[3] = {:col1 => 'milestone', :col2 => milestone_string(ticket['milestone_id']), :col3 => ''}
|
|
157
|
+
hash[4] = {:col1 => 'assigned to', :col2 => ticket['assigned_to']['name'], :col3 => ''}
|
|
158
|
+
hash[5] = {:col1 => 'reported by', :col2 => ticket['reporter']['name'], :col3 => ''}
|
|
159
|
+
hash[6] = {:col1 => 'status', :col2 => ticket['status_name'], :col3 => ''}
|
|
160
|
+
|
|
161
|
+
table = Hirb::Helpers::AutoTable.render(hash, :headers => false)
|
|
162
|
+
c = @cfg['zebra_colors']['color1']
|
|
163
|
+
i = 0;
|
|
164
|
+
|
|
165
|
+
table.each_line do |line|
|
|
166
|
+
c = (i == 1) ? @cfg['zebra_colors']['color2'] : @cfg['zebra_colors']['color1']
|
|
167
|
+
puts line.chomp.to_ansi.white.send(c)
|
|
168
|
+
i = i + 1
|
|
169
|
+
end
|
|
170
|
+
puts '-' * Hirb::View.width
|
|
171
|
+
puts "Ticket changes:"
|
|
172
|
+
puts '-' * Hirb::View.width
|
|
173
|
+
ticket['ticket_comments'].map do |comment|
|
|
174
|
+
if comment['comment'].nil? && !comment['ticket_changes'].nil?
|
|
175
|
+
puts "Ticket change:"
|
|
176
|
+
puts ticket_change_comment_string(comment['ticket_changes'])
|
|
177
|
+
puts "Date:#{comment['updated_at']}:"
|
|
178
|
+
puts '-' * Hirb::View.width
|
|
179
|
+
else !comment['comment'].nil?
|
|
180
|
+
puts "#{comment['user']['name']} comment:"
|
|
181
|
+
puts comment['comment']
|
|
182
|
+
puts "Date:#{comment['updated_at']}:"
|
|
183
|
+
puts '-' * Hirb::View.width
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
77
188
|
def milestones
|
|
78
189
|
table Assembla.milestones['milestones'], :fields => ['id', 'title']
|
|
79
190
|
end
|
|
80
191
|
|
|
81
|
-
def
|
|
82
|
-
`open https://www.assembla.com/spaces/
|
|
192
|
+
def http (ticket_id)
|
|
193
|
+
`open https://www.assembla.com/spaces/#{Assembla.space['space']['name']}/tickets/#{ticket_id}`
|
|
83
194
|
nil
|
|
84
195
|
end
|
|
85
196
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
197
|
+
def ticket (id = nil)
|
|
198
|
+
if id
|
|
199
|
+
Assembla.ticket id
|
|
200
|
+
print_ticket
|
|
201
|
+
elsif Assembla.ticket
|
|
202
|
+
print_ticket
|
|
203
|
+
else
|
|
204
|
+
puts 'Please select a ticket to display'
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def comment (comment, id = nil)
|
|
209
|
+
if id.nil? && Assembla.ticket.nil?
|
|
210
|
+
puts 'Please select a ticket to comment'
|
|
211
|
+
elsif id
|
|
212
|
+
Assembla.ticket id
|
|
213
|
+
Assembla.add_comment(comment)
|
|
214
|
+
ticket(id)
|
|
215
|
+
else
|
|
216
|
+
Assembla.add_comment(comment)
|
|
217
|
+
ticket(Assembla.ticket['ticket']['number'])
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def update_status (status, id = nil)
|
|
222
|
+
if id.nil? && Assembla.ticket.nil?
|
|
223
|
+
puts 'Please select a ticket to comment'
|
|
224
|
+
elsif id
|
|
225
|
+
Assembla.ticket id
|
|
226
|
+
Assembla.change_status(status)
|
|
227
|
+
ticket(id)
|
|
228
|
+
else
|
|
229
|
+
Assembla.change_status(status)
|
|
230
|
+
ticket(Assembla.ticket['ticket']['number'])
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def fixed (id = nil)
|
|
235
|
+
update_status('Fixed', id)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def test (id = nil)
|
|
239
|
+
update_status('Test', id)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def invalid (id = nil)
|
|
243
|
+
update_status('Invalid', id)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def statuses
|
|
247
|
+
table Assembla.statuses['ticket_statuses'], :fields => ['name']
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def change_space(space_name = nil)
|
|
251
|
+
unless space_name
|
|
252
|
+
spaces
|
|
253
|
+
print "enter space name> "
|
|
254
|
+
space_name = gets.chomp
|
|
255
|
+
end
|
|
256
|
+
Assembla.reset!
|
|
257
|
+
Assembla.space space_name
|
|
258
|
+
prompt = "assembla(#{space_name})> "
|
|
259
|
+
conf.prompt_i = conf.prompt_n = conf.prompt_s = conf.prompt_c = prompt
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def spaces
|
|
263
|
+
hash = Assembla.spaces['spaces']
|
|
264
|
+
fields = ['name', 'wiki_name']
|
|
265
|
+
headers = { 'name' => 'NAME', 'wiki_name' => 'SLUG' }
|
|
266
|
+
print_table hash, fields, headers
|
|
94
267
|
end
|
|
95
268
|
|
|
269
|
+
def commands
|
|
270
|
+
# TODO: Complete help
|
|
271
|
+
puts <<-eos
|
|
272
|
+
|
|
273
|
+
Assembla CLI, version #{AssemblaCli::VERSION}
|
|
274
|
+
|
|
275
|
+
change_space # Changes current space
|
|
276
|
+
change_report # Changes current default report
|
|
277
|
+
tickets # Lists tickets for current space
|
|
278
|
+
my_tickets # Lists active tickets assigned to 'me'
|
|
279
|
+
my_report # Lists custom report's tickets
|
|
280
|
+
statuses # Lists available statuses
|
|
281
|
+
comment('message') # Add a comment to current ticket
|
|
282
|
+
comment('message',id) # Add a comment to the specified ticket id
|
|
283
|
+
update_status('New') # Change the status to current ticket
|
|
284
|
+
update_status('New', id) # Update the status to the specified ticket
|
|
285
|
+
fixed # Close current ticket as fixed
|
|
286
|
+
fixed(id) # Close specified ticket as fixed
|
|
287
|
+
invalid # Close current ticket as invalid
|
|
288
|
+
invalid(id) # Close specified ticket as invalid
|
|
289
|
+
test # Set current ticket status to test
|
|
290
|
+
test(id) # Set specified ticket status to test
|
|
291
|
+
commands, h # Show this message
|
|
292
|
+
|
|
293
|
+
eos
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def h
|
|
297
|
+
commands
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
ENV['IRBRC'] = File.expand_path('../../lib/assembla_cli/irbrc', __FILE__)
|
|
301
|
+
IRB.start
|
|
302
|
+
|
data/lib/assembla_cli.rb
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
|
+
require 'irb'
|
|
2
3
|
require 'hirb'
|
|
3
4
|
require 'hashie'
|
|
4
5
|
require 'httparty'
|
|
5
6
|
require 'isna'
|
|
7
|
+
require 'yaml'
|
|
8
|
+
require 'highline/import'
|
|
6
9
|
require "assembla_cli/version"
|
|
7
10
|
|
|
8
11
|
module Assembla
|
|
9
12
|
include HTTParty
|
|
10
13
|
format :xml
|
|
11
|
-
base_uri 'assembla.com'
|
|
14
|
+
base_uri 'www.assembla.com'
|
|
15
|
+
|
|
16
|
+
def self.reset!
|
|
17
|
+
@current_space = @milestones = @my_report_id = @statuses, @users = nil
|
|
18
|
+
end
|
|
12
19
|
|
|
13
20
|
def self.xml_headers
|
|
14
|
-
{:headers => {'Accept' => 'application/xml'}}
|
|
21
|
+
{:headers => {'Accept' => 'application/xml', 'Content-Type' => 'application/xml'}}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.setup_credentials
|
|
25
|
+
login_name = ask('Username:')
|
|
26
|
+
password = ask('Password:') { |prompt| prompt.echo = false }
|
|
27
|
+
[ login_name, password ]
|
|
15
28
|
end
|
|
16
29
|
|
|
17
30
|
def self.login (login_name, password)
|
|
@@ -22,42 +35,67 @@ module Assembla
|
|
|
22
35
|
end
|
|
23
36
|
|
|
24
37
|
def self.spaces
|
|
25
|
-
|
|
38
|
+
get('/spaces/my_spaces', xml_headers)
|
|
26
39
|
end
|
|
27
40
|
|
|
28
|
-
def self.space (space_name)
|
|
29
|
-
|
|
41
|
+
def self.space (space_name = nil)
|
|
42
|
+
if space_name
|
|
43
|
+
@current_space = get("/spaces/#{space_name.gsub(/ /, '-').downcase}", xml_headers)
|
|
44
|
+
end
|
|
45
|
+
@current_space
|
|
30
46
|
end
|
|
31
47
|
|
|
32
|
-
def self.
|
|
33
|
-
|
|
48
|
+
def self.my_report_id (report_id = nil)
|
|
49
|
+
if report_id
|
|
50
|
+
@my_report_id = report_id
|
|
51
|
+
end
|
|
52
|
+
@my_report_id
|
|
34
53
|
end
|
|
35
54
|
|
|
36
55
|
def self.statuses
|
|
37
|
-
|
|
56
|
+
@statuses ||= get("/spaces/#{space['space']['id']}/tickets/custom_statuses", xml_headers)
|
|
38
57
|
end
|
|
39
58
|
|
|
40
59
|
def self.users
|
|
41
|
-
|
|
60
|
+
@users ||= get("/spaces/#{space['space']['id']}/users", xml_headers)
|
|
42
61
|
end
|
|
43
62
|
|
|
44
63
|
def self.milestones
|
|
45
|
-
@
|
|
64
|
+
@milestones ||= get("/spaces/#{space['space']['id']}/milestones/", xml_headers)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def self.ticket (ticket_id = nil)
|
|
68
|
+
if ticket_id
|
|
69
|
+
@current_ticket = get("/spaces/#{space['space']['id']}/tickets/#{ticket_id}", xml_headers)
|
|
70
|
+
end
|
|
71
|
+
@current_ticket
|
|
46
72
|
end
|
|
47
73
|
|
|
48
74
|
def self.tickets
|
|
49
|
-
|
|
75
|
+
get("/spaces/#{space['space']['id']}/tickets/report/3", xml_headers)
|
|
50
76
|
end
|
|
51
77
|
|
|
52
78
|
def self.my_tickets
|
|
53
|
-
get("/spaces/#{
|
|
79
|
+
get("/spaces/#{space['space']['id']}/tickets/report/8", xml_headers)
|
|
54
80
|
end
|
|
55
81
|
|
|
56
82
|
def self.custom_reports
|
|
57
|
-
get("/spaces/#{
|
|
83
|
+
get("/spaces/#{space['space']['id']}/custom_reports", xml_headers)
|
|
58
84
|
end
|
|
59
85
|
|
|
60
86
|
def self.custom_report (report_id)
|
|
61
|
-
get("/spaces/#{
|
|
87
|
+
get("/spaces/#{space['space']['id']}/tickets/custom_report/#{report_id}", xml_headers)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.add_comment (comment)
|
|
91
|
+
update_ticket("<ticket><user-comment>#{comment}</user-comment></ticket>")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.change_status (status_name)
|
|
95
|
+
update_ticket("<ticket><status>#{status_name}</status></ticket>")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.update_ticket (body)
|
|
99
|
+
put("/spaces/#{space['space']['id']}/tickets/#{ticket['ticket']['number']}", xml_headers.merge!(:body => "#{body}"))
|
|
62
100
|
end
|
|
63
101
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'irb/completion'
|
|
2
|
+
|
|
3
|
+
prompt = "assembla> "
|
|
4
|
+
|
|
5
|
+
IRB.conf[:PROMPT][:ASSEMBLA] = {
|
|
6
|
+
:AUTO_INDENT => false,
|
|
7
|
+
:PROMPT_I => prompt,
|
|
8
|
+
:PROMPT_N => prompt,
|
|
9
|
+
:PROMPT_S => prompt,
|
|
10
|
+
:PROMPT_C => prompt,
|
|
11
|
+
:RETURN => ""
|
|
12
|
+
}
|
|
13
|
+
IRB.conf[:PROMPT_MODE] = :ASSEMBLA
|
|
14
|
+
IRB.conf[:SINGLE_IRB] = true
|
|
15
|
+
IRB.conf[:IRB_NAME] = "assembla cli"
|
|
16
|
+
|
data/lib/assembla_cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: assembla_cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.0.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- azendal
|
|
14
14
|
- ktlacaelel
|
|
15
15
|
- edgarjs
|
|
16
|
+
- luisgodinez
|
|
17
|
+
- chubas
|
|
16
18
|
autorequire:
|
|
17
19
|
bindir: bin
|
|
18
20
|
cert_chain: []
|
|
19
21
|
|
|
20
|
-
date: 2012-01-
|
|
22
|
+
date: 2012-01-20 00:00:00 Z
|
|
21
23
|
dependencies:
|
|
22
24
|
- !ruby/object:Gem::Dependency
|
|
23
25
|
name: ruby-debug
|
|
@@ -89,11 +91,27 @@ dependencies:
|
|
|
89
91
|
version: "0"
|
|
90
92
|
type: :runtime
|
|
91
93
|
version_requirements: *id005
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: highline
|
|
96
|
+
prerelease: false
|
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
98
|
+
none: false
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
hash: 3
|
|
103
|
+
segments:
|
|
104
|
+
- 0
|
|
105
|
+
version: "0"
|
|
106
|
+
type: :runtime
|
|
107
|
+
version_requirements: *id006
|
|
92
108
|
description: A CLI to use Assembla for easy usage
|
|
93
109
|
email:
|
|
94
|
-
-
|
|
110
|
+
- trasvina@gmail.com
|
|
95
111
|
- ktlacaelel@gmail.com
|
|
96
112
|
- edgar.js@gmail.com
|
|
113
|
+
- luisgodinez@gmail.com
|
|
114
|
+
- chubas7@gmail.com
|
|
97
115
|
executables:
|
|
98
116
|
- assembla
|
|
99
117
|
extensions: []
|
|
@@ -101,7 +119,7 @@ extensions: []
|
|
|
101
119
|
extra_rdoc_files: []
|
|
102
120
|
|
|
103
121
|
files:
|
|
104
|
-
- .assemblarc
|
|
122
|
+
- .assemblarc.sample
|
|
105
123
|
- .gitignore
|
|
106
124
|
- Gemfile
|
|
107
125
|
- README.md
|
|
@@ -109,6 +127,7 @@ files:
|
|
|
109
127
|
- assembla_cli.gemspec
|
|
110
128
|
- bin/assembla
|
|
111
129
|
- lib/assembla_cli.rb
|
|
130
|
+
- lib/assembla_cli/irbrc
|
|
112
131
|
- lib/assembla_cli/version.rb
|
|
113
132
|
homepage: https://github.com/azendal/assembla_cli/
|
|
114
133
|
licenses: []
|
data/.assemblarc
DELETED
|
File without changes
|