pickler 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pickler.rb +13 -0
- data/lib/pickler/runner.rb +1 -1
- data/lib/pickler/tracker.rb +2 -2
- data/lib/pickler/tracker/note.rb +1 -1
- data/lib/pickler/tracker/story.rb +2 -2
- data/pickler.gemspec +1 -1
- metadata +3 -3
data/lib/pickler.rb
CHANGED
@@ -17,6 +17,19 @@ class Pickler
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.hash_to_xml(root, attributes)
|
21
|
+
require 'cgi'
|
22
|
+
xml = "<#{root}>"
|
23
|
+
attributes.each do |k,v|
|
24
|
+
if v.kind_of?(Hash)
|
25
|
+
xml << hash_to_xml(k, v)
|
26
|
+
else
|
27
|
+
xml << "<#{k}>#{CGI.escapeHTML(v.to_s)}</#{k}>"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
xml << "</#{root}>"
|
31
|
+
end
|
32
|
+
|
20
33
|
def self.run(argv)
|
21
34
|
Runner.new(argv).run
|
22
35
|
end
|
data/lib/pickler/runner.rb
CHANGED
@@ -149,7 +149,7 @@ class Pickler
|
|
149
149
|
puts "Requester: #{story.requested_by}".rstrip
|
150
150
|
puts "Owner: #{story.owned_by}".rstrip
|
151
151
|
puts "URL: #{story.url}".rstrip
|
152
|
-
puts unless story.description
|
152
|
+
puts unless story.description =~ /^\s*$/
|
153
153
|
story.description_lines.each do |line|
|
154
154
|
puts " #{line}".rstrip
|
155
155
|
end
|
data/lib/pickler/tracker.rb
CHANGED
@@ -105,8 +105,8 @@ class Pickler
|
|
105
105
|
id = @attributes['id'] and Integer(id)
|
106
106
|
end
|
107
107
|
|
108
|
-
def to_xml
|
109
|
-
|
108
|
+
def to_xml
|
109
|
+
Pickler.hash_to_xml(self.class.name.split('::').last.downcase, @attributes)
|
110
110
|
end
|
111
111
|
|
112
112
|
end
|
data/lib/pickler/tracker/note.rb
CHANGED
@@ -149,7 +149,7 @@ class Pickler
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def comment!(body)
|
152
|
-
response = tracker.request_xml(:post, "#{resource_url}/notes",
|
152
|
+
response = tracker.request_xml(:post, "#{resource_url}/notes",Pickler.hash_to_xml(:note, :text => body))
|
153
153
|
if response["note"]
|
154
154
|
Note.new(self, response["note"])
|
155
155
|
else
|
@@ -164,7 +164,7 @@ class Pickler
|
|
164
164
|
if force_labels || !id || normalize_labels(@attributes["labels"]) != labels
|
165
165
|
hash["labels"] = labels.join(", ")
|
166
166
|
end
|
167
|
-
|
167
|
+
Pickler.hash_to_xml(:story, hash)
|
168
168
|
end
|
169
169
|
|
170
170
|
def destroy
|
data/pickler.gemspec
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tim Pope
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-19 00:00:00 -04:00
|
18
18
|
default_executable: pickler
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|