tpope-pickler 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
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 "ssl: [true|false]" >> ~/my/app/features/tracker.yml
14
15
  pickler --help
15
16
 
17
+ "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
 
@@ -51,6 +51,7 @@ class Pickler
51
51
 
52
52
  def pull(default = nil)
53
53
  filename = filename() || pickler.features_path("#{default||id}.feature")
54
+ story = story() # force the read into local_body before File.open below blows it away
54
55
  File.open(filename,'w') {|f| f.puts story}
55
56
  @filename = filename
56
57
  end
@@ -11,23 +11,40 @@ class Pickler
11
11
 
12
12
  attr_reader :token
13
13
 
14
- def initialize(token)
15
- require 'active_support/core_ext/blank'
16
- require 'active_support/core_ext/hash'
14
+ def initialize(token, ssl = false)
15
+ require 'active_support'
17
16
  @token = token
17
+ @ssl = ssl
18
18
  end
19
19
 
20
- def request(method, path, *args)
21
- 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)
20
+ def ssl?
21
+ @ssl
22
+ end
23
+
24
+ def http
25
+ unless @http
26
+ if ssl?
27
+ require 'net/https'
28
+ @http = Net::HTTP.new(ADDRESS, Net::HTTP.https_default_port)
29
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
30
+ @http.use_ssl = true
31
+ else
32
+ require 'net/http'
33
+ @http = Net::HTTP.new(ADDRESS)
34
+ end
30
35
  end
36
+ @http
37
+ end
38
+
39
+ def request(method, path, *args)
40
+ headers = {
41
+ "X-TrackerToken" => @token,
42
+ "Accept" => "application/xml",
43
+ "Content-type" => "application/xml"
44
+ }
45
+ http # trigger require of 'net/http'
46
+ klass = Net::HTTP.const_get(method.to_s.capitalize)
47
+ http.request(klass.new("#{BASE_PATH}#{path}", headers), *args)
31
48
  end
32
49
 
33
50
  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
+ ssl = config['ssl']
105
+ Tracker.new(token, ssl).project(id)
105
106
  end
106
107
  end
107
108
 
data/pickler.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "pickler"
3
- s.version = "0.0.6"
3
+ s.version = "0.0.7"
4
4
 
5
5
  s.summary = "PIvotal traCKer Liaison to cucumbER"
6
6
  s.description = "Synchronize between Cucumber and Pivotal Tracker"
@@ -25,6 +25,4 @@ Gem::Specification.new do |s|
25
25
  ]
26
26
  s.add_dependency("activesupport", [">= 2.0.0"])
27
27
  s.add_dependency("cucumber", [">= 0.1.9"])
28
- s.add_dependency("builder")
29
- s.add_dependency("xml-simple")
30
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tpope-pickler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-15 00:00:00 -08:00
12
+ date: 2009-02-05 00:00:00 -08:00
13
13
  default_executable: pickler
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,24 +30,6 @@ dependencies:
30
30
  - !ruby/object:Gem::Version
31
31
  version: 0.1.9
32
32
  version:
33
- - !ruby/object:Gem::Dependency
34
- name: builder
35
- version_requirement:
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: "0"
41
- version:
42
- - !ruby/object:Gem::Dependency
43
- name: xml-simple
44
- version_requirement:
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: "0"
50
- version:
51
33
  description: Synchronize between Cucumber and Pivotal Tracker
52
34
  email: ruby@tpope.info
53
35
  executables: