git_helper 3.3.0 → 3.3.5

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +31 -8
  4. data/Guardfile +3 -1
  5. data/README.md +4 -4
  6. data/Rakefile +2 -0
  7. data/bin/git-helper +18 -13
  8. data/lib/git_helper.rb +6 -2
  9. data/lib/git_helper/change_remote.rb +15 -6
  10. data/lib/git_helper/checkout_default.rb +2 -0
  11. data/lib/git_helper/clean_branches.rb +2 -0
  12. data/lib/git_helper/code_request.rb +33 -19
  13. data/lib/git_helper/empty_commit.rb +2 -0
  14. data/lib/git_helper/forget_local_commits.rb +2 -0
  15. data/lib/git_helper/git_config_reader.rb +11 -5
  16. data/lib/git_helper/gitlab_client.rb +2 -0
  17. data/lib/git_helper/local_code.rb +18 -8
  18. data/lib/git_helper/merge_request.rb +90 -70
  19. data/lib/git_helper/new_branch.rb +4 -2
  20. data/lib/git_helper/octokit_client.rb +2 -0
  21. data/lib/git_helper/pull_request.rb +97 -66
  22. data/lib/git_helper/setup.rb +69 -40
  23. data/lib/git_helper/version.rb +3 -1
  24. data/spec/git_helper/change_remote_spec.rb +24 -24
  25. data/spec/git_helper/checkout_default_spec.rb +2 -0
  26. data/spec/git_helper/clean_branches_spec.rb +2 -0
  27. data/spec/git_helper/code_request_spec.rb +30 -28
  28. data/spec/git_helper/empty_commit_spec.rb +2 -0
  29. data/spec/git_helper/forget_local_commits_spec.rb +2 -0
  30. data/spec/git_helper/git_config_reader_spec.rb +32 -4
  31. data/spec/git_helper/gitlab_client_spec.rb +2 -0
  32. data/spec/git_helper/local_code_spec.rb +2 -0
  33. data/spec/git_helper/merge_request_spec.rb +24 -23
  34. data/spec/git_helper/new_branch_spec.rb +10 -8
  35. data/spec/git_helper/octokit_client_spec.rb +2 -0
  36. data/spec/git_helper/pull_request_spec.rb +20 -18
  37. data/spec/git_helper/setup_spec.rb +39 -26
  38. data/spec/spec_helper.rb +4 -1
  39. metadata +34 -9
  40. data/lib/git_helper/highline_cli.rb +0 -33
  41. data/spec/git_helper/highline_cli_spec.rb +0 -51
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faker'
4
+ require 'pry'
2
5
 
3
6
  # This file was generated by the `rspec --init` command. Conventionally, all
4
7
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
@@ -33,7 +36,7 @@ RSpec.configure do |config|
33
36
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
37
  end
35
38
 
36
- config.filter_run :focus => true
39
+ config.filter_run focus: true
37
40
  config.run_all_when_everything_filtered = true
38
41
 
39
42
  # rspec-mocks config goes here. You can use an alternate test double
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.0
4
+ version: 3.3.5
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-02-25 00:00:00.000000000 Z
11
+ date: 2021-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.13'
41
41
  - !ruby/object:Gem::Dependency
42
- name: highline
42
+ name: highline_wrapper
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '1.0'
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: '2.0'
54
+ version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: octokit
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.13'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.13'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rake
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +150,20 @@ dependencies:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
152
  version: '3.9'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.10'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.10'
139
167
  description: A set of GitHub and GitLab workflow scripts to provide a smoother development
140
168
  process for your git projects.
141
169
  email:
@@ -160,7 +188,6 @@ files:
160
188
  - lib/git_helper/forget_local_commits.rb
161
189
  - lib/git_helper/git_config_reader.rb
162
190
  - lib/git_helper/gitlab_client.rb
163
- - lib/git_helper/highline_cli.rb
164
191
  - lib/git_helper/local_code.rb
165
192
  - lib/git_helper/merge_request.rb
166
193
  - lib/git_helper/new_branch.rb
@@ -177,7 +204,6 @@ files:
177
204
  - spec/git_helper/forget_local_commits_spec.rb
