pt-flow 2.3.3 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3417f0205e095a48916e3d0f552cf5f3d0bbc0f0
4
- data.tar.gz: fbd919c18003139a2e80183e926e8a5f323864ec
3
+ metadata.gz: 77fb3dc8e8d07bdfbaf223f39de7e54a65e4e438
4
+ data.tar.gz: 9d69c63af251e2b325f57194b3dbfb17bb4ea3d3
5
5
  SHA512:
6
- metadata.gz: 60bf3a5a51ba64f18a5bc0d3b57901e898422b82da97bea867c779d52bec36b8a3ef6cb09fecf7dde39a65488f99e36194943e2b77ccb379cba3a18547f0de46
7
- data.tar.gz: 5e23a328a5638bde3323fe49df738bd52a57b2feac5c629a24adc7a6f7fe332f9153afdcf6b00524b3fa135aa6598a6f81cbcf089253c8ac0ffe202d19b711a6
6
+ metadata.gz: 868f82165f1cf1079feb7edbce03e775150eefa48f994ca35f67f81a05717a6bdd254275134db825e49045e6388df03eedf243e9c2a88c79759ac039a05e2640
7
+ data.tar.gz: b51f189779b071d1f2af038c382070a68420dc8f7789fed2654f3720d5ee266a633e8621b1db020d6dc4d648d78e041a01f3623552b537e14faea7b341f7b07d
data/README.md CHANGED
@@ -23,13 +23,10 @@ $ git start --include-icebox
23
23
  # same as git start, including contents of icebox
24
24
 
25
25
  $ git finish
26
- # pushes branch, finishes task on pt, and creates a pull request
26
+ # pushes branch, finishes task on pt, and opens new pull request
27
27
  # reviewer comments :+1: to approve on github
28
28
  # committer presses merge button on github which delivers task on pivotal tracker
29
29
 
30
- $ git finish --draft
31
- # Opens github pull request screen rather than auto-submitting
32
-
33
30
  $ git cleanup
34
31
  # cleans up local/remote story branches already merged with current release branch
35
32
  ```
@@ -35,10 +35,13 @@ module PT::Flow
35
35
  end
36
36
 
37
37
  def finish
38
- run("git push origin #{branch} -u")
39
- pull_request
40
- finish_task(current_task)
41
- deliver! if @params.include?('--deliver')
38
+ run "git push origin #{branch} -u"
39
+ finish_task current_task
40
+ if @params.include?('--deliver')
41
+ deliver!
42
+ else
43
+ open_url draft_pr_url
44
+ end
42
45
  end
43
46
 
44
47
  def cleanup
@@ -89,16 +92,12 @@ module PT::Flow
89
92
  task_title
90
93
  end
91
94
 
92
- def pull_request
93
- if @params.include?('--draft')
94
- pr_url = repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{URI.escape(task_title)}"
95
- run "open \"#{pr_url}\""
96
- else
97
- run("hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\"")
98
- end
95
+ def draft_pr_url
96
+ repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{URI.escape(task_title)}"
99
97
  end
100
98
 
101
99
  def deliver!
100
+ run "hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\""
102
101
  finished_branch = branch
103
102
  title = task_title
104
103
  run "git checkout #{finished_branch.target}"
@@ -107,6 +106,14 @@ module PT::Flow
107
106
  run "git push origin #{finished_branch.target}"
108
107
  end
109
108
 
109
+ def open_url(url)
110
+ if ENV['BROWSER'] == 'echo'
111
+ title url
112
+ else
113
+ run "open \"#{url}\""
114
+ end
115
+ end
116
+
110
117
  def run(command)
111
118
  title(command)
112
119
  error("Error running: #{command}") unless system(command)
@@ -1,5 +1,5 @@
1
1
  module PT
2
2
  module Flow
3
- VERSION = '2.3.3'
3
+ VERSION = '2.4.0'
4
4
  end
5
5
  end
@@ -97,9 +97,10 @@ module PT::Flow
97
97
  end
98
98
 
99
99
  context 'no options' do
100
- it "pushes the current branch to origin, flags the story as finished, and opens a github pull request" do
100
+ it "pushes the current branch to origin, flags the story as finished, and opens github pull request URL" do
101
+ ENV['BROWSER'] = ''
101
102
  UI.any_instance.should_receive(:run).with('git push origin new_feature.this-is-for-comments.4460038 -u')
102
- UI.any_instance.should_receive(:run).with("hub pull-request -b new_feature -h cookpad:new_feature.this-is-for-comments.4460038 -m \"This is for comments [Delivers #4460038]\"")
103
+ UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=This%20is%20for%20comments%20[Delivers%20%234460038]\"")
103
104
  UI.new('finish')
104
105
  current_branch.should == 'new_feature.this-is-for-comments.4460038'
105
106
  WebMock.should have_requested(:put, "#{endpoint}/projects/102622/stories/4460038").with(body: /<current_state>finished<\/current_state>/)
@@ -117,14 +118,6 @@ module PT::Flow
117
118
  UI.new('finish', ['--deliver'])
118
119
  end
119
120
  end
120
-
121
- context 'given option --draft' do
122
- it "pushes the current branch to origin, flags the story as finished, and opens github pull request URL" do
123
- UI.any_instance.should_receive(:run).with('git push origin new_feature.this-is-for-comments.4460038 -u')
124
- UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=This%20is%20for%20comments%20[Delivers%20%234460038]\"")
125
- UI.new('finish', ['--draft'])
126
- end
127
- end
128
121
  end
129
122
  end
130
123
 
@@ -140,7 +133,7 @@ module PT::Flow
140
133
 
141
134
  it "pushes the current branch to origin, flags the story as finished, and opens a github pull request" do
142
135
  UI.any_instance.should_receive(:run).with('git push origin new_feature.this-is-for-comments.4460038 -u')
143
- UI.any_instance.should_receive(:run).with("hub pull-request -b new_feature -h balvig:new_feature.this-is-for-comments.4460038 -m \"This is for comments [Delivers #4460038]\"")
136
+ UI.any_instance.should_receive(:run).with("open \"https://github.com/balvig/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=This%20is%20for%20comments%20[Delivers%20%234460038]\"")
144
137
  UI.new('finish')
145
138
  end
146
139
  end
@@ -154,7 +147,7 @@ module PT::Flow
154
147
 
155
148
  it "prepends title with Bugfix: " do
156
149
  UI.any_instance.should_receive(:run).with('git push origin master.this-is-a-bug.4492080 -u')
157
- UI.any_instance.should_receive(:run).with("hub pull-request -b master -h cookpad:master.this-is-a-bug.4492080 -m \"Bugfix: This is a bug [Delivers #4492080]\"")
150
+ UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/master...master.this-is-a-bug.4492080?expand=1&title=Bugfix:%20This%20is%20a%20bug%20[Delivers%20%234492080]\"")
158
151
  UI.new('finish')
159
152
  end
160
153
  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.3.3
4
+ version: 2.4.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-02-11 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pt
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.2.2
187
+ rubygems_version: 2.4.3
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Some extra methods for the pt gem to use in our dev flow.