git_helper 3.6.1 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +41 -38
- data/Guardfile +2 -2
- data/lib/git_helper/local_code.rb +4 -4
- data/lib/git_helper/merge_request.rb +5 -10
- data/lib/git_helper/setup.rb +5 -7
- data/lib/git_helper/version.rb +1 -1
- data/lib/git_helper.rb +1 -1
- data/renovate.json +6 -0
- metadata +7 -36
- data/spec/git_helper/change_remote_spec.rb +0 -176
- data/spec/git_helper/checkout_default_spec.rb +0 -21
- data/spec/git_helper/clean_branches_spec.rb +0 -21
- data/spec/git_helper/code_request_spec.rb +0 -265
- data/spec/git_helper/empty_commit_spec.rb +0 -21
- data/spec/git_helper/forget_local_commits_spec.rb +0 -21
- data/spec/git_helper/git_config_reader_spec.rb +0 -90
- data/spec/git_helper/github_client_spec.rb +0 -131
- data/spec/git_helper/gitlab_client_spec.rb +0 -144
- data/spec/git_helper/local_code_spec.rb +0 -270
- data/spec/git_helper/merge_request_spec.rb +0 -278
- data/spec/git_helper/new_branch_spec.rb +0 -47
- data/spec/git_helper/pull_request_spec.rb +0 -255
- data/spec/git_helper/setup_spec.rb +0 -183
- data/spec/spec_helper.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64c4ad9b8acf74b29b341f534243721f4bf168d1d15c524e052a201b867e9c6d
|
4
|
+
data.tar.gz: '01228b5f41daa653e47e11a33f5cde747edfc795759ab5b7c0b474d655538431'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f31e2053f842aaa9a536de4a79c9e2e066fd08c8703367520b2728e39a3b9aa88374230fbc2211993c709077cc573272e2e79dc996d5009dbdd864986c0541
|
7
|
+
data.tar.gz: e683017056105ba89126467da7cea039ee7c0d88350f8971ed0e130d85fcc0e2ea383600e7e88c01806d68540e2183bb5e30f6a8130d9fbabdce4bcbba545ab8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_helper (3.6.1)
|
4
|
+
git_helper (3.6.1.pre.test)
|
5
5
|
gli (~> 2.13)
|
6
6
|
highline_wrapper (~> 1.1)
|
7
7
|
|
@@ -10,13 +10,13 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
12
|
coderay (1.1.3)
|
13
|
-
concurrent-ruby (1.1.
|
14
|
-
diff-lcs (1.
|
15
|
-
faker (
|
16
|
-
i18n (>= 1.
|
17
|
-
ffi (1.15.
|
18
|
-
formatador (
|
19
|
-
gli (2.
|
13
|
+
concurrent-ruby (1.1.10)
|
14
|
+
diff-lcs (1.5.0)
|
15
|
+
faker (3.0.0)
|
16
|
+
i18n (>= 1.8.11, < 2)
|
17
|
+
ffi (1.15.5)
|
18
|
+
formatador (1.1.0)
|
19
|
+
gli (2.21.0)
|
20
20
|
guard (2.18.0)
|
21
21
|
formatador (>= 0.2.4)
|
22
22
|
listen (>= 2.7, < 4.0)
|
@@ -32,11 +32,12 @@ GEM
|
|
32
32
|
guard-compat (~> 1.1)
|
33
33
|
rspec (>= 2.99.0, < 4.0)
|
34
34
|
highline (2.0.3)
|
35
|
-
highline_wrapper (1.3.
|
35
|
+
highline_wrapper (1.3.1)
|
36
36
|
highline (~> 2.0)
|
37
|
-
i18n (1.
|
37
|
+
i18n (1.12.0)
|
38
38
|
concurrent-ruby (~> 1.0)
|
39
|
-
|
39
|
+
json (2.6.3)
|
40
|
+
listen (3.7.1)
|
40
41
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
41
42
|
rb-inotify (~> 0.9, >= 0.9.10)
|
42
43
|
lumberjack (1.2.8)
|
@@ -45,53 +46,55 @@ GEM
|
|
45
46
|
notiffany (0.1.3)
|
46
47
|
nenv (~> 0.1)
|
47
48
|
shellany (~> 0.0)
|
48
|
-
parallel (1.
|
49
|
-
parser (3.
|
49
|
+
parallel (1.22.1)
|
50
|
+
parser (3.1.3.0)
|
50
51
|
ast (~> 2.4.1)
|
51
52
|
pry (0.14.1)
|
52
53
|
coderay (~> 1.1)
|
53
54
|
method_source (~> 1.0)
|
54
|
-
rainbow (3.
|
55
|
-
rb-fsevent (0.11.
|
55
|
+
rainbow (3.1.1)
|
56
|
+
rb-fsevent (0.11.2)
|
56
57
|
rb-inotify (0.10.1)
|
57
58
|
ffi (~> 1.0)
|
58
|
-
regexp_parser (2.
|
59
|
+
regexp_parser (2.6.1)
|
59
60
|
rexml (3.2.5)
|
60
|
-
rspec (3.
|
61
|
-
rspec-core (~> 3.
|
62
|
-
rspec-expectations (~> 3.
|
63
|
-
rspec-mocks (~> 3.
|
64
|
-
rspec-core (3.
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-expectations (3.
|
61
|
+
rspec (3.12.0)
|
62
|
+
rspec-core (~> 3.12.0)
|
63
|
+
rspec-expectations (~> 3.12.0)
|
64
|
+
rspec-mocks (~> 3.12.0)
|
65
|
+
rspec-core (3.12.0)
|
66
|
+
rspec-support (~> 3.12.0)
|
67
|
+
rspec-expectations (3.12.1)
|
67
68
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-mocks (3.
|
69
|
+
rspec-support (~> 3.12.0)
|
70
|
+
rspec-mocks (3.12.1)
|
70
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
-
rspec-support (~> 3.
|
72
|
-
rspec-support (3.
|
73
|
-
rubocop (1.
|
72
|
+
rspec-support (~> 3.12.0)
|
73
|
+
rspec-support (3.12.0)
|
74
|
+
rubocop (1.40.0)
|
75
|
+
json (~> 2.3)
|
74
76
|
parallel (~> 1.10)
|
75
|
-
parser (>= 3.
|
77
|
+
parser (>= 3.1.2.1)
|
76
78
|
rainbow (>= 2.2.2, < 4.0)
|
77
79
|
regexp_parser (>= 1.8, < 3.0)
|
78
|
-
rexml
|
79
|
-
rubocop-ast (>= 1.
|
80
|
+
rexml (>= 3.2.5, < 4.0)
|
81
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
80
82
|
ruby-progressbar (~> 1.7)
|
81
83
|
unicode-display_width (>= 1.4.0, < 3.0)
|
82
|
-
rubocop-ast (1.
|
83
|
-
parser (>= 3.
|
84
|
+
rubocop-ast (1.24.0)
|
85
|
+
parser (>= 3.1.1.0)
|
84
86
|
ruby-progressbar (1.11.0)
|
85
87
|
shellany (0.0.1)
|
86
|
-
thor (1.1
|
87
|
-
unicode-display_width (2.
|
88
|
+
thor (1.2.1)
|
89
|
+
unicode-display_width (2.3.0)
|
88
90
|
|
89
91
|
PLATFORMS
|
90
|
-
|
92
|
+
arm64-darwin-21
|
93
|
+
arm64-darwin-22
|
91
94
|
|
92
95
|
DEPENDENCIES
|
93
96
|
bundler (~> 2.2)
|
94
|
-
faker (~>
|
97
|
+
faker (~> 3.0)
|
95
98
|
git_helper!
|
96
99
|
guard-rspec (~> 4.3)
|
97
100
|
pry (~> 0.13)
|
@@ -99,4 +102,4 @@ DEPENDENCIES
|
|
99
102
|
rubocop (~> 1.10)
|
100
103
|
|
101
104
|
BUNDLED WITH
|
102
|
-
2.
|
105
|
+
2.3.26
|
data/Guardfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true do
|
4
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
5
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
6
|
watch(%r{^spec/.+_spec\.rb$})
|
5
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
6
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
7
7
|
end
|
@@ -108,7 +108,7 @@ module GitHelper
|
|
108
108
|
# rubocop:enable Metrics/AbcSize
|
109
109
|
|
110
110
|
def read_template(file_name)
|
111
|
-
File.
|
111
|
+
File.read(file_name)
|
112
112
|
end
|
113
113
|
|
114
114
|
# rubocop:disable Metrics/AbcSize
|
@@ -122,14 +122,14 @@ module GitHelper
|
|
122
122
|
branch_arr.first.capitalize
|
123
123
|
elsif branch_arr[0].scan(/(\w+)/).any? && branch_arr[1].scan(/(\d+)/).any? # branch includes jira_123 at beginning
|
124
124
|
issue = "#{branch_arr[0].upcase}-#{branch_arr[1]}"
|
125
|
-
description = branch_arr[2
|
125
|
+
description = branch_arr[2..].join(' ')
|
126
126
|
"#{issue} #{description.capitalize}"
|
127
127
|
elsif branch_arr[0].scan(/(\w+-\d+)/).any? # branch includes string jira-123 at beginning
|
128
128
|
issue = branch_arr[0].upcase
|
129
|
-
description = branch_arr[1
|
129
|
+
description = branch_arr[1..].join(' ')
|
130
130
|
"#{issue} #{description.capitalize}"
|
131
131
|
else # plain words
|
132
|
-
branch_arr[0
|
132
|
+
branch_arr[0..].join(' ').capitalize
|
133
133
|
end
|
134
134
|
end
|
135
135
|
# rubocop:enable Metrics/MethodLength
|
@@ -29,21 +29,16 @@ module GitHelper
|
|
29
29
|
puts "Creating merge request: #{new_mr_title}"
|
30
30
|
mr = gitlab_client.create_merge_request(local_project, options)
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
if mr.diff_refs['base_sha'] == mr.diff_refs['head_sha']
|
32
|
+
if mr.web_url && mr.diff_refs && (mr.diff_refs['base_sha'] == mr.diff_refs['head_sha'])
|
35
33
|
puts "Merge request was created, but no commits have been pushed to GitLab: #{mr.web_url}"
|
36
|
-
|
34
|
+
elsif mr.web_url
|
37
35
|
puts "Merge request successfully created: #{mr.web_url}"
|
36
|
+
else
|
37
|
+
raise StandardError, (mr.message.instance_of?(Array) ? mr.message.first : mr.message)
|
38
38
|
end
|
39
39
|
rescue StandardError => e
|
40
40
|
puts 'Could not create merge request:'
|
41
|
-
|
42
|
-
if e.message.include?('Another open merge request already exists')
|
43
|
-
puts ' A merge request already exists for this branch'
|
44
|
-
else
|
45
|
-
puts " #{e.message}"
|
46
|
-
end
|
41
|
+
puts " #{e.message}"
|
47
42
|
end
|
48
43
|
# rubocop:enable Metrics/AbcSize
|
49
44
|
# rubocop:enable Metrics/MethodLength
|
data/lib/git_helper/setup.rb
CHANGED
@@ -32,8 +32,8 @@ module GitHelper
|
|
32
32
|
return unless answer
|
33
33
|
|
34
34
|
create_or_update_plugin_files
|
35
|
-
puts "\nNow add this line to your ~/.bash_profile:\n" \
|
36
|
-
'
|
35
|
+
puts "\nNow add this line to your ~/.bash_profile:\n " \
|
36
|
+
'export PATH=/path/to/computer/home/.git_helper/plugins:$PATH'
|
37
37
|
puts "\nDone!"
|
38
38
|
end
|
39
39
|
|
@@ -66,8 +66,8 @@ module GitHelper
|
|
66
66
|
file_contents << ":gitlab_user: #{ask_question('GitLab username?')}\n"
|
67
67
|
file_contents << ':gitlab_token: ' \
|
68
68
|
"#{ask_question(
|
69
|
-
'GitLab personal access token? (Navigate to https://gitlab.com/-/profile/personal_access_tokens' \
|
70
|
-
'
|
69
|
+
'GitLab personal access token? (Navigate to https://gitlab.com/-/profile/personal_access_tokens ' \
|
70
|
+
'to create a new personal access token)',
|
71
71
|
secret: true
|
72
72
|
)}\n"
|
73
73
|
end
|
@@ -81,7 +81,6 @@ module GitHelper
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# rubocop:disable Metrics/MethodLength
|
84
|
-
# rubocop:disable Metrics/AbcSize
|
85
84
|
private def create_or_update_plugin_files
|
86
85
|
plugins_dir = "#{Dir.pwd.scan(%r{\A/\w*/\w*/}).first}.git_helper/plugins"
|
87
86
|
plugins_url = 'https://api.github.com/repos/emmahsax/git_helper/contents/plugins'
|
@@ -89,7 +88,7 @@ module GitHelper
|
|
89
88
|
token = git_config_reader.github_token
|
90
89
|
user = git_config_reader.github_user
|
91
90
|
|
92
|
-
|
91
|
+
FileUtils.mkdir_p(plugins_dir)
|
93
92
|
|
94
93
|
all_plugins = JSON.parse(`curl -s -u #{user}:#{token} -H "#{header}" -L "#{plugins_url}"`)
|
95
94
|
|
@@ -99,7 +98,6 @@ module GitHelper
|
|
99
98
|
end
|
100
99
|
end
|
101
100
|
# rubocop:enable Metrics/MethodLength
|
102
|
-
# rubocop:enable Metrics/AbcSize
|
103
101
|
|
104
102
|
private def config_file
|
105
103
|
git_config_reader.git_config_file_path
|
data/lib/git_helper/version.rb
CHANGED
data/lib/git_helper.rb
CHANGED
data/renovate.json
ADDED
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.6.
|
4
|
+
version: 3.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emma Sax
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,21 +154,7 @@ files:
|
|
154
154
|
- lib/git_helper/setup.rb
|
155
155
|
- lib/git_helper/version.rb
|
156
156
|
- plugins.zip
|
157
|
-
-
|
158
|
-
- spec/git_helper/checkout_default_spec.rb
|
159
|
-
- spec/git_helper/clean_branches_spec.rb
|
160
|
-
- spec/git_helper/code_request_spec.rb
|
161
|
-
- spec/git_helper/empty_commit_spec.rb
|
162
|
-
- spec/git_helper/forget_local_commits_spec.rb
|
163
|
-
- spec/git_helper/git_config_reader_spec.rb
|
164
|
-
- spec/git_helper/github_client_spec.rb
|
165
|
-
- spec/git_helper/gitlab_client_spec.rb
|
166
|
-
- spec/git_helper/local_code_spec.rb
|
167
|
-
- spec/git_helper/merge_request_spec.rb
|
168
|
-
- spec/git_helper/new_branch_spec.rb
|
169
|
-
- spec/git_helper/pull_request_spec.rb
|
170
|
-
- spec/git_helper/setup_spec.rb
|
171
|
-
- spec/spec_helper.rb
|
157
|
+
- renovate.json
|
172
158
|
homepage: https://github.com/emmahsax/git_helper
|
173
159
|
licenses:
|
174
160
|
- BSD-3-Clause
|
@@ -189,23 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
175
|
- !ruby/object:Gem::Version
|
190
176
|
version: '0'
|
191
177
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
178
|
+
rubygems_version: 3.3.26
|
193
179
|
signing_key:
|
194
180
|
specification_version: 4
|
195
181
|
summary: A set of GitHub and GitLab workflow scripts
|
196
|
-
test_files:
|
197
|
-
- spec/spec_helper.rb
|
198
|
-
- spec/git_helper/change_remote_spec.rb
|
199
|
-
- spec/git_helper/checkout_default_spec.rb
|
200
|
-
- spec/git_helper/clean_branches_spec.rb
|
201
|
-
- spec/git_helper/code_request_spec.rb
|
202
|
-
- spec/git_helper/empty_commit_spec.rb
|
203
|
-
- spec/git_helper/forget_local_commits_spec.rb
|
204
|
-
- spec/git_helper/git_config_reader_spec.rb
|
205
|
-
- spec/git_helper/github_client_spec.rb
|
206
|
-
- spec/git_helper/gitlab_client_spec.rb
|
207
|
-
- spec/git_helper/local_code_spec.rb
|
208
|
-
- spec/git_helper/merge_request_spec.rb
|
209
|
-
- spec/git_helper/new_branch_spec.rb
|
210
|
-
- spec/git_helper/pull_request_spec.rb
|
211
|
-
- spec/git_helper/setup_spec.rb
|
182
|
+
test_files: []
|
@@ -1,176 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'git_helper'
|
5
|
-
|
6
|
-
describe GitHelper::ChangeRemote do
|
7
|
-
let(:remote1) { "git@github.com:#{old_owner}/#{project}.git" }
|
8
|
-
let(:project) { Faker::Lorem.word }
|
9
|
-
let(:highline_wrapper) { double(:highline_wrapper, ask_yes_no: true) }
|
10
|
-
let(:old_owner) { Faker::Internet.username }
|
11
|
-
let(:new_owner) { Faker::Internet.username }
|
12
|
-
let(:directory_entries) { ['.', '..', project, Faker::Lorem.word, Faker::Lorem.word] }
|
13
|
-
|
14
|
-
let(:local_code) do
|
15
|
-
double(:local_code,
|
16
|
-
remotes: [remote1],
|
17
|
-
remote_name: Faker::Lorem.word,
|
18
|
-
ssh_remote?: true,
|
19
|
-
https_remote?: false,
|
20
|
-
remote_project: project,
|
21
|
-
remote_source: 'github.com',
|
22
|
-
change_remote: true)
|
23
|
-
end
|
24
|
-
|
25
|
-
subject { GitHelper::ChangeRemote.new(old_owner, new_owner) }
|
26
|
-
|
27
|
-
before do
|
28
|
-
allow(HighlineWrapper).to receive(:new).and_return(highline_wrapper)
|
29
|
-
allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
30
|
-
allow(subject).to receive(:puts)
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#execute' do
|
34
|
-
before do
|
35
|
-
allow(Dir).to receive(:pwd).and_return("/Users/#{Faker::Name.first_name}/#{project}")
|
36
|
-
allow(Dir).to receive(:entries).and_return(directory_entries)
|
37
|
-
allow(File).to receive(:join).and_return("/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
|
38
|
-
allow(File).to receive(:directory?).and_return(true)
|
39
|
-
allow(subject).to receive(:process_dir)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should call to process at least one directory' do
|
43
|
-
expect(subject).to receive(:process_dir).at_least(:once)
|
44
|
-
subject.execute
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should definitely look in the file structure' do
|
48
|
-
expect(Dir).to receive(:pwd)
|
49
|
-
expect(Dir).to receive(:entries)
|
50
|
-
expect(File).to receive(:join)
|
51
|
-
expect(File).to receive(:directory?)
|
52
|
-
subject.execute
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#process_dir' do
|
57
|
-
before do
|
58
|
-
allow(Dir).to receive(:chdir).and_return(nil)
|
59
|
-
allow(File).to receive(:exist?).and_return(true)
|
60
|
-
allow(subject).to receive(:process_git_repository)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should definitely look in the file structure' do
|
64
|
-
expect(Dir).to receive(:chdir)
|
65
|
-
expect(File).to receive(:exist?)
|
66
|
-
subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'when the user says to process the directory' do
|
70
|
-
it 'should call to process the git repository at least once' do
|
71
|
-
expect(subject).to receive(:process_git_repository).at_least(:once)
|
72
|
-
subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'when the user says not to process the directory' do
|
77
|
-
let(:highline_wrapper) { double(:highline_wrapper, ask_yes_no: false) }
|
78
|
-
|
79
|
-
it 'should not call to process the directory' do
|
80
|
-
expect(subject).not_to receive(:process_git_repository)
|
81
|
-
subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '#process_git_repository' do
|
87
|
-
before do
|
88
|
-
allow(subject).to receive(:process_remote).and_return(nil)
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should call local_code' do
|
92
|
-
expect(GitHelper::LocalCode).to receive(:new)
|
93
|
-
subject.send(:process_git_repository)
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'when the remote includes the old owner' do
|
97
|
-
it 'should call to process the remote' do
|
98
|
-
expect(subject).to receive(:process_remote)
|
99
|
-
subject.send(:process_git_repository)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when the remote does not include the old owner' do
|
104
|
-
let(:remote1) { "git@github.com:#{new_owner}/#{project}.git" }
|
105
|
-
|
106
|
-
it 'should not call to process the remote' do
|
107
|
-
expect(subject).not_to receive(:process_remote)
|
108
|
-
subject.send(:process_git_repository)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe '#process_remote' do
|
114
|
-
it 'should always get the remote name' do
|
115
|
-
expect(local_code).to receive(:remote_name)
|
116
|
-
subject.send(:process_remote, remote1)
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'should always attempt to change the remote' do
|
120
|
-
expect(local_code).to receive(:change_remote)
|
121
|
-
subject.send(:process_remote, remote1)
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'should attempt to get the remote repo exactly once' do
|
125
|
-
expect(local_code).to receive(:remote_project).exactly(:once)
|
126
|
-
subject.send(:process_remote, remote1)
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'should attempt to get the remote source exactly once' do
|
130
|
-
expect(local_code).to receive(:remote_source).exactly(:once)
|
131
|
-
subject.send(:process_remote, remote1)
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'should ask if the remote is SSH' do
|
135
|
-
expect(local_code).to receive(:ssh_remote?)
|
136
|
-
subject.send(:process_remote, remote1)
|
137
|
-
end
|
138
|
-
|
139
|
-
context 'https remote' do
|
140
|
-
let(:local_code) do
|
141
|
-
double(:local_code,
|
142
|
-
remotes: [remote1],
|
143
|
-
remote_name: Faker::Lorem.word,
|
144
|
-
ssh_remote?: false,
|
145
|
-
https_remote?: false,
|
146
|
-
remote_project: project,
|
147
|
-
remote_source: 'github.com',
|
148
|
-
change_remote: true)
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'should ask if the remote is SSH' do
|
152
|
-
expect(local_code).to receive(:ssh_remote?)
|
153
|
-
subject.send(:process_remote, remote1)
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'should ask if the remote is https' do
|
157
|
-
expect(local_code).to receive(:https_remote?)
|
158
|
-
subject.send(:process_remote, remote1)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
describe '#local_code' do
|
164
|
-
it 'should create a new local code instance' do
|
165
|
-
expect(GitHelper::LocalCode).to receive(:new)
|
166
|
-
subject.send(:local_code)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe '#highline' do
|
171
|
-
it 'should create a new highline_wrapper instance' do
|
172
|
-
expect(HighlineWrapper).to receive(:new)
|
173
|
-
subject.send(:highline)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'git_helper'
|
5
|
-
|
6
|
-
describe GitHelper::CheckoutDefault do
|
7
|
-
let(:local_code) { double(:local_code, checkout_default: :done) }
|
8
|
-
|
9
|
-
subject { GitHelper::CheckoutDefault.new }
|
10
|
-
|
11
|
-
it 'should call GitHelper::LocalCode' do
|
12
|
-
expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
13
|
-
subject.execute
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should call the checkout_default method from the local code class' do
|
17
|
-
allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
18
|
-
expect(local_code).to receive(:checkout_default)
|
19
|
-
subject.execute
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'git_helper'
|
5
|
-
|
6
|
-
describe GitHelper::CleanBranches do
|
7
|
-
let(:local_code) { double(:local_code, clean_branches: :commit) }
|
8
|
-
|
9
|
-
subject { GitHelper::CleanBranches.new }
|
10
|
-
|
11
|
-
it 'should call GitHelper::LocalCode' do
|
12
|
-
expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
13
|
-
subject.execute
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should call the clean_branches method from the local code class' do
|
17
|
-
allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
18
|
-
expect(local_code).to receive(:clean_branches)
|
19
|
-
subject.execute
|
20
|
-
end
|
21
|
-
end
|