assembla 0.8.0 → 1.0.0
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/README.textile +11 -0
- data/VERSION +1 -1
- data/assembla-0.8.0.gem +0 -0
- data/assembla.gemspec +4 -3
- data/bin/ass +56 -1
- data/lib/assembla.rb +26 -12
- data/lib/interpreter.rb +1 -3
- data/lib/ticket.rb +14 -0
- data/rdoc/classes/AssEmBlr.html +37 -18
- data/rdoc/created.rid +1 -1
- data/rdoc/files/README_textile.html +15 -1
- data/rdoc/files/lib/assembla_rb.html +1 -1
- data/rdoc/fr_method_index.html +1 -0
- metadata +21 -9
data/README.textile
CHANGED
@@ -11,6 +11,17 @@ user: USERNAME
|
|
11
11
|
password: PASSWORD
|
12
12
|
me: MEANING_THE_PERSON_TO_WHOM_THE_TICKETS_ARE_ASSIGNED
|
13
13
|
|
14
|
+
bc.. Usage: ass [options]
|
15
|
+
-a, --all Print your active and new tickets
|
16
|
+
-i, --id ID Get ticket with id = ID
|
17
|
+
-s, --status STATUS Find tickets with given status
|
18
|
+
-t, --to TO Assigned to TO, example: ass -t "John Doe"
|
19
|
+
--toandstatus DATA Assigned to TO and with STATUS, call like this: ass --toandstatus "Name Surname"__New
|
20
|
+
-u, --updateStatus DATA Change tickets status, call like this: ass -u ID__NEW_STATUS
|
21
|
+
-d, --updateDescription DATA Change tickets descriptino. Exmple ass -d ID__"New description text"
|
22
|
+
-v, --version Get version
|
23
|
+
-h, --help Display this information
|
24
|
+
|
14
25
|
h2. INSTALATION
|
15
26
|
|
16
27
|
p{background:#888}. gem install a2smbla
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/assembla-0.8.0.gem
ADDED
Binary file
|
data/assembla.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{assembla}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ignacy Moryc"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-27}
|
13
13
|
s.default_executable = %q{ass}
|
14
14
|
s.description = %q{This gem provides access to assembla tickets. It supports listing, creating and modyfing functionality}
|
15
15
|
s.email = %q{imoryc@gmail.com}
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"Rakefile",
|
24
24
|
"VERSION",
|
25
25
|
"a2smbla-0.3.0.gem",
|
26
|
+
"assembla-0.8.0.gem",
|
26
27
|
"assembla.gemspec",
|
27
28
|
"bin/ass",
|
28
29
|
"config_default.yml",
|
@@ -46,7 +47,7 @@ Gem::Specification.new do |s|
|
|
46
47
|
s.homepage = %q{http://github.com/ignacy/assembla}
|
47
48
|
s.rdoc_options = ["--charset=UTF-8"]
|
48
49
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = %q{1.3.
|
50
|
+
s.rubygems_version = %q{1.3.6}
|
50
51
|
s.summary = %q{Command line access to assembla}
|
51
52
|
s.test_files = [
|
52
53
|
"spec/assembla_spec.rb"
|
data/bin/ass
CHANGED
@@ -3,6 +3,61 @@
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
4
|
|
5
5
|
require 'assembla'
|
6
|
+
require 'optparse'
|
6
7
|
|
8
|
+
options = {}
|
7
9
|
@assem = AssEmBlr.new
|
8
|
-
|
10
|
+
|
11
|
+
OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: ass [options]"
|
13
|
+
|
14
|
+
opts.on("-a", "--all", "Print your active and new tickets") do |a|
|
15
|
+
options[:all] = a
|
16
|
+
@assem.print(@assem.find_my_active_tickets)
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-i", "--id ID", "Get ticket with id = ID") do |id|
|
20
|
+
idid = @assem.find({:id => id.to_i})
|
21
|
+
puts idid.details
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
opts.on("-s", "--status STATUS", "Find tickets with given status") do |status|
|
26
|
+
options[:status] = status
|
27
|
+
with_id = @assem.find({:status => options[:status]})
|
28
|
+
@assem.print(with_id)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
opts.on( '-t', '--to TO', 'Assigned to TO, example: ass -t "John Doe" ') do |to|
|
33
|
+
@assem.print(@assem.find({:assigned_to => to}))
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on("--toandstatus DATA", 'Assigned to TO and with STATUS, call like this: ass --toandstatus "Name Surname"__New ') do |data|
|
37
|
+
to, status = data.split(/__/)
|
38
|
+
@assem.print(@assem.find({:assigned_to => to, :status => status}))
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on("-u", "--updateStatus DATA", 'Change tickets status, call like this: ass -u ID__NEW_STATUS') do |data|
|
42
|
+
id, status = data.split(/__/)
|
43
|
+
@assem.update_tickets_status(id, status)
|
44
|
+
end
|
45
|
+
|
46
|
+
opts.on("-d", "--updateDescription DATA", 'Change tickets descriptino. Exmple ass -d ID__"New description text"') do |data|
|
47
|
+
id, description = data.split(/__/)
|
48
|
+
@assem.update_tickets_description(id, description)
|
49
|
+
end
|
50
|
+
|
51
|
+
opts.on("-v", "--version", "Get version") do |v|
|
52
|
+
options[:verbose] = v
|
53
|
+
puts "Assembla version 0.8.0"
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.on( '-h', '--help', 'Display this information' ) do
|
57
|
+
puts opts
|
58
|
+
exit
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end.parse!
|
63
|
+
|
data/lib/assembla.rb
CHANGED
@@ -65,11 +65,10 @@ class AssEmBlr
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def find_my_active_tickets #:nodoc:
|
68
|
-
ass =
|
69
|
-
|
70
|
-
|
71
|
-
accepted
|
72
|
-
((accepted + new + ass) - test).uniq
|
68
|
+
ass = self.find({ :assigned_to => @me, :status => "New"})
|
69
|
+
test = self.find({ :assigned_to => @me, :status => "Test"})
|
70
|
+
accepted = self.find({ :assigned_to => @me, :status => "Accepted"})
|
71
|
+
((accepted + ass) - test)
|
73
72
|
end
|
74
73
|
|
75
74
|
def find_with_status(status = "New") #:nodoc:
|
@@ -90,7 +89,7 @@ class AssEmBlr
|
|
90
89
|
|
91
90
|
def find_id(id) #:nodoc:
|
92
91
|
result = Id.new
|
93
|
-
result.evaluate(self.parsed, id)
|
92
|
+
result.evaluate(self.parsed, id)
|
94
93
|
end
|
95
94
|
|
96
95
|
# This function uses OR condition for search
|
@@ -113,19 +112,34 @@ class AssEmBlr
|
|
113
112
|
# to change tickets status.
|
114
113
|
# It returns text of http response from Aseembla server.
|
115
114
|
def update_tickets_status(id, status)
|
116
|
-
|
115
|
+
request = prepare_request(id)
|
116
|
+
request.body = "<ticket><status type='integer'>#{get_id_from_status(status)}</status></ticket>"
|
117
|
+
send_request(request)
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
def update_tickets_description(id, description)
|
122
|
+
request = prepare_request(id)
|
123
|
+
request.body = "<ticket><description>#{description}</description></ticket>"
|
124
|
+
send_request(request)
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def prepare_request(id)
|
117
130
|
space = @url.gsub(/https:\/\/www\.assembla.com(.+)/, '\1')
|
118
131
|
url = space + '/' + id.to_s
|
119
132
|
request = Net::HTTP::Put.new(url, initheader = {'Content-Type' => 'application/xml', 'Accept' => 'application/xml'})
|
120
|
-
|
121
|
-
|
133
|
+
end
|
134
|
+
|
135
|
+
def send_request(request)
|
136
|
+
request.basic_auth @user, @password
|
122
137
|
Net::HTTP.start("www.assembla.com", 80 ) do |http|
|
123
138
|
response = http.request(request)
|
124
|
-
puts response
|
139
|
+
puts "Response code #{response.code}"
|
140
|
+
puts response.body
|
125
141
|
end
|
126
142
|
end
|
127
|
-
|
128
|
-
private
|
129
143
|
|
130
144
|
def get_id_from_status(s) #:nodoc:
|
131
145
|
statuses = { "New" => 0,
|
data/lib/interpreter.rb
CHANGED
data/lib/ticket.rb
CHANGED
@@ -21,5 +21,19 @@ class Ticket
|
|
21
21
|
def to_s #:nodoc:
|
22
22
|
"#{self.id.to_s.center(5)}|#{self.assigned_to.center(18)}|#{self.status.to_s.center(10)}| #{self.summary} \n"
|
23
23
|
end
|
24
|
+
|
25
|
+
def details
|
26
|
+
details = <<DETAILS
|
27
|
+
Id: #{self.id}
|
28
|
+
Status: #{self.status.to_s}
|
29
|
+
AssignedTo: #{self.assigned_to}
|
30
|
+
-----------------------------------------------
|
31
|
+
Sumary: #{self.summary}
|
32
|
+
-----------------------------------------------
|
33
|
+
DETAILS
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
|
24
38
|
|
25
39
|
end
|
data/rdoc/classes/AssEmBlr.html
CHANGED
@@ -90,6 +90,7 @@
|
|
90
90
|
<a href="#M000001">new</a>
|
91
91
|
<a href="#M000004">print</a>
|
92
92
|
<a href="#M000002">tickets</a>
|
93
|
+
<a href="#M000006">update_tickets_description</a>
|
93
94
|
<a href="#M000005">update_tickets_status</a>
|
94
95
|
</div>
|
95
96
|
</div>
|
@@ -256,11 +257,11 @@ Prints the <a href="AssEmBlr.html#M000002">tickets</a> to STDOUT
|
|
256
257
|
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
257
258
|
<div class="method-source-code" id="M000004-source">
|
258
259
|
<pre>
|
259
|
-
<span class="ruby-comment cmt"># File lib/assembla.rb, line
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
260
|
+
<span class="ruby-comment cmt"># File lib/assembla.rb, line 85</span>
|
261
|
+
85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">tickets</span>)
|
262
|
+
86: <span class="ruby-identifier">puts_title_line</span>
|
263
|
+
87: <span class="ruby-identifier">tickets</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span> }
|
264
|
+
88: <span class="ruby-keyword kw">end</span>
|
264
265
|
</pre>
|
265
266
|
</div>
|
266
267
|
</div>
|
@@ -294,6 +295,31 @@ in your Assembla space
|
|
294
295
|
</div>
|
295
296
|
</div>
|
296
297
|
|
298
|
+
<div id="method-M000006" class="method-detail">
|
299
|
+
<a name="M000006"></a>
|
300
|
+
|
301
|
+
<div class="method-heading">
|
302
|
+
<a href="#M000006" class="method-signature">
|
303
|
+
<span class="method-name">update_tickets_description</span><span class="method-args">(id, description)</span>
|
304
|
+
</a>
|
305
|
+
</div>
|
306
|
+
|
307
|
+
<div class="method-description">
|
308
|
+
<p><a class="source-toggle" href="#"
|
309
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
310
|
+
<div class="method-source-code" id="M000006-source">
|
311
|
+
<pre>
|
312
|
+
<span class="ruby-comment cmt"># File lib/assembla.rb, line 121</span>
|
313
|
+
121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_tickets_description</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">description</span>)
|
314
|
+
122: <span class="ruby-identifier">request</span> = <span class="ruby-identifier">prepare_request</span>(<span class="ruby-identifier">id</span>)
|
315
|
+
123: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> = <span class="ruby-node">"<ticket><description>#{description}</description></ticket>"</span>
|
316
|
+
124: <span class="ruby-identifier">send_request</span>(<span class="ruby-identifier">request</span>)
|
317
|
+
125: <span class="ruby-keyword kw">end</span>
|
318
|
+
</pre>
|
319
|
+
</div>
|
320
|
+
</div>
|
321
|
+
</div>
|
322
|
+
|
297
323
|
<div id="method-M000005" class="method-detail">
|
298
324
|
<a name="M000005"></a>
|
299
325
|
|
@@ -314,19 +340,12 @@ text of http response from Aseembla server.
|
|
314
340
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
315
341
|
<div class="method-source-code" id="M000005-source">
|
316
342
|
<pre>
|
317
|
-
<span class="ruby-comment cmt"># File lib/assembla.rb, line
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
120: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> = <span class="ruby-node">"<ticket><status type='integer'>#{status_number}</status></ticket>"</span>
|
324
|
-
121: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">basic_auth</span> <span class="ruby-ivar">@user</span>, <span class="ruby-ivar">@password</span>
|
325
|
-
122: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value str">"www.assembla.com"</span>, <span class="ruby-value">80</span> ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
|
326
|
-
123: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
|
327
|
-
124: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">response</span>
|
328
|
-
125: <span class="ruby-keyword kw">end</span>
|
329
|
-
126: <span class="ruby-keyword kw">end</span>
|
343
|
+
<span class="ruby-comment cmt"># File lib/assembla.rb, line 114</span>
|
344
|
+
114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_tickets_status</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">status</span>)
|
345
|
+
115: <span class="ruby-identifier">request</span> = <span class="ruby-identifier">prepare_request</span>(<span class="ruby-identifier">id</span>)
|
346
|
+
116: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> = <span class="ruby-node">"<ticket><status type='integer'>#{get_id_from_status(status)}</status></ticket>"</span>
|
347
|
+
117: <span class="ruby-identifier">send_request</span>(<span class="ruby-identifier">request</span>)
|
348
|
+
118: <span class="ruby-keyword kw">end</span>
|
330
349
|
</pre>
|
331
350
|
</div>
|
332
351
|
</div>
|
data/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sat, 27 Mar 2010 13:26:45 +0100
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sat
|
59
|
+
<td>Sat Mar 27 13:26:18 +0100 2010</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -95,6 +95,20 @@ user: USERNAME password: PASSWORD me:
|
|
95
95
|
MEANING_THE_PERSON_TO_WHOM_THE_TICKETS_ARE_ASSIGNED
|
96
96
|
</p>
|
97
97
|
<p>
|
98
|
+
bc.. Usage: ass [options]
|
99
|
+
</p>
|
100
|
+
<pre>
|
101
|
+
-a, --all Print your active and new tickets
|
102
|
+
-i, --id ID Get ticket with id = ID
|
103
|
+
-s, --status STATUS Find tickets with given status
|
104
|
+
-t, --to TO Assigned to TO, example: ass -t "John Doe"
|
105
|
+
--toandstatus DATA Assigned to TO and with STATUS, call like this: ass --toandstatus "Name Surname"__New
|
106
|
+
-u, --updateStatus DATA Change tickets status, call like this: ass -u ID__NEW_STATUS
|
107
|
+
-d, --updateDescription DATA Change tickets descriptino. Exmple ass -d ID__"New description text"
|
108
|
+
-v, --version Get version
|
109
|
+
-h, --help Display this information
|
110
|
+
</pre>
|
111
|
+
<p>
|
98
112
|
h2. INSTALATION
|
99
113
|
</p>
|
100
114
|
<p>
|
data/rdoc/fr_method_index.html
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
<a href="classes/AssEmBlr.html#M000001">new (AssEmBlr)</a><br />
|
25
25
|
<a href="classes/AssEmBlr.html#M000004">print (AssEmBlr)</a><br />
|
26
26
|
<a href="classes/AssEmBlr.html#M000002">tickets (AssEmBlr)</a><br />
|
27
|
+
<a href="classes/AssEmBlr.html#M000006">update_tickets_description (AssEmBlr)</a><br />
|
27
28
|
<a href="classes/AssEmBlr.html#M000005">update_tickets_status (AssEmBlr)</a><br />
|
28
29
|
</div>
|
29
30
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assembla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Ignacy Moryc
|
@@ -9,19 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-27 00:00:00 +01:00
|
13
18
|
default_executable: ass
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: hpricot
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 8
|
30
|
+
- 1
|
23
31
|
version: 0.8.1
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
description: This gem provides access to assembla tickets. It supports listing, creating and modyfing functionality
|
26
35
|
email: imoryc@gmail.com
|
27
36
|
executables:
|
@@ -36,6 +45,7 @@ files:
|
|
36
45
|
- Rakefile
|
37
46
|
- VERSION
|
38
47
|
- a2smbla-0.3.0.gem
|
48
|
+
- assembla-0.8.0.gem
|
39
49
|
- assembla.gemspec
|
40
50
|
- bin/ass
|
41
51
|
- config_default.yml
|
@@ -68,18 +78,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
78
|
requirements:
|
69
79
|
- - ">="
|
70
80
|
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
71
83
|
version: "0"
|
72
|
-
version:
|
73
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
85
|
requirements:
|
75
86
|
- - ">="
|
76
87
|
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 0
|
77
90
|
version: "0"
|
78
|
-
version:
|
79
91
|
requirements: []
|
80
92
|
|
81
93
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.3.
|
94
|
+
rubygems_version: 1.3.6
|
83
95
|
signing_key:
|
84
96
|
specification_version: 3
|
85
97
|
summary: Command line access to assembla
|