git_helper 3.3.4 → 3.4.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: 8dc9aca4ddec9f8038f5083b2790b10ac48b8293de15c37fb8a153b76ca0ce23
4
- data.tar.gz: e2be8c7950de2fe93e7b44b0b3c50118dd8bd34494237f435c69cdbc775ef7e9
3
+ metadata.gz: 295a48c82962b1acd95510653a2c7430ef50c3773d0cd2da78d55d0f428e6dd0
4
+ data.tar.gz: 72d909f998d63f307487d278f365fd14d6380d213f10fe11f6cf1b0f7f07ba64
5
5
  SHA512:
6
- metadata.gz: '029e8998214a94ff639bed8faa0a90bf94eca320a7989effab17b845918df911718512f40dd74e563faf347162723fb9e39b9a02ba0b20477183f4eb4b1d1d71'
7
- data.tar.gz: ef184720792c6dc8f361674eabdf7e9972e905f2c835b06ecbbe4b952bdd9eab94c42e644663b6be38222688982c8ff2b0fc958a6899b9eb0a2c3ce2afb77547
6
+ metadata.gz: aafbbfdda563a9a5c3086c1d393564993c8856900e32b3444ba9ddef8ff01f4ef5d919f4108f3a4fceebb94de3f963d5f98e7aa02c66d9157643ce91f1c3ead4
7
+ data.tar.gz: 50b732f26e32581cf9a33de9398a00c54e75aa8eebb600d73e59f07218dc26e5aa3cf5e9339830b9fefe876180bc86f2eca877cf7fe238397c0a84764514b3ba
data/LICENSE.md ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2020 Emma Sax. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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 [![Main](https://github.com/emmahsax/git_helper/actions/workflows/main.yml/badge.svg)](https://github.com/emmahsax/git_helper/actions/workflows/main.yml)
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,25 @@ 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
+
181
+ ### Contributing
180
182
 
181
183
  To submit a feature request, bug ticket, etc, please submit an official [GitHub Issue](https://github.com/emmahsax/git_helper/issues/new).
182
184
 
183
- To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/emmahsax/git_helper/security/policy).
185
+ ### Security Policy
186
+
187
+ To report any security vulnerabilities, please view this repository's [Security Policy](https://github.com/emmahsax/git_helper/security/policy).
188
+
189
+ ### Licensing
190
+
191
+ For information on licensing, please see [LICENSE.md](https://github.com/emmahsax/git_helper/blob/main/LICENSE.md).
192
+
193
+ ### Code of Conduct
184
194
 
185
195
  When interacting with this repository, please follow [Contributor Covenant's Code of Conduct](https://contributor-covenant.org).
186
196
 
187
- ## Releasing
197
+ ### Releasing
188
198
 
189
199
  To make a new release of this gem:
190
200
 
@@ -125,7 +125,16 @@ 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
+ case existing_project.squash_option
131
+ when 'always', 'default_on'
132
+ @squash_merge_request = true
133
+ when 'never'
134
+ @squash_merge_request = false
135
+ else # 'default_off' or anything else
136
+ @squash_merge_request = highline.ask_yes_no('Squash merge request? (y/n)')
137
+ end
129
138
  end
130
139
 
131
140
  private def remove_source_branch
@@ -4,7 +4,7 @@ module GitHelper
4
4
  class NewBranch
5
5
  def execute(new_branch_name = nil)
6
6
  branch_name = new_branch_name || HighlineWrapper.new.ask('New branch name?', { required: true })
7
- puts "Attempting to create a new branch: #{branch_name}\n\n"
7
+ puts "Attempting to create a new branch: #{branch_name}"
8
8
  GitHelper::LocalCode.new.new_branch(branch_name)
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHelper
4
- VERSION = '3.3.4'
4
+ VERSION = '3.4.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.4
4
+ version: 3.4.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-03-06 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.0
47
+ version: '1.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.0
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: octokit
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ 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'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -173,9 +187,8 @@ extensions: []
173
187
  extra_rdoc_files: []
174
188
  files:
175
189
  - Gemfile
176
- - Gemfile.lock
177
190
  - Guardfile
178
- - LICENSE
191
+ - LICENSE.md
179
192
  - README.md
180
193
  - Rakefile
181
194
  - bin/git-helper
@@ -213,7 +226,7 @@ files:
213
226
  - spec/spec_helper.rb
214
227
  homepage: https://github.com/emmahsax/git_helper
215
228
  licenses:
216
- - MIT
229
+ - BSD-3-Clause
217
230
  metadata: {}
218
231
  post_install_message:
219
232
  rdoc_options: []
@@ -230,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
243
  - !ruby/object:Gem::Version
231
244
  version: '0'
232
245
  requirements: []
233
- rubygems_version: 3.2.3
246
+ rubygems_version: 3.2.15
234
247
  signing_key:
235
248
  specification_version: 4
236
249
  summary: A set of GitHub and GitLab workflow scripts.
data/Gemfile.lock DELETED
@@ -1,134 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- git_helper (3.3.4)
5
- gitlab (~> 4.16)
6
- gli (~> 2.13)
7
- highline_wrapper (~> 0.1.0)
8
- octokit (~> 4.18)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- addressable (2.7.0)
14
- public_suffix (>= 2.0.2, < 5.0)
15
- ast (2.4.2)
16
- coderay (1.1.3)
17
- concurrent-ruby (1.1.8)
18
- diff-lcs (1.4.4)
19
- faker (2.16.0)
20
- i18n (>= 1.6, < 2)
21
- faraday (1.3.0)
22
- faraday-net_http (~> 1.0)
23
- multipart-post (>= 1.2, < 3)
24
- ruby2_keywords
25
- faraday-net_http (1.0.1)
26
- ffi (1.14.2)
27
- formatador (0.2.5)
28
- gitlab (4.17.0)
29
- httparty (~> 0.18)
30
- terminal-table (~> 1.5, >= 1.5.1)
31
- gli (2.20.0)
32
- guard (2.16.2)
33
- formatador (>= 0.2.4)
34
- listen (>= 2.7, < 4.0)
35
- lumberjack (>= 1.0.12, < 2.0)
36
- nenv (~> 0.1)
37
- notiffany (~> 0.0)
38
- pry (>= 0.9.12)
39
- shellany (~> 0.0)
40
- thor (>= 0.18.1)
41
- guard-compat (1.2.1)
42
- guard-rspec (4.7.3)
43
- guard (~> 2.1)
44
- guard-compat (~> 1.1)
45
- rspec (>= 2.99.0, < 4.0)
46
- highline (2.0.3)
47
- highline_wrapper (0.1.0)
48
- highline (~> 2.0)
49
- httparty (0.18.1)
50
- mime-types (~> 3.0)
51
- multi_xml (>= 0.5.2)
52
- i18n (1.8.9)
53
- concurrent-ruby (~> 1.0)
54
- listen (3.4.1)
55
- rb-fsevent (~> 0.10, >= 0.10.3)
56
- rb-inotify (~> 0.9, >= 0.9.10)
57
- lumberjack (1.2.8)
58
- method_source (1.0.0)
59
- mime-types (3.3.1)
60
- mime-types-data (~> 3.2015)
61
- mime-types-data (3.2021.0225)
62
- multi_xml (0.6.0)
63
- multipart-post (2.1.1)
64
- nenv (0.3.0)
65
- notiffany (0.1.3)
66
- nenv (~> 0.1)
67
- shellany (~> 0.0)
68
- octokit (4.20.0)
69
- faraday (>= 0.9)
70
- sawyer (~> 0.8.0, >= 0.5.3)
71
- parallel (1.20.1)
72
- parser (3.0.0.0)
73
- ast (~> 2.4.1)
74
- pry (0.14.0)
75
- coderay (~> 1.1)
76
- method_source (~> 1.0)
77
- public_suffix (4.0.6)
78
- rainbow (3.0.0)
79
- rake (13.0.3)
80
- rb-fsevent (0.10.4)
81
- rb-inotify (0.10.1)
82
- ffi (~> 1.0)
83
- regexp_parser (2.1.1)
84
- rexml (3.2.4)
85
- rspec (3.10.0)
86
- rspec-core (~> 3.10.0)
87
- rspec-expectations (~> 3.10.0)
88
- rspec-mocks (~> 3.10.0)
89
- rspec-core (3.10.1)
90
- rspec-support (~> 3.10.0)
91
- rspec-expectations (3.10.1)
92
- diff-lcs (>= 1.2.0, < 2.0)
93
- rspec-support (~> 3.10.0)
94
- rspec-mocks (3.10.2)
95
- diff-lcs (>= 1.2.0, < 2.0)
96
- rspec-support (~> 3.10.0)
97
- rspec-support (3.10.2)
98
- rubocop (1.11.0)
99
- parallel (~> 1.10)
100
- parser (>= 3.0.0.0)
101
- rainbow (>= 2.2.2, < 4.0)
102
- regexp_parser (>= 1.8, < 3.0)
103
- rexml
104
- rubocop-ast (>= 1.2.0, < 2.0)
105
- ruby-progressbar (~> 1.7)
106
- unicode-display_width (>= 1.4.0, < 3.0)
107
- rubocop-ast (1.4.1)
108
- parser (>= 2.7.1.5)
109
- ruby-progressbar (1.11.0)
110
- ruby2_keywords (0.0.4)
111
- sawyer (0.8.2)
112
- addressable (>= 2.3.5)
113
- faraday (> 0.8, < 2.0)
114
- shellany (0.0.1)
115
- terminal-table (1.8.0)
116
- unicode-display_width (~> 1.1, >= 1.1.1)
117
- thor (1.1.0)
118
- unicode-display_width (1.7.0)
119
-
120
- PLATFORMS
121
- x86_64-darwin-20
122
-
123
- DEPENDENCIES
124
- bundler (~> 2.2)
125
- faker (~> 2.15)
126
- git_helper!
127
- guard-rspec (~> 4.3)
128
- pry (~> 0.13)
129
- rake (~> 13.0)
130
- rspec (~> 3.9)
131
- rubocop (~> 1.10)
132
-
133
- BUNDLED WITH
134
- 2.2.4
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.