git_reflow 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +35 -35
- data/README.md +7 -3
- data/git_reflow.gemspec +1 -1
- data/lib/git_reflow/config.rb +4 -4
- data/lib/git_reflow/git_server/git_hub.rb +3 -2
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +10 -4
- data/lib/git_reflow/git_server/pull_request.rb +15 -1
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflow.rb +2 -2
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +1 -1
- data/spec/lib/git_reflow/git_server/pull_request_spec.rb +33 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 328d9e72bc031e3fd7adedd2ed882c922937670ba95ac98d8c42f86f9e2ee129
|
4
|
+
data.tar.gz: 6ef4dcd1023199822a01140292c050ebda60d812909b479d9a4a57e0f40c4855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 193cd5e199b43000044f268157acc6c74e5075682d75fb3cd14a495367d99eb7e16565e1ab683a9a74b795bc7ce2acfb0783a191232092ebff6b13a52fb24da3
|
7
|
+
data.tar.gz: c272eb8a4b5fde35215a90b38763daa83bb1b87978ed3b24ee6f3415c02867f0c85e18d0c8ba5751865ebb7ca4008311d60d4c7e1798933e6fc37732340673cd
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_reflow (0.9.
|
4
|
+
git_reflow (0.9.4)
|
5
5
|
bundler (>= 1.10.0)
|
6
6
|
codenamev_bitbucket_api (= 0.4.1)
|
7
7
|
colorize (>= 0.7.0)
|
8
|
-
github_api (= 0.
|
8
|
+
github_api (= 0.19)
|
9
9
|
highline
|
10
10
|
httpclient
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (6.0.3.
|
15
|
+
activesupport (6.0.3.4)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
@@ -33,24 +33,24 @@ GEM
|
|
33
33
|
multi_json (< 2.0)
|
34
34
|
nokogiri (>= 1.5.2)
|
35
35
|
simple_oauth (>= 0.3.0)
|
36
|
-
coderay (1.1.
|
36
|
+
coderay (1.1.3)
|
37
37
|
colorize (0.8.1)
|
38
|
-
concurrent-ruby (1.1.
|
39
|
-
crack (0.4.
|
40
|
-
safe_yaml (~> 1.0.0)
|
38
|
+
concurrent-ruby (1.1.7)
|
39
|
+
crack (0.4.4)
|
41
40
|
descendants_tracker (0.0.4)
|
42
41
|
thread_safe (~> 0.3, >= 0.3.1)
|
43
|
-
diff-lcs (1.
|
44
|
-
faraday (
|
42
|
+
diff-lcs (1.4.4)
|
43
|
+
faraday (1.1.0)
|
45
44
|
multipart-post (>= 1.2, < 3)
|
45
|
+
ruby2_keywords
|
46
46
|
faraday-http-cache (2.2.0)
|
47
47
|
faraday (>= 0.8)
|
48
|
-
faraday_middleware (0.
|
49
|
-
faraday (
|
50
|
-
github_api (0.
|
48
|
+
faraday_middleware (1.0.0)
|
49
|
+
faraday (~> 1.0)
|
50
|
+
github_api (0.19.0)
|
51
51
|
addressable (~> 2.4)
|
52
52
|
descendants_tracker (~> 0.0.4)
|
53
|
-
faraday (
|
53
|
+
faraday (>= 0.8, < 2)
|
54
54
|
hashie (~> 3.5, >= 3.5.2)
|
55
55
|
oauth2 (~> 1.0)
|
56
56
|
github_changelog_generator (1.15.2)
|
@@ -65,16 +65,16 @@ GEM
|
|
65
65
|
hashie (3.6.0)
|
66
66
|
highline (2.0.3)
|
67
67
|
httpclient (2.8.3)
|
68
|
-
i18n (1.8.
|
68
|
+
i18n (1.8.5)
|
69
69
|
concurrent-ruby (~> 1.0)
|
70
|
-
jwt (2.2.
|
70
|
+
jwt (2.2.2)
|
71
71
|
method_source (1.0.0)
|
72
72
|
mini_portile2 (2.4.0)
|
73
|
-
minitest (5.14.
|
74
|
-
multi_json (1.
|
73
|
+
minitest (5.14.2)
|
74
|
+
multi_json (1.15.0)
|
75
75
|
multi_xml (0.6.0)
|
76
76
|
multipart-post (2.1.1)
|
77
|
-
nokogiri (1.10.
|
77
|
+
nokogiri (1.10.10)
|
78
78
|
mini_portile2 (~> 2.4.0)
|
79
79
|
oauth2 (1.4.4)
|
80
80
|
faraday (>= 0.8, < 2.0)
|
@@ -82,7 +82,7 @@ GEM
|
|
82
82
|
multi_json (~> 1.3)
|
83
83
|
multi_xml (~> 0.5)
|
84
84
|
rack (>= 1.2, < 3)
|
85
|
-
octokit (4.
|
85
|
+
octokit (4.19.0)
|
86
86
|
faraday (>= 0.9)
|
87
87
|
sawyer (~> 0.8.0, >= 0.5.3)
|
88
88
|
pry (0.13.1)
|
@@ -91,26 +91,26 @@ GEM
|
|
91
91
|
pry-byebug (3.9.0)
|
92
92
|
byebug (~> 11.0)
|
93
93
|
pry (~> 0.13.0)
|
94
|
-
public_suffix (4.0.
|
95
|
-
rack (2.2.
|
94
|
+
public_suffix (4.0.6)
|
95
|
+
rack (2.2.3)
|
96
96
|
rainbow (3.0.0)
|
97
97
|
rake (13.0.1)
|
98
98
|
rdoc (6.2.1)
|
99
99
|
retriable (3.1.2)
|
100
|
-
rspec (3.
|
101
|
-
rspec-core (~> 3.
|
102
|
-
rspec-expectations (~> 3.
|
103
|
-
rspec-mocks (~> 3.
|
104
|
-
rspec-core (3.
|
105
|
-
rspec-support (~> 3.
|
106
|
-
rspec-expectations (3.
|
100
|
+
rspec (3.10.0)
|
101
|
+
rspec-core (~> 3.10.0)
|
102
|
+
rspec-expectations (~> 3.10.0)
|
103
|
+
rspec-mocks (~> 3.10.0)
|
104
|
+
rspec-core (3.10.0)
|
105
|
+
rspec-support (~> 3.10.0)
|
106
|
+
rspec-expectations (3.10.0)
|
107
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
108
|
-
rspec-support (~> 3.
|
109
|
-
rspec-mocks (3.
|
108
|
+
rspec-support (~> 3.10.0)
|
109
|
+
rspec-mocks (3.10.0)
|
110
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
111
|
-
rspec-support (~> 3.
|
112
|
-
rspec-support (3.
|
113
|
-
|
111
|
+
rspec-support (~> 3.10.0)
|
112
|
+
rspec-support (3.10.0)
|
113
|
+
ruby2_keywords (0.0.2)
|
114
114
|
sawyer (0.8.2)
|
115
115
|
addressable (>= 2.3.5)
|
116
116
|
faraday (> 0.8, < 2.0)
|
@@ -119,12 +119,12 @@ GEM
|
|
119
119
|
thread_safe (0.3.6)
|
120
120
|
tzinfo (1.2.7)
|
121
121
|
thread_safe (~> 0.1)
|
122
|
-
webmock (3.
|
122
|
+
webmock (3.9.3)
|
123
123
|
addressable (>= 2.3.6)
|
124
124
|
crack (>= 0.3.2)
|
125
125
|
hashdiff (>= 0.4.0, < 2.0.0)
|
126
126
|
wwtd (1.4.0)
|
127
|
-
zeitwerk (2.
|
127
|
+
zeitwerk (2.4.1)
|
128
128
|
|
129
129
|
PLATFORMS
|
130
130
|
ruby
|
data/README.md
CHANGED
@@ -443,11 +443,15 @@ If the review is done, it's time to merge. Here's what happens:
|
|
443
443
|
|
444
444
|
In order to streamline delivery you can set the following git config to:
|
445
445
|
|
446
|
-
1. always clean up the feature branch after the PR is merged
|
446
|
+
1. always clean up the remote feature branch after the PR is merged
|
447
447
|
```
|
448
|
-
git config --global --add "reflow.always-cleanup" "true"
|
448
|
+
git config --global --add "reflow.always-cleanup-remote" "true"
|
449
449
|
```
|
450
|
-
2. always
|
450
|
+
2. always clean up the local feature branch after the PR is merged
|
451
|
+
```
|
452
|
+
git config --global --add "reflow.always-cleanup-local" "true"
|
453
|
+
```
|
454
|
+
3. always deliver without further prompt
|
451
455
|
```
|
452
456
|
git config --global --add "reflow.always-deliver" "true"
|
453
457
|
```
|
data/git_reflow.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_dependency('bundler', '>= 1.10.0')
|
33
33
|
s.add_dependency('codenamev_bitbucket_api', '0.4.1')
|
34
34
|
s.add_dependency('colorize', '>= 0.7.0')
|
35
|
-
s.add_dependency('github_api', '0.
|
35
|
+
s.add_dependency('github_api', '0.19')
|
36
36
|
s.add_dependency('highline')
|
37
37
|
s.add_dependency('httpclient')
|
38
38
|
|
data/lib/git_reflow/config.rb
CHANGED
@@ -14,7 +14,7 @@ module GitReflow
|
|
14
14
|
# @option options [Boolean] :all (false) whether to return all keys for a multi-valued key
|
15
15
|
# @option options [Boolean] :local (false) whether to get the value specific to the current project
|
16
16
|
# @return the value of the git configuration
|
17
|
-
def get(key, reload: false, all: false, local: false)
|
17
|
+
def get(key, reload: false, all: false, local: false, **_other_options)
|
18
18
|
return cached_git_config_value(key) unless reload || cached_git_config_value(key).empty?
|
19
19
|
|
20
20
|
local = local ? '--local ' : ''
|
@@ -32,7 +32,7 @@ module GitReflow
|
|
32
32
|
# @param [String] value The value to set it to
|
33
33
|
# @option options [Boolean] :local (false) whether to set the value specific to the current project
|
34
34
|
# @return the value of the git configuration
|
35
|
-
def set(key, value, local: false)
|
35
|
+
def set(key, value, local: false, **_other_options)
|
36
36
|
value = value.to_s.strip
|
37
37
|
if local
|
38
38
|
GitReflow::Sandbox.run "git config --replace-all #{key} \"#{value}\"", loud: false, blocking: false
|
@@ -47,7 +47,7 @@ module GitReflow
|
|
47
47
|
# @option options [Boolean] :value (nil) The value of the key to remove
|
48
48
|
# @option options [Boolean] :local (false) whether to remove the value specific to the current project
|
49
49
|
# @return the result of running the git command
|
50
|
-
def unset(key, value: nil, local: false)
|
50
|
+
def unset(key, value: nil, local: false, **_other_options)
|
51
51
|
value = value.nil? ? '' : "\"#{value}\""
|
52
52
|
if local
|
53
53
|
GitReflow::Sandbox.run "git config --unset-all #{key} #{value}", loud: false, blocking: false
|
@@ -63,7 +63,7 @@ module GitReflow
|
|
63
63
|
# @option options [Boolean] :local (false) whether to set the value specific to the current project
|
64
64
|
# @option options [Boolean] :global (false) whether to set the value globaly. if neither local or global is set gitreflow will default to using a configuration file
|
65
65
|
# @return the result of running the git command
|
66
|
-
def add(key, value, local: false, global: false)
|
66
|
+
def add(key, value, local: false, global: false, **_other_options)
|
67
67
|
if global
|
68
68
|
GitReflow::Sandbox.run "git config --global --add #{key} \"#{value}\"", loud: false, blocking: false
|
69
69
|
elsif local
|
@@ -84,8 +84,9 @@ module GitReflow
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def authenticate(options = {silent: false})
|
87
|
-
|
88
|
-
|
87
|
+
if !options[:user].to_s.empty?
|
88
|
+
self.class.user = options[:user]
|
89
|
+
elsif self.class.user.empty?
|
89
90
|
self.class.user = ask("Please enter your GitHub username: ")
|
90
91
|
end
|
91
92
|
|
@@ -147,13 +147,19 @@ module GitReflow
|
|
147
147
|
GitReflow.run_command_with_label "git pull origin #{self.base_branch_name}"
|
148
148
|
GitReflow.say "Pull request ##{self.number} successfully merged.", :success
|
149
149
|
|
150
|
-
if
|
151
|
-
GitReflow.run_command_with_label "git push origin :#{self.feature_branch_name}"
|
150
|
+
if cleanup_remote_feature_branch?
|
151
|
+
GitReflow.run_command_with_label "git push origin :#{self.feature_branch_name}", blocking: false
|
152
|
+
else
|
153
|
+
GitReflow.say "Skipped. Remote feature branch #{self.feature_branch_name} left in tact."
|
154
|
+
end
|
155
|
+
|
156
|
+
if cleanup_local_feature_branch?
|
152
157
|
GitReflow.run_command_with_label "git branch -D #{self.feature_branch_name}"
|
153
|
-
GitReflow.say "Nice job buddy."
|
154
158
|
else
|
155
|
-
|
159
|
+
GitReflow.say "Skipped. Local feature branch #{self.feature_branch_name} left in tact."
|
156
160
|
end
|
161
|
+
|
162
|
+
GitReflow.say "Nice job buddy."
|
157
163
|
else
|
158
164
|
GitReflow.say merge_response.to_s, :deliver_halted
|
159
165
|
GitReflow.say "There were problems commiting your feature... please check the errors above and try again.", :error
|
@@ -178,7 +178,21 @@ module GitReflow
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def cleanup_feature_branch?
|
181
|
-
|
181
|
+
cleanup_local_feature_branch? || cleanup_remote_feature_branch?
|
182
|
+
end
|
183
|
+
|
184
|
+
def cleanup_local_feature_branch?
|
185
|
+
# backwards compat
|
186
|
+
always_cleanup_local = GitReflow::Config.get('reflow.always-cleanup').to_s
|
187
|
+
always_cleanup_local = GitReflow::Config.get('reflow.always-cleanup-local') if always_cleanup_local.empty?
|
188
|
+
always_cleanup_local == "true" || (ask "Would you like to cleanup your local feature branch? ") =~ /^y/i
|
189
|
+
end
|
190
|
+
|
191
|
+
def cleanup_remote_feature_branch?
|
192
|
+
# backwards compat
|
193
|
+
always_cleanup_remote = GitReflow::Config.get('reflow.always-cleanup').to_s
|
194
|
+
always_cleanup_remote = GitReflow::Config.get('reflow.always-cleanup-remote') if always_cleanup_remote.empty?
|
195
|
+
always_cleanup_remote == "true" || (ask "Would you like to cleanup your remote feature branch? ") =~ /^y/i
|
182
196
|
end
|
183
197
|
|
184
198
|
def deliver?
|
data/lib/git_reflow/version.rb
CHANGED
data/lib/git_reflow/workflow.rb
CHANGED
@@ -132,7 +132,7 @@ module GitReflow
|
|
132
132
|
@workflows
|
133
133
|
end
|
134
134
|
|
135
|
-
# Creates a singleton method on the
|
135
|
+
# Creates a singleton method on the included class
|
136
136
|
#
|
137
137
|
# This method will take any number of keyword parameters. If @defaults keyword is provided, and the given
|
138
138
|
# key(s) in the defaults are not provided as keyword parameters, then it will use the value given in the
|
@@ -230,7 +230,7 @@ module GitReflow
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
# Creates a singleton method on the
|
233
|
+
# Creates a singleton method on the included class
|
234
234
|
#
|
235
235
|
# This method updates the help text associated with the provided command.
|
236
236
|
#
|
@@ -100,7 +100,7 @@ describe GitReflow::GitServer::GitHub::PullRequest do
|
|
100
100
|
context "Testing Nil Comments" do
|
101
101
|
before do
|
102
102
|
stub_request(:get, "https://api.github.com/repos/reenhanced/repo/pulls/2/comments?access_token=a1b2c3d4e5f6g7h8i9j0").
|
103
|
-
with(:headers => {'Accept'=>'application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1', 'Accept-Charset'=>'utf-8', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'token a1b2c3d4e5f6g7h8i9j0', 'User-Agent'=>'Github API Ruby Gem 0.
|
103
|
+
with(:headers => {'Accept'=>'application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1', 'Accept-Charset'=>'utf-8', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'token a1b2c3d4e5f6g7h8i9j0', 'User-Agent'=>'Github API Ruby Gem 0.19.0'}).
|
104
104
|
to_return(:status => 200, :body => "", :headers => {})
|
105
105
|
|
106
106
|
FakeGitHub.new(
|
@@ -491,14 +491,42 @@ describe GitReflow::GitServer::PullRequest do
|
|
491
491
|
allow(GitReflow::Config).to receive(:get).with('reflow.always-cleanup').and_return('false')
|
492
492
|
end
|
493
493
|
|
494
|
-
context "and
|
495
|
-
|
494
|
+
context "and always cleanup local config is set" do
|
495
|
+
end
|
496
|
+
|
497
|
+
context "and always cleanup remote config is set" do
|
498
|
+
end
|
499
|
+
|
500
|
+
context "and user chooses to cleanup local only" do
|
501
|
+
before do
|
502
|
+
expect(pr).to receive(:ask).with('Would you like to cleanup your local feature branch? ').and_return('yes')
|
503
|
+
allow(pr).to receive(:ask).with('Would you like to cleanup your remote feature branch? ').and_return('no')
|
504
|
+
end
|
505
|
+
it { should be_truthy }
|
506
|
+
end
|
507
|
+
|
508
|
+
context "and user chooses to cleanup remote only" do
|
509
|
+
before do
|
510
|
+
expect(pr).to receive(:ask).with('Would you like to cleanup your local feature branch? ').and_return('no')
|
511
|
+
expect(pr).to receive(:ask).with('Would you like to cleanup your remote feature branch? ').and_return('yes')
|
512
|
+
end
|
496
513
|
it { should be_truthy }
|
497
514
|
end
|
498
515
|
|
499
|
-
context "and user chooses
|
500
|
-
before
|
501
|
-
|
516
|
+
context "and user chooses to cleanup local and remote" do
|
517
|
+
before do
|
518
|
+
allow(pr).to receive(:ask).with('Would you like to cleanup your local feature branch? ').and_return('yes')
|
519
|
+
allow(pr).to receive(:ask).with('Would you like to cleanup your remote feature branch? ').and_return('yes')
|
520
|
+
end
|
521
|
+
it { should be_truthy }
|
522
|
+
end
|
523
|
+
|
524
|
+
context "and user chooses to cleanup neither local nor remote" do
|
525
|
+
before do
|
526
|
+
expect(pr).to receive(:ask).with('Would you like to cleanup your local feature branch? ').and_return('no')
|
527
|
+
allow(pr).to receive(:ask).with('Would you like to cleanup your remote feature branch? ').and_return('no')
|
528
|
+
end
|
529
|
+
it { should be_falsey }
|
502
530
|
end
|
503
531
|
end
|
504
532
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_reflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentino Stoll
|
8
8
|
- Robert Stern
|
9
9
|
- Nicholas Hance
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|
@@ -186,14 +186,14 @@ dependencies:
|
|
186
186
|
requirements:
|
187
187
|
- - '='
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: 0.
|
189
|
+
version: '0.19'
|
190
190
|
type: :runtime
|
191
191
|
prerelease: false
|
192
192
|
version_requirements: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
194
|
- - '='
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version: 0.
|
196
|
+
version: '0.19'
|
197
197
|
- !ruby/object:Gem::Dependency
|
198
198
|
name: highline
|
199
199
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
336
|
version: '0'
|
337
337
|
requirements: []
|
338
338
|
rubygems_version: 3.1.2
|
339
|
-
signing_key:
|
339
|
+
signing_key:
|
340
340
|
specification_version: 4
|
341
341
|
summary: A better git process
|
342
342
|
test_files:
|