pickler 0.2.0 → 0.2.1
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 +8 -1
- data/lib/pickler/runner.rb +20 -0
- data/lib/pickler/tracker.rb +9 -7
- data/lib/pickler/tracker/iteration.rb +4 -4
- data/lib/pickler/tracker/note.rb +1 -1
- data/lib/pickler/tracker/project.rb +21 -3
- data/lib/pickler/tracker/story.rb +7 -7
- data/pickler.gemspec +5 -4
- data/plugin/pickler.vim +26 -0
- metadata +53 -76
data/README.rdoc
CHANGED
@@ -28,7 +28,8 @@ feature's body. Keep this in mind when entering stories into Pivotal Tracker.
|
|
28
28
|
pickler pull
|
29
29
|
|
30
30
|
Download all well formed stories (basically, any story with "Scenario:" in the
|
31
|
-
body) to the features/
|
31
|
+
body) that are not in the "unstarted" or "unscheduled" state to the features/
|
32
|
+
directory.
|
32
33
|
|
33
34
|
pickler push
|
34
35
|
|
@@ -53,6 +54,12 @@ too).
|
|
53
54
|
|
54
55
|
Push a given feature and change its state to finished.
|
55
56
|
|
57
|
+
pickler install-vim-plugin [<directory>]
|
58
|
+
|
59
|
+
Installs the Vim plugin to <directory>, or ~/.vim/plugin. This plugin
|
60
|
+
currently only provides omnicomplete (CTRL-X, CTRL-O) of feature ids in Git
|
61
|
+
commit messages.
|
62
|
+
|
56
63
|
pickler --help
|
57
64
|
|
58
65
|
Full list of commands.
|
data/lib/pickler/runner.rb
CHANGED
@@ -441,6 +441,26 @@ Requires launchy (gem install launchy).
|
|
441
441
|
end
|
442
442
|
end
|
443
443
|
|
444
|
+
command :install_vim_plugin do
|
445
|
+
banner_arguments "[directory]"
|
446
|
+
summary "install pickler.vim"
|
447
|
+
|
448
|
+
process do |*argv|
|
449
|
+
source = File.expand_path('../../../plugin/pickler.vim', __FILE__)
|
450
|
+
require 'fileutils'
|
451
|
+
directory = argv.first ||
|
452
|
+
if RUBY_PLATFORM =~ /win/i
|
453
|
+
"#{ENV['USERPROFILE']}/vimfiles/plugin"
|
454
|
+
else
|
455
|
+
File.expand_path('~/.vim/plugin')
|
456
|
+
end
|
457
|
+
FileUtils.mkdir_p(directory)
|
458
|
+
FileUtils.cp(source, directory)
|
459
|
+
puts "Installed to #{directory}/pickler.vim."
|
460
|
+
puts "Be sure to keep it up to date!"
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
444
464
|
def initialize(argv)
|
445
465
|
@argv = argv
|
446
466
|
end
|
data/lib/pickler/tracker.rb
CHANGED
@@ -23,7 +23,7 @@ class Pickler
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def http
|
26
|
-
unless @http
|
26
|
+
unless defined?(@http)
|
27
27
|
if ssl?
|
28
28
|
require 'net/https'
|
29
29
|
@http = Net::HTTP.new(ADDRESS, Net::HTTP.https_default_port)
|
@@ -63,10 +63,12 @@ class Pickler
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def project(id)
|
66
|
-
Project.new(self,get_xml("/projects/#{id}")["project"])
|
66
|
+
Project.new(self, lambda { get_xml("/projects/#{id}")["project"] }, id)
|
67
67
|
end
|
68
68
|
|
69
69
|
class Abstract
|
70
|
+
attr_reader :attributes
|
71
|
+
|
70
72
|
def initialize(attributes = {})
|
71
73
|
@attributes = {}
|
72
74
|
(attributes || {}).each do |k,v|
|
@@ -81,14 +83,14 @@ class Pickler
|
|
81
83
|
|
82
84
|
def self.reader(*methods)
|
83
85
|
methods.each do |method|
|
84
|
-
define_method(method) {
|
86
|
+
define_method(method) { attributes[method.to_s] }
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
90
|
def self.date_reader(*methods)
|
89
91
|
methods.each do |method|
|
90
92
|
define_method(method) do
|
91
|
-
value =
|
93
|
+
value = attributes[method.to_s]
|
92
94
|
value.kind_of?(String) ? Date.parse(value) : value
|
93
95
|
end
|
94
96
|
end
|
@@ -97,16 +99,16 @@ class Pickler
|
|
97
99
|
def self.accessor(*methods)
|
98
100
|
reader(*methods)
|
99
101
|
methods.each do |method|
|
100
|
-
define_method("#{method}=") { |v|
|
102
|
+
define_method("#{method}=") { |v| attributes[method.to_s] = v }
|
101
103
|
end
|
102
104
|
end
|
103
105
|
|
104
106
|
def id
|
105
|
-
id =
|
107
|
+
id = attributes['id'] and Integer(id)
|
106
108
|
end
|
107
109
|
|
108
110
|
def to_xml
|
109
|
-
Pickler.hash_to_xml(self.class.name.split('::').last.downcase,
|
111
|
+
Pickler.hash_to_xml(self.class.name.split('::').last.downcase, attributes)
|
110
112
|
end
|
111
113
|
|
112
114
|
end
|
@@ -9,15 +9,15 @@ class Pickler
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def start
|
12
|
-
Date.parse(
|
12
|
+
Date.parse(attributes['start'].to_s)
|
13
13
|
end
|
14
14
|
|
15
15
|
def finish
|
16
|
-
Date.parse(
|
16
|
+
Date.parse(attributes['finish'].to_s)
|
17
17
|
end
|
18
18
|
|
19
19
|
def number
|
20
|
-
|
20
|
+
attributes['number'].to_i
|
21
21
|
end
|
22
22
|
alias to_i number
|
23
23
|
|
@@ -30,7 +30,7 @@ class Pickler
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def succ
|
33
|
-
self.class.new(project, 'number' => number.succ.to_s, 'start' =>
|
33
|
+
self.class.new(project, 'number' => number.succ.to_s, 'start' => attributes['finish'], 'finish' => (finish + (finish - start)))
|
34
34
|
end
|
35
35
|
|
36
36
|
def inspect
|
data/lib/pickler/tracker/note.rb
CHANGED
@@ -5,13 +5,31 @@ class Pickler
|
|
5
5
|
attr_reader :tracker
|
6
6
|
reader :point_scale, :week_start_day, :name, :iteration_length
|
7
7
|
|
8
|
-
def
|
8
|
+
def id
|
9
|
+
id = @id || attributes['id'] and Integer(id)
|
10
|
+
end
|
11
|
+
|
12
|
+
def attributes
|
13
|
+
unless defined?(@attributes)
|
14
|
+
self.class.superclass.instance_method(:initialize).bind(self).call(
|
15
|
+
@attributes_fetcher.call
|
16
|
+
)
|
17
|
+
end
|
18
|
+
@attributes
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(tracker, attributes = {}, id = nil)
|
9
22
|
@tracker = tracker
|
10
|
-
|
23
|
+
if id
|
24
|
+
@attributes_fetcher = attributes
|
25
|
+
@id = id
|
26
|
+
else
|
27
|
+
super(attributes)
|
28
|
+
end
|
11
29
|
end
|
12
30
|
|
13
31
|
def use_https?
|
14
|
-
|
32
|
+
attributes['use_https'].to_s == 'true'
|
15
33
|
end
|
16
34
|
|
17
35
|
def story(story_id)
|
@@ -14,7 +14,7 @@ class Pickler
|
|
14
14
|
@project = project
|
15
15
|
@labels = []
|
16
16
|
super(attributes)
|
17
|
-
@iteration = Iteration.new(project,
|
17
|
+
@iteration = Iteration.new(project, attributes["iteration"]) if attributes["iteration"]
|
18
18
|
end
|
19
19
|
|
20
20
|
def iteration
|
@@ -129,15 +129,15 @@ class Pickler
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def notes
|
132
|
-
[
|
132
|
+
[attributes["notes"]].flatten.compact.map {|n| Note.new(self,n)}
|
133
133
|
end
|
134
134
|
|
135
135
|
def estimate
|
136
|
-
|
136
|
+
attributes["estimate"].to_i < 0 ? nil : @attributes["estimate"]
|
137
137
|
end
|
138
138
|
|
139
139
|
def estimate=(value)
|
140
|
-
|
140
|
+
attributes["estimate"] = value.nil? ? -1 : value
|
141
141
|
end
|
142
142
|
|
143
143
|
def suggested_basename(user_override = nil)
|
@@ -158,10 +158,10 @@ class Pickler
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def to_xml(force_labels = true)
|
161
|
-
hash =
|
161
|
+
hash = attributes.reject do |k,v|
|
162
162
|
!%w(current_state deadline description estimate name owned_by requested_by story_type).include?(k)
|
163
163
|
end
|
164
|
-
if force_labels || !id || normalize_labels(
|
164
|
+
if force_labels || !id || normalize_labels(attributes["labels"]) != labels
|
165
165
|
hash["labels"] = labels.join(", ")
|
166
166
|
end
|
167
167
|
Pickler.hash_to_xml(:story, hash)
|
@@ -171,7 +171,7 @@ class Pickler
|
|
171
171
|
if id
|
172
172
|
response = tracker.request_xml(:delete, "/projects/#{project.id}/stories/#{id}", "")
|
173
173
|
raise Error, response["message"], caller if response["message"]
|
174
|
-
|
174
|
+
attributes["id"] = nil
|
175
175
|
self
|
176
176
|
end
|
177
177
|
end
|
data/pickler.gemspec
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "pickler"
|
3
|
-
s.version = "0.2.
|
3
|
+
s.version = "0.2.1"
|
4
4
|
|
5
5
|
s.summary = "PIvotal traCKer Liaison to cucumbER"
|
6
6
|
s.description = "Synchronize between Cucumber and Pivotal Tracker"
|
7
7
|
s.authors = ["Tim Pope"]
|
8
|
-
s.email = "ruby@tpope.o"+'
|
8
|
+
s.email = "ruby@tpope.o"+'rg'
|
9
9
|
s.homepage = "http://github.com/tpope/pickler"
|
10
|
-
s.default_executable = "pickler"
|
11
10
|
s.executables = ["pickler"]
|
12
11
|
s.files = [
|
13
12
|
"README.rdoc",
|
@@ -21,9 +20,11 @@ Gem::Specification.new do |s|
|
|
21
20
|
"lib/pickler/tracker/project.rb",
|
22
21
|
"lib/pickler/tracker/story.rb",
|
23
22
|
"lib/pickler/tracker/iteration.rb",
|
24
|
-
"lib/pickler/tracker/note.rb"
|
23
|
+
"lib/pickler/tracker/note.rb",
|
24
|
+
"plugin/pickler.vim",
|
25
25
|
]
|
26
26
|
s.add_runtime_dependency("crack", [">= 0.1.8"])
|
27
|
+
s.add_development_dependency("rake", ["~> 0.9.2"])
|
27
28
|
s.add_development_dependency("rspec", ["~> 2.0.0"])
|
28
29
|
s.add_development_dependency("fakeweb", ["~> 1.3.0"])
|
29
30
|
end
|
data/plugin/pickler.vim
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
" pickler.vim - Pivotal Tracker omnicomplete
|
2
|
+
" Maintainer: Tim Pope <http://tpo.pe/>
|
3
|
+
|
4
|
+
if exists("g:loaded_pickler") || v:version < 700 || &cp
|
5
|
+
finish
|
6
|
+
endif
|
7
|
+
let g:loaded_pickler = 1
|
8
|
+
|
9
|
+
function! pickler#omnifunc(findstart,base)
|
10
|
+
if a:findstart
|
11
|
+
let existing = matchstr(getline('.')[0:col('.')-1],'#\d*$')
|
12
|
+
return col('.')-1-strlen(existing)
|
13
|
+
endif
|
14
|
+
let stories = split(system('pickler search --state=started'),"\n")
|
15
|
+
return map(stories,'{"word": "#".matchstr(v:val,"^\\d\\+"), "menu": matchstr(v:val,"^\\d\\+\\s*.. . \\zs.*")}')
|
16
|
+
endfunction
|
17
|
+
|
18
|
+
augroup pickler
|
19
|
+
autocmd!
|
20
|
+
autocmd BufRead *.git/COMMIT_EDITMSG
|
21
|
+
\ if filereadable(substitute(expand('<afile>'),'\.git.\w\+$','features/tracker.yml','')) |
|
22
|
+
\ setlocal omnifunc=pickler#omnifunc |
|
23
|
+
\ endif
|
24
|
+
augroup END
|
25
|
+
|
26
|
+
" vim:set ft=vim sw=2 sts=2:
|
metadata
CHANGED
@@ -1,80 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickler
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Tim Pope
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-26 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: crack
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &71238490 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 11
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 1
|
33
|
-
- 8
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 0.1.8
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rspec
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: *71238490
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &71238200 !ruby/object:Gem::Requirement
|
41
28
|
none: false
|
42
|
-
requirements:
|
29
|
+
requirements:
|
43
30
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.2
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *71238200
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &71237940 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
50
43
|
version: 2.0.0
|
51
44
|
type: :development
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: fakeweb
|
55
45
|
prerelease: false
|
56
|
-
|
46
|
+
version_requirements: *71237940
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: fakeweb
|
49
|
+
requirement: &71237640 !ruby/object:Gem::Requirement
|
57
50
|
none: false
|
58
|
-
requirements:
|
51
|
+
requirements:
|
59
52
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 27
|
62
|
-
segments:
|
63
|
-
- 1
|
64
|
-
- 3
|
65
|
-
- 0
|
53
|
+
- !ruby/object:Gem::Version
|
66
54
|
version: 1.3.0
|
67
55
|
type: :development
|
68
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *71237640
|
69
58
|
description: Synchronize between Cucumber and Pivotal Tracker
|
70
|
-
email: ruby@tpope.
|
71
|
-
executables:
|
59
|
+
email: ruby@tpope.org
|
60
|
+
executables:
|
72
61
|
- pickler
|
73
62
|
extensions: []
|
74
|
-
|
75
63
|
extra_rdoc_files: []
|
76
|
-
|
77
|
-
files:
|
64
|
+
files:
|
78
65
|
- README.rdoc
|
79
66
|
- MIT-LICENSE
|
80
67
|
- pickler.gemspec
|
@@ -87,39 +74,29 @@ files:
|
|
87
74
|
- lib/pickler/tracker/story.rb
|
88
75
|
- lib/pickler/tracker/iteration.rb
|
89
76
|
- lib/pickler/tracker/note.rb
|
90
|
-
|
77
|
+
- plugin/pickler.vim
|
91
78
|
homepage: http://github.com/tpope/pickler
|
92
79
|
licenses: []
|
93
|
-
|
94
80
|
post_install_message:
|
95
81
|
rdoc_options: []
|
96
|
-
|
97
|
-
require_paths:
|
82
|
+
require_paths:
|
98
83
|
- lib
|
99
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
85
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
|
106
|
-
- 0
|
107
|
-
version: "0"
|
108
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
91
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
|
114
|
-
segments:
|
115
|
-
- 0
|
116
|
-
version: "0"
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
117
96
|
requirements: []
|
118
|
-
|
119
97
|
rubyforge_project:
|
120
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.8.6
|
121
99
|
signing_key:
|
122
100
|
specification_version: 3
|
123
101
|
summary: PIvotal traCKer Liaison to cucumbER
|
124
102
|
test_files: []
|
125
|
-
|