178
205
  - spec/git_helper/git_config_reader_spec.rb
179
206
  - spec/git_helper/gitlab_client_spec.rb
180
- - spec/git_helper/highline_cli_spec.rb
181
207
  - spec/git_helper/local_code_spec.rb
182
208
  - spec/git_helper/merge_request_spec.rb
183
209
  - spec/git_helper/new_branch_spec.rb
@@ -197,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
223
  requirements:
198
224
  - - ">="
199
225
  - !ruby/object:Gem::Version
200
- version: '0'
226
+ version: '2.5'
201
227
  required_rubygems_version: !ruby/object:Gem::Requirement
202
228
  requirements:
203
229
  - - ">="
@@ -218,7 +244,6 @@ test_files:
218
244
  - spec/git_helper/forget_local_commits_spec.rb
219
245
  - spec/git_helper/git_config_reader_spec.rb
220
246
  - spec/git_helper/gitlab_client_spec.rb
221
- - spec/git_helper/highline_cli_spec.rb
222
247
  - spec/git_helper/local_code_spec.rb
223
248
  - spec/git_helper/merge_request_spec.rb
224
249
  - spec/git_helper/new_branch_spec.rb
@@ -1,33 +0,0 @@
1
- module GitHelper
2
- class HighlineCli
3
- def ask(prompt)
4
- highline_client.ask(prompt) do |conf|
5
- conf.readline = true
6
- end.to_s
7
- end
8
-
9
- def ask_yes_no(prompt)
10
- answer = highline_client.ask(prompt) do |conf|
11
- conf.readline = true
12
- end.to_s
13
-
14
- answer.empty? ? true : !!(answer =~ /^y/i)
15
- end
16
-
17
- def ask_options(prompt, choices)
18
- choices_as_string_options = ''
19
- choices.each { |choice| choices_as_string_options << "#{choices.index(choice) + 1}. #{choice}\n" }
20
- compiled_prompt = "#{prompt}\n#{choices_as_string_options.strip}"
21
-
22
- index = highline_client.ask(compiled_prompt) do |conf|
23
- conf.readline = true
24
- end.to_i - 1
25
-
26
- choices[index]
27
- end
28
-
29
- private def highline_client
30
- @highline_client ||= HighLine.new
31
- end
32
- end
33
- end
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
- require 'git_helper'
3
-
4
- describe GitHelper::HighlineCli do
5
- let(:response) { double(:response, readline: true, to_i: 3) }
6
- let(:highline_client) { double(:highline_cli, ask: response) }
7
-
8
- subject { GitHelper::HighlineCli.new }
9
-
10
- before do
11
- allow(HighLine).to receive(:new).and_return(highline_client)
12
- end
13
-
14
- describe '#ask' do
15
- it 'should ask the highline client ask'do
16
- expect(highline_client).to receive(:ask)
17
- subject.ask(Faker::Lorem.sentence)
18
- end
19
-
20
- it 'should return a string' do
21
- expect(subject.ask(Faker::Lorem.sentence)).to be_a(String)
22
- end
23
- end
24
-
25
- describe '#ask_yes_no' do
26
- it 'should ask the highline client ask'do
27
- expect(highline_client).to receive(:ask)
28
- subject.ask_yes_no(Faker::Lorem.sentence)
29
- end
30
-
31
- it 'should return a boolean' do
32
- expect(subject.ask_yes_no(Faker::Lorem.sentence)).to be_falsey
33
- end
34
-
35
- it 'should return true if we say yes' do
36
- allow(response).to receive(:to_s).and_return('y')
37
- expect(subject.ask_yes_no(Faker::Lorem.sentence)).to be_truthy
38
- end
39
- end
40
-
41
- describe '#ask_options' do
42
- it 'should ask the highline client ask'do
43
- expect(highline_client).to receive(:ask)
44
- subject.ask_options(Faker::Lorem.sentence, ['one', 'two', 'three'])
45
- end
46
-
47
- it 'should return a string from the options' do
48
- expect(subject.ask_options(Faker::Lorem.sentence, ['one', 'two', 'three'])).to be_a(String)
49
- end
50
- end
51
- end