pickler 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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.blank?
152
+ puts unless story.description =~ /^\s*$/
153
153
  story.description_lines.each do |line|
154
154
  puts " #{line}".rstrip
155
155
  end
@@ -105,8 +105,8 @@ class Pickler
105
105
  id = @attributes['id'] and Integer(id)
106
106
  end
107
107
 
108
- def to_xml(options = nil)
109
- @attributes.to_xml({:dasherize => false, :root => self.class.name.split('::').last.downcase}.merge(options||{}))
108
+ def to_xml
109
+ Pickler.hash_to_xml(self.class.name.split('::').last.downcase, @attributes)
110
110
  end
111
111
 
112
112
  end
@@ -15,7 +15,7 @@ class Pickler
15
15
  end
16
16
 
17
17
  def to_xml
18
- @attributes.to_xml(:dasherize => false, :root => 'note')
18
+ Pickler.hash_to_xml(:note, @attributes)
19
19
  end
20
20
 
21
21
  def inspect
@@ -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",{:text => body}.to_xml(:dasherize => false, :root => 'note'))
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
- hash.to_xml(:dasherize => false, :root => "story")
167
+ Pickler.hash_to_xml(:story, hash)
168
168
  end
169
169
 
170
170
  def destroy
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "pickler"
3
- s.version = "0.1.6"
3
+ s.version = "0.1.7"
4
4
 
5
5
  s.summary = "PIvotal traCKer Liaison to cucumbER"
6
6
  s.description = "Synchronize between Cucumber and Pivotal Tracker"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
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-18 00:00:00 -04:00
17
+ date: 2010-08-19 00:00:00 -04:00
18
18
  default_executable: pickler
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency