kamal-pickler 0.0.7 → 0.0.8

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.rdoc CHANGED
@@ -11,8 +11,11 @@ containing a tracker.yml file.
11
11
  gem install tpope-pickler --source=http://gems.github.com
12
12
  echo "api_token: ..." > ~/.tracker.yml
13
13
  echo "project_id: ..." > ~/my/app/features/tracker.yml
14
+ echo "uses_ssl: [true|false]" >> ~/my/app/features/tracker.yml
14
15
  pickler --help
15
16
 
17
+ "uses_ssl" defaults to false if not configured in the yml file.
18
+
16
19
  For details about the Pivotal Tracker API, including where to find your API
17
20
  token and project id, see http://www.pivotaltracker.com/help/api .
18
21
 
@@ -67,6 +67,7 @@ class Pickler
67
67
  return if story.to_s == local_body.to_s
68
68
  story.to_s = local_body
69
69
  story.save
70
+ self
70
71
  end
71
72
 
72
73
  def finish
@@ -90,10 +91,13 @@ class Pickler
90
91
 
91
92
  def story
92
93
  unless defined?(@story)
93
- @story = id ? pickler.project.story(id) : pickler.new_story(:story_type => "feature")
94
+ @story = new_feature? ? pickler.new_story(:story_type => "feature") : pickler.project.story(id)
94
95
  end
95
96
  @story
96
97
  end
97
98
 
99
+ def new_feature?
100
+ id == nil
101
+ end
98
102
  end
99
103
  end
@@ -290,7 +290,8 @@ first line.
290
290
  process do |*args|
291
291
  args.replace(pickler.local_features) if args.empty?
292
292
  args.each do |arg|
293
- pickler.feature(arg).push
293
+ feature = pickler.feature(arg).push
294
+ File.open(feature.filename, 'w') { |f| f.puts feature.story } if feature.new_feature?
294
295
  end
295
296
  end
296
297
  end
@@ -9,25 +9,32 @@ class Pickler
9
9
 
10
10
  class Error < Pickler::Error; end
11
11
 
12
- attr_reader :token
12
+ attr_reader :token, :uses_ssl
13
13
 
14
- def initialize(token)
14
+ def initialize(token, uses_ssl = false)
15
15
  require 'active_support/core_ext/blank'
16
16
  require 'active_support/core_ext/hash'
17
17
  @token = token
18
+ @uses_ssl = uses_ssl
18
19
  end
19
20
 
20
21
  def request(method, path, *args)
21
22
  require 'net/http'
22
- Net::HTTP.start(ADDRESS) do |http|
23
- headers = {
24
- "X-TrackerToken" => @token,
25
- "Accept" => "application/xml",
26
- "Content-type" => "application/xml"
27
- }
28
- klass = Net::HTTP.const_get(method.to_s.capitalize)
29
- http.request(klass.new("#{BASE_PATH}#{path}", headers), *args)
23
+ port = uses_ssl ? Net::HTTP.https_default_port : Net::HTTP.http_default_port
24
+ http = Net::HTTP.new(ADDRESS, port)
25
+ if uses_ssl
26
+ require 'net/https'
27
+ require 'openssl'
28
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
29
+ http.use_ssl = true
30
30
  end
31
+ headers = {
32
+ "X-TrackerToken" => @token,
33
+ "Accept" => "application/xml",
34
+ "Content-type" => "application/xml"
35
+ }
36
+ klass = Net::HTTP.const_get(method.to_s.capitalize)
37
+ http.request(klass.new("#{BASE_PATH}#{path}", headers), *args)
31
38
  end
32
39
 
33
40
  def request_xml(method, path, *args)
data/lib/pickler.rb CHANGED
@@ -101,7 +101,8 @@ class Pickler
101
101
  unless id = project_id
102
102
  raise Error, 'echo project_id: ... > features/tracker.yml'
103
103
  end
104
- Tracker.new(token).project(id)
104
+ uses_ssl = config['uses_ssl'] # not required
105
+ Tracker.new(token, uses_ssl).project(id)
105
106
  end
106
107
  end
107
108
 
data/pickler.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "pickler"
3
- s.version = "0.0.7"
3
+ s.version = "0.0.8"
4
4
 
5
5
  s.summary = "PIvotal traCKer Liaison to cucumbER"
6
6
  s.description = "Synchronize between Cucumber and Pivotal Tracker"
7
- s.authors = ["Tim Pope", "Kamal Fariz Mahyuddin"]
7
+ s.authors = ["Tim Pope", "Kamal Fariz Mahyuddin", "Liam Morley"]
8
8
  s.email = "ruby@tpope.i"+'nfo'
9
9
  s.homepage = "http://github.com/tpope/pickler"
10
10
  s.default_executable = "pickler"
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamal-pickler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
8
8
  - Kamal Fariz Mahyuddin
9
+ - Liam Morley
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []