git_helper 3.3.7 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa8dfc9e8dff01f688d1f18ac2db60d0f0d9c193ad9ad1a5d91ab54fa7e2cb47
4
- data.tar.gz: ed55743cbc0291c9058e8639c8b426d7201e5152d8f7f54c146df614a5cc154b
3
+ metadata.gz: ffcb2655eb57e6b7a6ea293fa815ecfcc4d4eb52bfdd8eb4a003ce5f7e0ed5a2
4
+ data.tar.gz: c3d0bbc2018ecf87cd486331e7d7643409c57b083d2b41ecfdc96bdf3bb9fcd8
5
5
  SHA512:
6
- metadata.gz: d412a23d9fb0daf6798fd0a364c536451361e3d195925e411b0ff2022ae0d2390f422f1fbcc2f83ce8830e38aa3371a76c10bea381cc565d9418c6b0a8ebdfda
7
- data.tar.gz: b7eab53f9e11d32d058f9d9b52a05ef7e87e08288ddd115c2011f937c4ccd6a6e1a5e83c2eab9cc85b6488a1f5d727d2945822c254212ac02284d0c8b1748bd6
6
+ metadata.gz: acc45c11fb46082119da17cfbf66d5baddd4c45e5c9d0757abc9cf2537f3b0a5067b025da48c4a34bd5dee5b137bb241245b6d2a746aa4d263d29e4fc852a79c
7
+ data.tar.gz: 2daef5b537909e00ab2c978e42367ab00c49c400bfe044caa1d0a940a8c2c790d14b3832033119b34c3006d919fea85dee810d216d1149f1815fb19bca1e7094
data/Gemfile.lock CHANGED
@@ -1,46 +1,55 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_helper (3.3.7)
4
+ git_helper (3.5.1.pre.test)
5
5
  gitlab (~> 4.16)
6
6
  gli (~> 2.13)
7
7
  highline_wrapper (~> 1.1)
8
8
  octokit (~> 4.18)
9
- psych (< 4)
10
9
 
11
10
  GEM
12
11
  remote: https://rubygems.org/
13
12
  specs:
14
- addressable (2.7.0)
13
+ addressable (2.8.0)
15
14
  public_suffix (>= 2.0.2, < 5.0)
16
15
  ast (2.4.2)
17
16
  coderay (1.1.3)
18
- concurrent-ruby (1.1.8)
17
+ concurrent-ruby (1.1.9)
19
18
  diff-lcs (1.4.4)
20
- faker (2.17.0)
19
+ faker (2.18.0)
21
20
  i18n (>= 1.6, < 2)
22
- faraday (1.4.1)
21
+ faraday (1.7.1)
22
+ faraday-em_http (~> 1.0)
23
+ faraday-em_synchrony (~> 1.0)
23
24
  faraday-excon (~> 1.1)
25
+ faraday-httpclient (~> 1.0.1)
24
26
  faraday-net_http (~> 1.0)
25
27
  faraday-net_http_persistent (~> 1.1)
28
+ faraday-patron (~> 1.0)
29
+ faraday-rack (~> 1.0)
26
30
  multipart-post (>= 1.2, < 3)
27
31
  ruby2_keywords (>= 0.0.4)
32
+ faraday-em_http (1.0.0)
33
+ faraday-em_synchrony (1.0.0)
28
34
  faraday-excon (1.1.0)
35
+ faraday-httpclient (1.0.1)
29
36
  faraday-net_http (1.0.1)
30
- faraday-net_http_persistent (1.1.0)
31
- ffi (1.15.0)
32
- formatador (0.2.5)
37
+ faraday-net_http_persistent (1.2.0)
38
+ faraday-patron (1.0.0)
39
+ faraday-rack (1.0.0)
40
+ ffi (1.15.3)
41
+ formatador (0.3.0)
33
42
  gitlab (4.17.0)
34
43
  httparty (~> 0.18)
35
44
  terminal-table (~> 1.5, >= 1.5.1)
36
- gli (2.20.0)
37
- guard (2.16.2)
45
+ gli (2.20.1)
46
+ guard (2.18.0)
38
47
  formatador (>= 0.2.4)
39
48
  listen (>= 2.7, < 4.0)
40
49
  lumberjack (>= 1.0.12, < 2.0)
41
50
  nenv (~> 0.1)
42
51
  notiffany (~> 0.0)
43
- pry (>= 0.9.12)
52
+ pry (>= 0.13.0)
44
53
  shellany (~> 0.0)
45
54
  thor (>= 0.18.1)
46
55
  guard-compat (1.2.1)
@@ -49,21 +58,21 @@ GEM
49
58
  guard-compat (~> 1.1)
50
59
  rspec (>= 2.99.0, < 4.0)
51
60
  highline (2.0.3)
52
- highline_wrapper (1.1.0)
61
+ highline_wrapper (1.3.0)
53
62
  highline (~> 2.0)
54
63
  httparty (0.18.1)
55
64
  mime-types (~> 3.0)
56
65
  multi_xml (>= 0.5.2)
57
66
  i18n (1.8.10)
58
67
  concurrent-ruby (~> 1.0)
59
- listen (3.5.1)
68
+ listen (3.6.0)
60
69
  rb-fsevent (~> 0.10, >= 0.10.3)
61
70
  rb-inotify (~> 0.9, >= 0.9.10)
62
71
  lumberjack (1.2.8)
63
72
  method_source (1.0.0)
64
73
  mime-types (3.3.1)
65
74
  mime-types-data (~> 3.2015)
66
- mime-types-data (3.2021.0225)
75
+ mime-types-data (3.2021.0901)
67
76
  multi_xml (0.6.0)
68
77
  multipart-post (2.1.1)
69
78
  nenv (0.3.0)
@@ -74,16 +83,14 @@ GEM
74
83
  faraday (>= 0.9)
75
84
  sawyer (~> 0.8.0, >= 0.5.3)
76
85
  parallel (1.20.1)
77
- parser (3.0.1.1)
86
+ parser (3.0.2.0)
78
87
  ast (~> 2.4.1)
79
88
  pry (0.14.1)
80
89
  coderay (~> 1.1)
81
90
  method_source (~> 1.0)
82
- psych (3.3.2)
83
91
  public_suffix (4.0.6)
84
92
  rainbow (3.0.0)
85
- rake (13.0.3)
86
- rb-fsevent (0.10.4)
93
+ rb-fsevent (0.11.0)
87
94
  rb-inotify (0.10.1)
88
95
  ffi (~> 1.0)
89
96
  regexp_parser (2.1.1)
@@ -101,19 +108,19 @@ GEM
101
108
  diff-lcs (>= 1.2.0, < 2.0)
102
109
  rspec-support (~> 3.10.0)
103
110
  rspec-support (3.10.2)
104
- rubocop (1.14.0)
111
+ rubocop (1.18.4)
105
112
  parallel (~> 1.10)
106
113
  parser (>= 3.0.0.0)
107
114
  rainbow (>= 2.2.2, < 4.0)
108
115
  regexp_parser (>= 1.8, < 3.0)
109
116
  rexml
110
- rubocop-ast (>= 1.5.0, < 2.0)
117
+ rubocop-ast (>= 1.8.0, < 2.0)
111
118
  ruby-progressbar (~> 1.7)
112
119
  unicode-display_width (>= 1.4.0, < 3.0)
113
- rubocop-ast (1.5.0)
120
+ rubocop-ast (1.9.0)
114
121
  parser (>= 3.0.1.1)
115
122
  ruby-progressbar (1.11.0)
116
- ruby2_keywords (0.0.4)
123
+ ruby2_keywords (0.0.5)
117
124
  sawyer (0.8.2)
118
125
  addressable (>= 2.3.5)
119
126
  faraday (> 0.8, < 2.0)
@@ -132,9 +139,8 @@ DEPENDENCIES
132
139
  git_helper!
133
140
  guard-rspec (~> 4.3)
134
141
  pry (~> 0.13)
135
- rake (~> 13.0)
136
142
  rspec (~> 3.9)
137
143
  rubocop (~> 1.10)
138
144
 
139
145
  BUNDLED WITH
140
- 2.2.17
146
+ 2.2.25
data/Guardfile CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  guard :rspec, cmd: 'bundle exec rspec', all_on_start: true do
4
4
  watch(%r{^spec/.+_spec\.rb$})
5
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
6
6
  watch('spec/spec_helper.rb') { 'spec' }
7
7
  end
data/LICENSE.md ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause "New" or "Revised" License
2
+
3
+ Copyright (c) 2020 Emma Sax.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions, and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions, and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Git Helper [![Main](https://github.com/emmahsax/git_helper/actions/workflows/main.yml/badge.svg)](https://github.com/emmahsax/git_helper/actions/workflows/main.yml)
1
+ # Git Helper
2
2
 
3
3
  ## Gem Usage
4
4
 
@@ -127,7 +127,7 @@ The command will provide an autogenerated code request title based on your branc
127
127
 
128
128
  The command will also ask you if the default branch of the repository is the proper base branch to use. You can say 'yes' or 'no'. If you respond 'no', then you can give the command your chosen base base.
129
129
 
130
- If your project uses GitLab, the command will potentially ask you if you'd like to delete the source branch upon merge. If the project defaults to deleting the source branch, then the script will use that selection, and the value can be changed for a specific MR either over the API or in the browser. If the project just provides source branch deletion as on option, then it'll ask the user. It also will probably ask you if you'd like to squash the MR upon merge. If the project requires or prevents squashing, then whatever answer you give will be _*ignored*_. This is unfortunate, but is here due to limited API functionality.
130
+ If your project uses GitLab, the command will potentially ask you if you'd like to delete the source branch upon merge. If the project defaults to deleting the source branch, then the script will use that selection, and the value can be changed for a specific MR either over the API or in the browser. If the project just provides source branch deletion as on option, then it'll ask the user. If the project has allowed squashing, but doesn't default it, then the code will ask the user whether to squash the merge request. If the project has set merge requests to require squashing, prevent squashing, or sets the project to default to squashing, then the code will skip a squash question. If default squashing is set, then the code will set the merge request to squash, and the user can change that over the API or in the browser.
131
131
 
132
132
  Lastly, it'll ask about code request templates. For GitHub, it'll ask the user to apply any pull request templates found at `.github/pull_request_template.md`, `./pull_request_template.md`, or `.github/PULL_REQUEST_TEMPLATE/*.md`. Applying any template is optional, and a user can make an empty pull request if they desire. For GitLab, it'll ask the user to apply any merge request templates found at any `.gitlab/merge_request_template.md`, `./merge_request_template.md`, or `.gitlab/merge_request_templates/*.md`. Applying any template is optional, and from the command's standpoint, a user can make an empty merge request if they desire (although GitLab may still add a merge request template if the project itself requires one). When searching for templates, the code ignores cases, so the file could be named with all capital letters or all lowercase letters.
133
133
 
@@ -176,15 +176,27 @@ git-helper new-branch NEW_BRANCH_NAME
176
176
 
177
177
  The command either accepts a branch name right away or it will ask you for the name of your new branch. Make sure your input does not contain any spaces or special characters.
178
178
 
179
- ## Contributing
179
+ ---
180
180
 
181
- To submit a feature request, bug ticket, etc, please submit an official [GitHub Issue](https://github.com/emmahsax/git_helper/issues/new).
181
+ ### Contributing
182
182
 
183
- To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/emmahsax/git_helper/security/policy).
183
+ To submit a feature request, bug ticket, etc, please submit an official [GitHub issue](https://github.com/emmahsax/git_helper/issues/new). To copy or make changes, please [fork this repository](https://github.com/emmahsax/git_helper/fork). When/if you'd like to contribute back to this upstream, please create a pull request on this repository.
184
+
185
+ Please follow included Issue Template(s) and Pull Request Template(s) when creating issues or pull requests.
186
+
187
+ ### Security Policy
188
+
189
+ To report any security vulnerabilities, please view this repository's [Security Policy](https://github.com/emmahsax/git_helper/security/policy).
190
+
191
+ ### Licensing
192
+
193
+ For information on licensing, please see [LICENSE.md](https://github.com/emmahsax/git_helper/blob/main/LICENSE.md).
194
+
195
+ ### Code of Conduct
184
196
 
185
197
  When interacting with this repository, please follow [Contributor Covenant's Code of Conduct](https://contributor-covenant.org).
186
198
 
187
- ## Releasing
199
+ ### Releasing
188
200
 
189
201
  To make a new release of this gem:
190
202
 
@@ -125,7 +125,17 @@ module GitHelper
125
125
  end
126
126
 
127
127
  private def squash_merge_request
128
- @squash_merge_request ||= highline.ask_yes_no('Squash merge request? (y/n)')
128
+ return @squash_merge_request if @squash_merge_request
129
+
130
+ @squash_merge_request =
131
+ case existing_project.squash_option
132
+ when 'always', 'default_on'
133
+ true
134
+ when 'never'
135
+ false
136
+ else # 'default_off' or anything else
137
+ highline.ask_yes_no('Squash merge request? (y/n)')
138
+ end
129
139
  end
130
140
 
131
141
  private def remove_source_branch
@@ -33,7 +33,7 @@ module GitHelper
33
33
 
34
34
  create_or_update_plugin_files
35
35
  puts "\nNow add this line to your ~/.bash_profile:\n" \
36
- ' export PATH=/path/to/computer/home/.git_helper/plugins:$PATH'
36
+ ' export PATH=/path/to/computer/home/.git_helper/plugins:$PATH'
37
37
  puts "\nDone!"
38
38
  end
39
39
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHelper
4
- VERSION = '3.3.7'
4
+ VERSION = '3.5.1'
5
5
  end
@@ -183,12 +183,39 @@ describe GitHelper::GitLabMergeRequest do
183
183
  end
184
184
 
185
185
  describe '#squash_merge_request' do
186
- it 'should ask the CLI for the code request ID' do
186
+ let(:existing_project) { double(squash_option: 'default_off') }
187
+
188
+ it 'should return true if the squash is set to always on the project' do
189
+ allow(subject).to receive(:existing_project).and_return(existing_project)
190
+ allow(existing_project).to receive(:squash_option).and_return('always')
191
+ expect(highline_wrapper).not_to receive(:ask_yes_no)
192
+ expect(subject.send(:squash_merge_request)).to eq(true)
193
+ end
194
+
195
+ it 'should return true if the squash is set to default_on on the project' do
196
+ allow(subject).to receive(:existing_project).and_return(existing_project)
197
+ allow(existing_project).to receive(:squash_option).and_return('default_on')
198
+ expect(highline_wrapper).not_to receive(:ask_yes_no)
199
+ expect(subject.send(:squash_merge_request)).to eq(true)
200
+ end
201
+
202
+ it 'should return false if the squash is set to never on the project' do
203
+ allow(subject).to receive(:existing_project).and_return(existing_project)
204
+ allow(existing_project).to receive(:squash_option).and_return('never')
205
+ expect(highline_wrapper).not_to receive(:ask_yes_no)
206
+ expect(subject.send(:squash_merge_request)).to eq(false)
207
+ end
208
+
209
+ it 'should ask the user for their response to the squash question' do
210
+ allow(subject).to receive(:existing_project).and_return(existing_project)
211
+ allow(existing_project).to receive(:squash_option).and_return(nil)
187
212
  expect(highline_wrapper).to receive(:ask_yes_no).and_return(true)
188
213
  subject.send(:squash_merge_request)
189
214
  end
190
215
 
191
216
  it 'should be a boolean' do
217
+ allow(subject).to receive(:existing_project).and_return(existing_project)
218
+ allow(existing_project).to receive(:squash_option).and_return(nil)
192
219
  expect(highline_wrapper).to receive(:ask_yes_no).and_return(false)
193
220
  expect([true, false]).to include(subject.send(:squash_merge_request))
194
221
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.7
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emma Sax
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-19 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.18'
69
- - !ruby/object:Gem::Dependency
70
- name: psych
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "<"
74
- - !ruby/object:Gem::Version
75
- version: '4'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "<"
81
- - !ruby/object:Gem::Version
82
- version: '4'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: bundler
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -136,20 +122,6 @@ dependencies:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0.13'
139
- - !ruby/object:Gem::Dependency
140
- name: rake
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '13.0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '13.0'
153
125
  - !ruby/object:Gem::Dependency
154
126
  name: rspec
155
127
  requirement: !ruby/object:Gem::Requirement
@@ -189,7 +161,7 @@ files:
189
161
  - Gemfile
190
162
  - Gemfile.lock
191
163
  - Guardfile
192
- - LICENSE
164
+ - LICENSE.md
193
165
  - README.md
194
166
  - Rakefile
195
167
  - bin/git-helper
@@ -227,7 +199,7 @@ files:
227
199
  - spec/spec_helper.rb
228
200
  homepage: https://github.com/emmahsax/git_helper
229
201
  licenses:
230
- - MIT
202
+ - BSD-3-Clause
231
203
  metadata: {}
232
204
  post_install_message:
233
205
  rdoc_options: []
@@ -244,10 +216,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
216
  - !ruby/object:Gem::Version
245
217
  version: '0'
246
218
  requirements: []
247
- rubygems_version: 3.2.15
219
+ rubygems_version: 3.2.22
248
220
  signing_key:
249
221
  specification_version: 4
250
- summary: A set of GitHub and GitLab workflow scripts.
222
+ summary: A set of GitHub and GitLab workflow scripts
251
223
  test_files:
252
224
  - spec/spec_helper.rb
253
225
  - spec/git_helper/change_remote_spec.rb
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright 2020 Emma Sax
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.