git_helper 3.3.3 → 3.3.4

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: e7e2fb7b1199964740a0d73091815fb81469b492a3de04adc16aea30ba794e79
4
- data.tar.gz: 80abd21099775a4829c1e72accb74f7f91ae6e9f5e536cfd0468879065de06ff
3
+ metadata.gz: 8dc9aca4ddec9f8038f5083b2790b10ac48b8293de15c37fb8a153b76ca0ce23
4
+ data.tar.gz: e2be8c7950de2fe93e7b44b0b3c50118dd8bd34494237f435c69cdbc775ef7e9
5
5
  SHA512:
6
- metadata.gz: 5fdabeaa00c72c8f58e00bce3f054949ad1061dbbb132661d06caf788ca827b486d44c20d57213582c2eb7b9c8db28ac88636b5e4562366010c33cc6056c526c
7
- data.tar.gz: '08eee4e6e95562f500c93df42f72a713b43ece4d39c96013d5313612f13bf33dc4b7dcd5ca6de243d3bba360af8d8bc183d6c5f2a8600d9692de2afa3bf7c675'
6
+ metadata.gz: '029e8998214a94ff639bed8faa0a90bf94eca320a7989effab17b845918df911718512f40dd74e563faf347162723fb9e39b9a02ba0b20477183f4eb4b1d1d71'
7
+ data.tar.gz: ef184720792c6dc8f361674eabdf7e9972e905f2c835b06ecbbe4b952bdd9eab94c42e644663b6be38222688982c8ff2b0fc958a6899b9eb0a2c3ce2afb77547
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_helper (3.3.2)
4
+ git_helper (3.3.4)
5
5
  gitlab (~> 4.16)
6
6
  gli (~> 2.13)
7
7
  highline_wrapper (~> 0.1.0)
@@ -16,7 +16,7 @@ GEM
16
16
  coderay (1.1.3)
17
17
  concurrent-ruby (1.1.8)
18
18
  diff-lcs (1.4.4)
19
- faker (2.15.1)
19
+ faker (2.16.0)
20
20
  i18n (>= 1.6, < 2)
21
21
  faraday (1.3.0)
22
22
  faraday-net_http (~> 1.0)
@@ -49,7 +49,7 @@ GEM
49
49
  httparty (0.18.1)
50
50
  mime-types (~> 3.0)
51
51
  multi_xml (>= 0.5.2)
52
- i18n (1.8.8)
52
+ i18n (1.8.9)
53
53
  concurrent-ruby (~> 1.0)
54
54
  listen (3.4.1)
55
55
  rb-fsevent (~> 0.10, >= 0.10.3)
@@ -95,7 +95,7 @@ GEM
95
95
  diff-lcs (>= 1.2.0, < 2.0)
96
96
  rspec-support (~> 3.10.0)
97
97
  rspec-support (3.10.2)
98
- rubocop (1.10.0)
98
+ rubocop (1.11.0)
99
99
  parallel (~> 1.10)
100
100
  parser (>= 3.0.0.0)
101
101
  rainbow (>= 2.2.2, < 4.0)
@@ -118,7 +118,7 @@ GEM
118
118
  unicode-display_width (1.7.0)
119
119
 
120
120
  PLATFORMS
121
- x86_64-darwin-19
121
+ x86_64-darwin-20
122
122
 
123
123
  DEPENDENCIES
124
124
  bundler (~> 2.2)
@@ -131,4 +131,4 @@ DEPENDENCIES
131
131
  rubocop (~> 1.10)
132
132
 
133
133
  BUNDLED WITH
134
- 2.2.9
134
+ 2.2.4
data/README.md CHANGED
@@ -115,7 +115,7 @@ git-helper clean-branches
115
115
 
116
116
  ### `code-request`
117
117
 
