slurper 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +4 -0
  2. data/lib/story.rb +15 -2
  3. data/spec/story_spec.rb +16 -0
  4. metadata +12 -17
data/README.rdoc CHANGED
@@ -27,6 +27,7 @@ Slurper requires a slurper_config.yml file in your working directory. This file
27
27
  project_id: 1234
28
28
  token: 123abc123abc123abc
29
29
  requested_by: Jane Stakeholder
30
+ ssl: true
30
31
 
31
32
  The project_id tells tracker which project to add your stories to. It can be found on the project settings or the url for the project.
32
33
 
@@ -34,6 +35,9 @@ The token can be found on your personal profile page in Pivotal Tracker.
34
35
 
35
36
  The requested_by field should be the name of your project stakeholder exactly as it appears in tracker.
36
37
 
38
+ The ssl field should be set to true if you've enabled "Use HTTPS" in Pivotal Tracker.
39
+ SSL is being verified by peer using the cacert.pem from (http://curl.haxx.se/ca)
40
+
37
41
  == Usage
38
42
 
39
43
  Create a stories.slurper file and compose your stories in the slurper story format. In your working directory use the slurp command to import your stories from the stories.slurper file into Pivotal Tracker. Slurper looks for a stories.slurper file in your current directory by default, however, you can provide an alternate story source file if necessary.
data/lib/story.rb CHANGED
@@ -2,11 +2,24 @@ require 'active_resource'
2
2
 
3
3
  class Story < ActiveResource::Base
4
4
 
5
+ def self.yaml
6
+ YAML.load_file('slurper_config.yml')
7
+ end
8
+
5
9
  def self.config
6
- @@config ||= YAML.load_file('slurper_config.yml')
10
+ @@config = yaml
11
+ scheme = if !!@@config['ssl']
12
+ self.ssl_options = { :verify_mode => OpenSSL::SSL::VERIFY_PEER,
13
+ :ca_file => File.join(File.dirname(__FILE__), "cacert.pem") }
14
+ "https"
15
+ else
16
+ "http"
17
+ end
18
+ self.site = "#{scheme}://www.pivotaltracker.com/services/v3/projects/#{@@config['project_id']}"
19
+ @@config
7
20
  end
8
21
 
9
- self.site = "http://www.pivotaltracker.com/services/v3/projects/#{config['project_id']}"
22
+
10
23
  headers['X-TrackerToken'] = config.delete("token")
11
24
 
12
25
  def prepare
data/spec/story_spec.rb CHANGED
@@ -18,6 +18,22 @@ describe Story do
18
18
  story.should_receive(:default_requested_by)
19
19
  story.prepare
20
20
  end
21
+
22
+ it "uses http by default" do
23
+ Story.site.scheme.should == "http"
24
+ Story.yaml['ssl'].should be_nil
25
+ end
26
+
27
+ it "uses https if set in the config" do
28
+ Story.stub!(:yaml).and_return({"ssl" => true})
29
+ # Need these two method calls to set up the class vars correctly
30
+ Story.yaml['ssl'].should be_true
31
+ Story.config['ssl'].should be_true
32
+
33
+ Story.site.scheme.should == "https"
34
+ Story.ssl_options[:verify_mode].should == 1
35
+ File.open(File.expand_path('lib/cacert.pem')).readlines.find_all{ |l| l =~ /^Equifax/ }.count.should == 4
36
+ end
21
37
  end
22
38
 
23
39
  context "requested_by attribute" do
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slurper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
7
+ - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ version: 1.1.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Wes Gibbs
@@ -22,37 +21,35 @@ date: 2010-08-31 00:00:00 -04:00
22
21
  default_executable: slurp
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
25
- type: :runtime
26
- prerelease: false
27
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ name: activeresource
25
+ requirement: &id001 !ruby/object:Gem::Requirement
28
26
  none: false
29
27
  requirements:
30
28
  - - "="
31
29
  - !ruby/object:Gem::Version
32
- hash: 7
33
30
  segments:
34
31
  - 3
35
32
  - 0
36
33
  - 0
37
34
  version: 3.0.0
38
- name: activeresource
39
- requirement: *id001
40
- - !ruby/object:Gem::Dependency
41
- type: :development
35
+ type: :runtime
42
36
  prerelease: false
43
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ requirement: &id002 !ruby/object:Gem::Requirement
44
41
  none: false
45
42
  requirements:
46
43
  - - "="
47
44
  - !ruby/object:Gem::Version
48
- hash: 27
49
45
  segments:
50
46
  - 1
51
47
  - 3
52
48
  - 0
53
49
  version: 1.3.0
54
- name: rspec
55
- requirement: *id002
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: *id002
56
53
  description: "\n Slurps stories from the given file (stories.slurper by default) and creates\n Pivotal Tracker stories from them. Useful during story carding sessions\n when you want to capture a number of stories quickly without clicking\n your way through the Tracker UI.\n "
57
54
  email: dev@hashrocket.com
58
55
  executables:
@@ -82,7 +79,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
79
  requirements:
83
80
  - - ">="
84
81
  - !ruby/object:Gem::Version
85
- hash: 3
86
82
  segments:
87
83
  - 0
88
84
  version: "0"
@@ -91,7 +87,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
87
  requirements:
92
88
  - - ">="
93
89
  - !ruby/object:Gem::Version
94
- hash: 23
95
90
  segments:
96
91
  - 1
97
92
  - 3