pt-flow 2.5.0 → 2.6.0
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.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/pt-flow.rb +1 -0
- data/lib/pt-flow/ui.rb +74 -55
- data/lib/pt-flow/version.rb +1 -1
- data/pt-flow.gemspec +1 -0
- data/spec/lib/pt-flow/ui_spec.rb +10 -4
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8117a7233567e54d42037493ed1806c9df57163
|
4
|
+
data.tar.gz: 1cf77e91f889ffdc846cebf53d35ecf8aa07e258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2664c9045ddde1eafa9174987ea66f167d85777dbba6326f5bb1efa7ad6c88bcfc3e15cafdf8e85464a315aa4eed7f2ddb6eeb76341c3c1001a2b9e91fdb6887
|
7
|
+
data.tar.gz: 75ef19814d4619d8b6da33ef5eac6fbe7240e331332613e6f38b652003e2bc281ad8f4fb9add156c3e0cc681b476a296693a595da8bd0f04d8f4b91d14738c3d
|
data/README.md
CHANGED
@@ -19,8 +19,11 @@ $ git start
|
|
19
19
|
# shows lists of tasks (excluding icebox) - choosing one starts/assigns the task on pt and
|
20
20
|
# automatically creates and checks out a new branch.
|
21
21
|
|
22
|
-
$ git start --
|
23
|
-
# same as git start,
|
22
|
+
$ git start --filter=icebox
|
23
|
+
# same as git start, showing contents of icebox
|
24
|
+
|
25
|
+
$ git start --filter=me
|
26
|
+
# shows only own tasks
|
24
27
|
|
25
28
|
$ git finish
|
26
29
|
# pushes branch, finishes task on pt, and opens new pull request
|
data/lib/pt-flow.rb
CHANGED
data/lib/pt-flow/ui.rb
CHANGED
@@ -6,17 +6,20 @@ module PT::Flow
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def start
|
9
|
+
@options = Trollop::options(@params.dup) do
|
10
|
+
opt :filter, 'Allow filtering tasks', type: :string
|
11
|
+
end
|
12
|
+
|
9
13
|
if @params[0] && !@params[0].start_with?('--')
|
10
14
|
task = create
|
11
15
|
else
|
12
|
-
filter = 'unstarted,started'
|
13
|
-
|
14
|
-
table = TasksTable.new(@project.stories.all(:current_state => filter))
|
16
|
+
filter = filters[@options[:filter]] || { current_state: 'unstarted,started' }
|
17
|
+
table = TasksTable.new @project.stories.all(filter)
|
15
18
|
title("Available tasks in #{project_to_s}")
|
16
19
|
task = select("Please select a task to start working on", table)
|
17
20
|
end
|
18
21
|
estimate_task(task, ask("How many points do you estimate for it? (#{@project.point_scale})")) if task.estimate && task.estimate < 0
|
19
|
-
assign_task(task,
|
22
|
+
assign_task(task, user_name)
|
20
23
|
start_task(task)
|
21
24
|
run("git checkout -b #{Branch.from_task(task)}")
|
22
25
|
end
|
@@ -25,7 +28,7 @@ module PT::Flow
|
|
25
28
|
name = @params[0] || ask("Name for the new story:")
|
26
29
|
types = { 'c' => 'chore', 'b' => 'bug', 'f' => 'feature' }
|
27
30
|
task_type = types[ask('Type? (c)hore, (b)ug, (f)eature')]
|
28
|
-
task = @project.stories.create(name: name, requested_by:
|
31
|
+
task = @project.stories.create(name: name, requested_by: user_name, story_type: task_type)
|
29
32
|
if task.errors.any?
|
30
33
|
error(task.errors.errors)
|
31
34
|
else
|
@@ -35,10 +38,15 @@ module PT::Flow
|
|
35
38
|
end
|
36
39
|
|
37
40
|
def finish
|
41
|
+
@options = Trollop::options(@params.dup) do
|
42
|
+
opt :deliver, 'Merge branch automatically'
|
43
|
+
opt :wip, 'submits [WIP] pull request'
|
44
|
+
end
|
45
|
+
|
38
46
|
run "git push origin #{branch} -u"
|
39
|
-
if @
|
47
|
+
if @options[:deliver]
|
40
48
|
deliver!
|
41
|
-
elsif @
|
49
|
+
elsif @options[:wip]
|
42
50
|
open_url pull_request_url('[WIP]')
|
43
51
|
else
|
44
52
|
finish_task current_task
|
@@ -67,64 +75,75 @@ module PT::Flow
|
|
67
75
|
|
68
76
|
private
|
69
77
|
|
70
|
-
|
71
|
-
|
72
|
-
|
78
|
+
def branch
|
79
|
+
@branch ||= Branch.current
|
80
|
+
end
|
73
81
|
|
74
|
-
|
75
|
-
|
76
|
-
|
82
|
+
def repo
|
83
|
+
@repo ||= Repo.new
|
84
|
+
end
|
77
85
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
def assign_task(task, owner)
|
87
|
+
result = @client.assign_task(@project, task, owner)
|
88
|
+
if result.errors.any?
|
89
|
+
error(result.errors.errors)
|
90
|
+
else
|
91
|
+
congrats("Task assigned to #{owner}")
|
92
|
+
end
|
84
93
|
end
|
85
|
-
end
|
86
94
|
|
87
|
-
|
88
|
-
|
89
|
-
|
95
|
+
def current_task
|
96
|
+
PivotalTracker::Story.find(branch.task_id, @project.id)
|
97
|
+
end
|
90
98
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
99
|
+
def task_title
|
100
|
+
task_title = current_task.name.gsub('"',"'") + " [Delivers ##{current_task.id}]"
|
101
|
+
task_title = 'Bugfix: ' + task_title if current_task.story_type == 'bug'
|
102
|
+
task_title
|
103
|
+
end
|
96
104
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
105
|
+
def pull_request_url(prefix = nil)
|
106
|
+
title = URI.escape "#{prefix} #{task_title}".strip
|
107
|
+
repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{title}"
|
108
|
+
end
|
101
109
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
110
|
+
def deliver!
|
111
|
+
run "hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\""
|
112
|
+
finished_branch = branch
|
113
|
+
title = task_title
|
114
|
+
run "git checkout #{finished_branch.target}"
|
115
|
+
run "git pull"
|
116
|
+
run "git merge #{finished_branch} --no-ff -m \"#{title}\""
|
117
|
+
run "git push origin #{finished_branch.target}"
|
118
|
+
end
|
111
119
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
120
|
+
def open_url(url)
|
121
|
+
if ENV['BROWSER'] == 'echo'
|
122
|
+
title url
|
123
|
+
else
|
124
|
+
run "open \"#{url}\""
|
125
|
+
end
|
117
126
|
end
|
118
|
-
end
|
119
127
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
128
|
+
def run(command)
|
129
|
+
title(command)
|
130
|
+
error("Error running: #{command}") unless system(command)
|
131
|
+
end
|
124
132
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
133
|
+
def error(*msg)
|
134
|
+
super
|
135
|
+
exit(false)
|
136
|
+
end
|
137
|
+
|
138
|
+
def filters
|
139
|
+
{
|
140
|
+
'icebox' => { current_state: 'unscheduled' },
|
141
|
+
'me' => { current_state: 'unstarted,started', owner: user_name }
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
def user_name
|
146
|
+
@local_config[:user_name]
|
147
|
+
end
|
129
148
|
end
|
130
149
|
end
|
data/lib/pt-flow/version.rb
CHANGED
data/pt-flow.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency 'pivotal-tracker'
|
21
21
|
gem.add_dependency 'activesupport'
|
22
22
|
gem.add_dependency 'hirb-colors'
|
23
|
+
gem.add_dependency 'trollop', '~> 2.1'
|
23
24
|
|
24
25
|
gem.add_development_dependency 'rspec', '~> 2.9'
|
25
26
|
gem.add_development_dependency 'webmock'
|
data/spec/lib/pt-flow/ui_spec.rb
CHANGED
@@ -73,14 +73,20 @@ module PT::Flow
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
context 'given
|
77
|
-
|
76
|
+
context 'given various filters' do
|
77
|
+
before do
|
78
78
|
prompt.should_receive(:ask).with("Please select a task to start working on (1-14, 'q' to exit)".bold).and_return('2')
|
79
79
|
prompt.should_receive(:ask).with("How many points do you estimate for it? (0,1,2,3)".bold).and_return('3')
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
+
it "it allows showing icebox contents" do
|
83
|
+
UI.new('start', ['--filter=icebox'])
|
84
|
+
WebMock.should have_requested(:get, "#{endpoint}/projects/102622/stories?filter=current_state:unscheduled")
|
85
|
+
end
|
82
86
|
|
83
|
-
|
87
|
+
it "it allows showing your own tasks" do
|
88
|
+
UI.new('start', ['--filter=me'])
|
89
|
+
WebMock.should have_requested(:get, "#{endpoint}/projects/102622/stories?filter=current_state:unstarted,started+owner:Jon+Mischo")
|
84
90
|
end
|
85
91
|
end
|
86
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pt-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Balvig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pt
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: trollop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.1'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
198
|
version: '0'
|
185
199
|
requirements: []
|
186
200
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.4.
|
201
|
+
rubygems_version: 2.4.5
|
188
202
|
signing_key:
|
189
203
|
specification_version: 4
|
190
204
|
summary: Some extra methods for the pt gem to use in our dev flow.
|