118
- This command can be used to handily make new GitHub/GitLab pull/merge requests from the command line. The command uses either the [`Octokit::Client`](https://octokit.github.io/octokit.rb/Octokit/Client.html) or [`Gitlab` client](https://github.com/NARKOZ/gitlab) to do this, so make sure you have a `~/.git_helper/config.yml` file set up in the home directory of your computer. For instructions on how to do that, see [Gem Usage](#gem-usage).
118
+ This command can be used to handily make new GitHub/GitLab pull/merge requests from the command-line. The command uses either the [`Octokit::Client`](https://octokit.github.io/octokit.rb/Octokit/Client.html) or [`Gitlab` client](https://github.com/NARKOZ/gitlab) to do this, so make sure you have a `~/.git_helper/config.yml` file set up in the home directory of your computer. For instructions on how to do that, see [Gem Usage](#gem-usage).
119
119
 
120
120
  After setup is complete, you can call the command like this:
121
121
 
@@ -149,7 +149,7 @@ git-helper forget-local-commits
149
149
 
150
150
  ### `merge-code-request`
151
151
 
152
- This command can be used to merge pull/merge requests from the command line. The command uses either the [`Octokit::Client`](https://octokit.github.io/octokit.rb/Octokit/Client.html) or [`Gitlab` client](https://github.com/NARKOZ/gitlab) to do this, so make sure you have a `~/.git_helper/config.yml` file set up in the home directory of your computer. For instructions on how to do that, see [Gem Usage](#gem-usage).
152
+ This command can be used to merge pull/merge requests from the command-line. The command uses either the [`Octokit::Client`](https://octokit.github.io/octokit.rb/Octokit/Client.html) or [`Gitlab` client](https://github.com/NARKOZ/gitlab) to do this, so make sure you have a `~/.git_helper/config.yml` file set up in the home directory of your computer. For instructions on how to do that, see [Gem Usage](#gem-usage).
153
153
 
154
154
  After setup is complete, you can call the proper command like this:
155
155
 
@@ -166,7 +166,7 @@ For GitLab, the command will use whatever squash/source branch deletion/etc sett
166
166
 
167
167
  ### `new-branch`
168
168
 
169
- This command is useful for making new branches in a repository on the command line. To run the command, run:
169
+ This command is useful for making new branches in a repository on the command-line. To run the command, run:
170
170
 
171
171
  ```bash
172
172
  git-helper new-branch
@@ -25,7 +25,8 @@ module GitHelper
25
25
  Dir.chdir(current_dir)
26
26
 
27
27
  if File.exist?('.git') && highline.ask_yes_no(
28
- "Found git directory: #{current_dir}. Do you wish to proceed in updating #{current_dir}'s remote URLs? (y/n)"
28
+ "Found git directory: #{current_dir}. Do you wish to proceed in updating #{current_dir}'s remote URLs? (y/n)",
29
+ { required: true }
29
30
  )
30
31
  process_git_repository
31
32
  end
@@ -41,7 +42,7 @@ module GitHelper
41
42
  puts " Found remote is not pointing to #{old_owner}."
42
43
  end
43
44
  end
44
- puts "\n"
45
+ puts
45
46
  end
46
47
 
47
48
  # rubocop:disable Metrics/AbcSize
@@ -31,7 +31,8 @@ module GitHelper
31
31
  private def ask_for_clarification
32
32
  resp = highline.ask(
33
33
  'Found git remotes for both GitHub and GitLab. Would you like to proceed ' \
34
- 'with GitLab or GitHub? (github/gitlab)'
34
+ 'with GitLab or GitHub? (github/gitlab)',
35
+ { required: true }
35
36
  ).downcase
36
37
 
37
38
  if resp.include?('hub')
@@ -75,7 +76,7 @@ module GitHelper
75
76
  if highline.ask_yes_no("Is '#{default_branch}' the correct base branch for your new code request? (y/n)")
76
77
  default_branch
77
78
  else
78
- highline.ask('Base branch?')
79
+ highline.ask('Base branch?', { required: true })
79
80
  end
80
81
  end
81
82
 
@@ -94,7 +95,7 @@ module GitHelper
94
95
  )
95
96
  autogenerated_title
96
97
  else
97
- highline.ask('Title?')
98
+ highline.ask('Title?', { required: true })
98
99
  end
99
100
  end
100
101
 
@@ -3,8 +3,8 @@
3
3
  module GitHelper
4
4
  class NewBranch
5
5
  def execute(new_branch_name = nil)
6
- branch_name = new_branch_name || HighlineWrapper.new.ask('New branch name?')
7
- puts "Attempting to create a new branch: #{branch_name}"
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"
8
8
  GitHelper::LocalCode.new.new_branch(branch_name)
9
9
  end
10
10
  end
@@ -7,23 +7,26 @@ module GitHelper
7
7
  execute_plugins
8
8
  end
9
9
 
10
+ # rubocop:disable Style/ConditionalAssignment
10
11
  private def execute_config_file
11
12
  if config_file_exists?
12
13
  answer = highline.ask_yes_no(
13
- "It looks like the #{config_file} file already exists. Do you wish to replace it? (y/n)"
14
+ "It looks like the #{config_file} file already exists. Do you wish to replace it? (y/n)",
15
+ { required: true }
14
16
  )
15
- puts
16
17
  else
17
18
  answer = true
18
19
  end
19
20
 
20
21
  create_or_update_config_file if answer
21
22
  end
23
+ # rubocop:enable Style/ConditionalAssignment
22
24
 
23
25
  private def execute_plugins
24
26
  answer = highline.ask_yes_no(
25
27
  'Do you wish to set up the Git Helper plugins? (y/n) (This process will ' \
26
- 'attempt to use your GitHub personal access token to authenticate)'
28
+ 'attempt to use your GitHub personal access token to authenticate)',
29
+ { required: true }
27
30
  )
28
31
 
29
32
  return unless answer
@@ -36,7 +39,7 @@ module GitHelper
36
39
 
37
40
  private def create_or_update_config_file
38
41
  contents = generate_file_contents
39
- puts "\nCreating or updating your #{config_file} file..."
42
+ puts "Creating or updating your #{config_file} file..."
40
43
  File.open(config_file, 'w') { |file| file.puts contents }
41
44
  puts "\nDone!\n\n"
42
45
  end
@@ -49,19 +52,23 @@ module GitHelper
49
52
  private def generate_file_contents
50
53
  file_contents = ''.dup
51
54
 
52
- if highline.ask_yes_no('Do you wish to set up GitHub credentials? (y/n)')
55
+ if highline.ask_yes_no('Do you wish to set up GitHub credentials? (y/n)', { required: true })
53
56
  file_contents << ":github_user: #{ask_question('GitHub username?')}\n"
54
57
  file_contents << ':github_token: ' \
55
- "#{ask_question('GitHub personal access token? (Navigate to https://github.com/settings/tokens ' \
56
- 'to create a new personal access token)')}\n"
58
+ "#{ask_question(
59
+ 'GitHub personal access token? (Navigate to https://github.com/settings/tokens ' \
60
+ 'to create a new personal access token)',
61
+ secret: true
62
+ )}\n"
57
63
  end
58
64
 
59
- if highline.ask_yes_no("\nDo you wish to set up GitLab credentials? (y/n)")
65
+ if highline.ask_yes_no('Do you wish to set up GitLab credentials? (y/n)', { required: true })
60
66
  file_contents << ":gitlab_user: #{ask_question('GitLab username?')}\n"
61
67
  file_contents << ':gitlab_token: ' \
62
68
  "#{ask_question(
63
69
  'GitLab personal access token? (Navigate to https://gitlab.com/-/profile/personal_access_tokens' \
64
- ' to create a new personal access token)'
70
+ ' to create a new personal access token)',
71
+ secret: true
65
72
  )}\n"
66
73
  end
67
74
 
@@ -69,15 +76,8 @@ module GitHelper
69
76
  end
70
77
  # rubocop:enable Metrics/MethodLength
71
78
 
72
- private def ask_question(prompt)
73
- answer = highline.ask("\n#{prompt}")
74
-
75
- if answer.empty?
76
- puts "\nThis question is required."
77
- ask_question(prompt)
78
- else
79
- answer
80
- end
79
+ private def ask_question(prompt, secret: false)
80
+ highline.ask(prompt, { required: true, secret: secret })
81
81
  end
82
82
 
83
83
  # rubocop:disable Metrics/MethodLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHelper
4
- VERSION = '3.3.3'
4
+ VERSION = '3.3.4'
5
5
  end
@@ -84,12 +84,6 @@ describe GitHelper::Setup do
84
84
  subject.send(:ask_question, Faker::Lorem.sentence)
85
85
  end
86
86
 
87
- it 'should recurse if the highline client gets an empty string' do
88
- allow(highline_wrapper).to receive(:ask).and_return('', Faker::Lorem.word)
89
- expect(subject).to receive(:ask_question).at_least(:twice).and_call_original
90
- subject.send(:ask_question, Faker::Lorem.sentence)
91
- end
92
-
93
87
  it 'should return the answer if it is given' do
94
88
  answer = Faker::Lorem.sentence
95
89
  allow(highline_wrapper).to receive(:ask).and_return(answer)
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.3
4
+ version: 3.3.4
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-02 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