pickler 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -0
- data/lib/pickler.rb +6 -3
- data/lib/pickler/runner.rb +2 -2
- data/lib/pickler/tracker.rb +8 -4
- data/lib/pickler/tracker/project.rb +4 -0
- data/lib/pickler/tracker/story.rb +12 -5
- data/pickler.gemspec +5 -3
- metadata +59 -16
data/README.rdoc
CHANGED
@@ -53,6 +53,12 @@ Full list of commands.
|
|
53
53
|
|
54
54
|
Further help for a given command.
|
55
55
|
|
56
|
+
== Contributing
|
57
|
+
|
58
|
+
Pull requests will be ignored if they don't follow the Git convention of
|
59
|
+
a 50 character or less subject and optional paragraphs wrapped to 72
|
60
|
+
characters. See http://stopwritingramblingcommitmessages.com/.
|
61
|
+
|
56
62
|
== Disclaimer
|
57
63
|
|
58
64
|
No warranties, expressed or implied.
|
data/lib/pickler.rb
CHANGED
@@ -84,7 +84,10 @@ class Pickler
|
|
84
84
|
|
85
85
|
def parse(story)
|
86
86
|
require 'cucumber'
|
87
|
-
Cucumber::FeatureFile.new(story.url, story.to_s).parse(
|
87
|
+
Cucumber::FeatureFile.new(story.url, story.to_s).parse(
|
88
|
+
Cucumber::Cli::Options.new,
|
89
|
+
{}
|
90
|
+
)
|
88
91
|
end
|
89
92
|
|
90
93
|
def project_id
|
@@ -106,7 +109,7 @@ class Pickler
|
|
106
109
|
|
107
110
|
def scenario_word
|
108
111
|
require 'cucumber'
|
109
|
-
|
112
|
+
Gherkin::I18n::LANGUAGES[@lang]['scenario']
|
110
113
|
end
|
111
114
|
|
112
115
|
def format
|
@@ -121,7 +124,7 @@ class Pickler
|
|
121
124
|
project.stories(scenario_word, :includedone => true).reject do |s|
|
122
125
|
Array(excluded_states).map {|state| state.to_s}.include?(s.current_state)
|
123
126
|
end.select do |s|
|
124
|
-
s.to_s =~ /^\s*#{Regexp.escape(scenario_word)}:/ && parse(s)
|
127
|
+
s.to_s =~ /^\s*#{Regexp.escape(scenario_word)}:/ && parse(s)
|
125
128
|
end
|
126
129
|
end
|
127
130
|
|
data/lib/pickler/runner.rb
CHANGED
@@ -201,11 +201,11 @@ class Pickler
|
|
201
201
|
banner_arguments "<story>"
|
202
202
|
summary "Show details for a story"
|
203
203
|
|
204
|
-
on "--full", "default format" do
|
204
|
+
on "--full", "default format" do |full|
|
205
205
|
@format = :full
|
206
206
|
end
|
207
207
|
|
208
|
-
on "--raw", "same as the .feature" do
|
208
|
+
on "--raw", "same as the .feature" do |raw|
|
209
209
|
@format = :raw
|
210
210
|
end
|
211
211
|
|
data/lib/pickler/tracker.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'cgi'
|
3
|
+
require 'crack/xml'
|
3
4
|
|
4
5
|
class Pickler
|
5
6
|
class Tracker
|
6
7
|
|
7
8
|
ADDRESS = 'www.pivotaltracker.com'
|
8
|
-
BASE_PATH = '/services/
|
9
|
+
BASE_PATH = '/services/v3'
|
9
10
|
SEARCH_KEYS = %w(label type state requester owner mywork id includedone)
|
10
11
|
|
11
12
|
class Error < Pickler::Error; end
|
@@ -13,7 +14,6 @@ class Pickler
|
|
13
14
|
attr_reader :token
|
14
15
|
|
15
16
|
def initialize(token, ssl = false)
|
16
|
-
require 'active_support'
|
17
17
|
@token = token
|
18
18
|
@ssl = ssl
|
19
19
|
end
|
@@ -51,7 +51,7 @@ class Pickler
|
|
51
51
|
def request_xml(method, path, *args)
|
52
52
|
response = request(method,path,*args)
|
53
53
|
raise response.inspect if response["Content-type"].split(/; */).first != "application/xml"
|
54
|
-
hash =
|
54
|
+
hash = Crack::XML.parse(response.body)
|
55
55
|
if hash["message"] && (response.code.to_i >= 400 || hash["success"] == "false")
|
56
56
|
raise Error, hash["message"], caller
|
57
57
|
end
|
@@ -70,7 +70,11 @@ class Pickler
|
|
70
70
|
def initialize(attributes = {})
|
71
71
|
@attributes = {}
|
72
72
|
(attributes || {}).each do |k,v|
|
73
|
-
|
73
|
+
if respond_to?("#{k}=")
|
74
|
+
send("#{k}=", v)
|
75
|
+
else
|
76
|
+
@attributes[k.to_s] = v
|
77
|
+
end
|
74
78
|
end
|
75
79
|
yield self if block_given?
|
76
80
|
end
|
@@ -10,6 +10,10 @@ class Pickler
|
|
10
10
|
super(attributes)
|
11
11
|
end
|
12
12
|
|
13
|
+
def use_https?
|
14
|
+
@attributes['use_https'].to_s == 'true'
|
15
|
+
end
|
16
|
+
|
13
17
|
def story(story_id)
|
14
18
|
raise Error, "No story id given" if story_id.to_s.empty?
|
15
19
|
Story.new(self,tracker.get_xml("/projects/#{id}/stories/#{story_id}")["story"])
|
@@ -12,9 +12,9 @@ class Pickler
|
|
12
12
|
|
13
13
|
def initialize(project, attributes = {})
|
14
14
|
@project = project
|
15
|
+
@labels = []
|
15
16
|
super(attributes)
|
16
17
|
@iteration = Iteration.new(project, @attributes["iteration"]) if @attributes["iteration"]
|
17
|
-
@labels = normalize_labels(@attributes["labels"])
|
18
18
|
end
|
19
19
|
|
20
20
|
def iteration
|
@@ -79,18 +79,21 @@ class Pickler
|
|
79
79
|
project.tracker
|
80
80
|
end
|
81
81
|
|
82
|
-
def to_s(format = :
|
82
|
+
def to_s(format = :tag)
|
83
83
|
to_s = "#{header(format)}\n#{story_type.capitalize}: #{name}\n"
|
84
84
|
description_lines.each do |line|
|
85
85
|
to_s << " #{line}".rstrip << "\n"
|
86
86
|
end
|
87
|
+
if to_s !~ /\A[\0-\177]*\z/
|
88
|
+
to_s = "# -*- coding: utf-8 -*-\n#{to_s}"
|
89
|
+
end
|
87
90
|
to_s
|
88
91
|
end
|
89
92
|
|
90
|
-
def header(format = :
|
93
|
+
def header(format = :tag)
|
91
94
|
case format
|
92
95
|
when :tag
|
93
|
-
"@#{url}#{labels.map {|l| " @#{l.tr('_
|
96
|
+
"@#{url || "#{project.use_https? ? 'https' : 'http'}://www.pivotaltracker.com/story/new"}#{labels.map {|l| " @#{l.tr(' _','_,')}"}.join}"
|
94
97
|
else
|
95
98
|
"# #{url}"
|
96
99
|
end
|
@@ -98,7 +101,7 @@ class Pickler
|
|
98
101
|
|
99
102
|
def to_s=(body)
|
100
103
|
if body =~ /\A@https?\b\S*(\s+@\S+)*\s*$/
|
101
|
-
self.labels = body[/\A@.*/].split(/\s+/)[1..-1].map {|l| l[1..-1].tr('
|
104
|
+
self.labels = body[/\A@.*/].split(/\s+/)[1..-1].map {|l| l[1..-1].tr('_,',' _')}
|
102
105
|
end
|
103
106
|
body = body.sub(/\A(?:[@#].*\n)+/,'')
|
104
107
|
if body =~ /\A(\w+): (.*)/
|
@@ -133,6 +136,10 @@ class Pickler
|
|
133
136
|
@attributes["estimate"].to_i < 0 ? nil : @attributes["estimate"]
|
134
137
|
end
|
135
138
|
|
139
|
+
def estimate=(value)
|
140
|
+
@attributes["estimate"] = value.nil? ? -1 : value
|
141
|
+
end
|
142
|
+
|
136
143
|
def suggested_basename(user_override = nil)
|
137
144
|
if user_override.to_s !~ /\A-?\z/
|
138
145
|
user_override
|
data/pickler.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "pickler"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.6"
|
4
4
|
|
5
5
|
s.summary = "PIvotal traCKer Liaison to cucumbER"
|
6
6
|
s.description = "Synchronize between Cucumber and Pivotal Tracker"
|
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
"lib/pickler/tracker/iteration.rb",
|
24
24
|
"lib/pickler/tracker/note.rb"
|
25
25
|
]
|
26
|
-
s.
|
27
|
-
s.
|
26
|
+
s.add_runtime_dependency("crack", [">= 0.1.8"])
|
27
|
+
s.add_runtime_dependency("cucumber", ["~> 0.8.5"])
|
28
|
+
s.add_development_dependency("rspec", ["~> 1.3.0"])
|
29
|
+
s.add_development_dependency("fakeweb", ["~> 1.2.0"])
|
28
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 6
|
9
|
+
version: 0.1.6
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Tim Pope
|
@@ -9,29 +14,65 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-08-18 00:00:00 -04:00
|
13
18
|
default_executable: pickler
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
name: crack
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 1
|
30
|
+
- 8
|
31
|
+
version: 0.1.8
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: cucumber
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 8
|
44
|
+
- 5
|
45
|
+
version: 0.8.5
|
27
46
|
type: :runtime
|
28
|
-
|
29
|
-
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
30
52
|
requirements:
|
31
|
-
- -
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 1
|
57
|
+
- 3
|
58
|
+
- 0
|
59
|
+
version: 1.3.0
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: fakeweb
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
32
68
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
69
|
+
segments:
|
70
|
+
- 1
|
71
|
+
- 2
|
72
|
+
- 0
|
73
|
+
version: 1.2.0
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
35
76
|
description: Synchronize between Cucumber and Pivotal Tracker
|
36
77
|
email: ruby@tpope.info
|
37
78
|
executables:
|
@@ -66,18 +107,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
107
|
requirements:
|
67
108
|
- - ">="
|
68
109
|
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
69
112
|
version: "0"
|
70
|
-
version:
|
71
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - ">="
|
74
116
|
- !ruby/object:Gem::Version
|
117
|
+
segments:
|
118
|
+
- 0
|
75
119
|
version: "0"
|
76
|
-
version:
|
77
120
|
requirements: []
|
78
121
|
|
79
122
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.3.
|
123
|
+
rubygems_version: 1.3.6
|
81
124
|
signing_key:
|
82
125
|
specification_version: 3
|
83
126
|
summary: PIvotal traCKer Liaison to cucumbER
|