git_helper 3.2.2 → 3.3.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +111 -0
- data/README.md +6 -1
- data/bin/git-helper +7 -0
- data/lib/git_helper/git_config_reader.rb +4 -4
- data/lib/git_helper/setup.rb +87 -0
- data/lib/git_helper/version.rb +1 -1
- data/spec/git_helper/code_request_spec.rb +1 -0
- data/spec/git_helper/setup_spec.rb +170 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9c80aa14abd85f6ebcff1a7c6592e71e4222273c8239c14c45ef905c4a3e549
|
|
4
|
+
data.tar.gz: 973f3831d8587d46d5e37c7738b50b5f8bab12bab9b2ec3d8ef34379b61917ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4515350964ec6a6e998a912d5b53cc49c8f90bd6d9cf9acfa5a3d499ffbad71638068266716971924efd76d6692a7aa1a1523cbcefc5c20eaeaf8e99805689aa
|
|
7
|
+
data.tar.gz: bfee7c84bc7d5a9a54172779bccbdbb56e0ad22f3776f8dc2d00228149ffcdf5de4dc5f3b5182aa92c6add8eec30cb0a70b7f8184fb5e1a8c8a2da2bf621007b
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
git_helper (3.3.0)
|
|
5
|
+
gitlab (~> 4.16)
|
|
6
|
+
gli (~> 2.13)
|
|
7
|
+
highline (~> 2.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
|
+
coderay (1.1.3)
|
|
16
|
+
concurrent-ruby (1.1.8)
|
|
17
|
+
diff-lcs (1.4.4)
|
|
18
|
+
faker (2.15.1)
|
|
19
|
+
i18n (>= 1.6, < 2)
|
|
20
|
+
faraday (1.3.0)
|
|
21
|
+
faraday-net_http (~> 1.0)
|
|
22
|
+
multipart-post (>= 1.2, < 3)
|
|
23
|
+
ruby2_keywords
|
|
24
|
+
faraday-net_http (1.0.1)
|
|
25
|
+
ffi (1.14.2)
|
|
26
|
+
formatador (0.2.5)
|
|
27
|
+
gitlab (4.17.0)
|
|
28
|
+
httparty (~> 0.18)
|
|
29
|
+
terminal-table (~> 1.5, >= 1.5.1)
|
|
30
|
+
gli (2.19.2)
|
|
31
|
+
guard (2.16.2)
|
|
32
|
+
formatador (>= 0.2.4)
|
|
33
|
+
listen (>= 2.7, < 4.0)
|
|
34
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
35
|
+
nenv (~> 0.1)
|
|
36
|
+
notiffany (~> 0.0)
|
|
37
|
+
pry (>= 0.9.12)
|
|
38
|
+
shellany (~> 0.0)
|
|
39
|
+
thor (>= 0.18.1)
|
|
40
|
+
guard-compat (1.2.1)
|
|
41
|
+
guard-rspec (4.7.3)
|
|
42
|
+
guard (~> 2.1)
|
|
43
|
+
guard-compat (~> 1.1)
|
|
44
|
+
rspec (>= 2.99.0, < 4.0)
|
|
45
|
+
highline (2.0.3)
|
|
46
|
+
httparty (0.18.1)
|
|
47
|
+
mime-types (~> 3.0)
|
|
48
|
+
multi_xml (>= 0.5.2)
|
|
49
|
+
i18n (1.8.8)
|
|
50
|
+
concurrent-ruby (~> 1.0)
|
|
51
|
+
listen (3.4.1)
|
|
52
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
53
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
54
|
+
lumberjack (1.2.8)
|
|
55
|
+
method_source (1.0.0)
|
|
56
|
+
mime-types (3.3.1)
|
|
57
|
+
mime-types-data (~> 3.2015)
|
|
58
|
+
mime-types-data (3.2020.1104)
|
|
59
|
+
multi_xml (0.6.0)
|
|
60
|
+
multipart-post (2.1.1)
|
|
61
|
+
nenv (0.3.0)
|
|
62
|
+
notiffany (0.1.3)
|
|
63
|
+
nenv (~> 0.1)
|
|
64
|
+
shellany (~> 0.0)
|
|
65
|
+
octokit (4.20.0)
|
|
66
|
+
faraday (>= 0.9)
|
|
67
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
|
68
|
+
pry (0.14.0)
|
|
69
|
+
coderay (~> 1.1)
|
|
70
|
+
method_source (~> 1.0)
|
|
71
|
+
public_suffix (4.0.6)
|
|
72
|
+
rake (13.0.3)
|
|
73
|
+
rb-fsevent (0.10.4)
|
|
74
|
+
rb-inotify (0.10.1)
|
|
75
|
+
ffi (~> 1.0)
|
|
76
|
+
rspec (3.10.0)
|
|
77
|
+
rspec-core (~> 3.10.0)
|
|
78
|
+
rspec-expectations (~> 3.10.0)
|
|
79
|
+
rspec-mocks (~> 3.10.0)
|
|
80
|
+
rspec-core (3.10.1)
|
|
81
|
+
rspec-support (~> 3.10.0)
|
|
82
|
+
rspec-expectations (3.10.1)
|
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
84
|
+
rspec-support (~> 3.10.0)
|
|
85
|
+
rspec-mocks (3.10.2)
|
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
87
|
+
rspec-support (~> 3.10.0)
|
|
88
|
+
rspec-support (3.10.2)
|
|
89
|
+
ruby2_keywords (0.0.4)
|
|
90
|
+
sawyer (0.8.2)
|
|
91
|
+
addressable (>= 2.3.5)
|
|
92
|
+
faraday (> 0.8, < 2.0)
|
|
93
|
+
shellany (0.0.1)
|
|
94
|
+
terminal-table (1.8.0)
|
|
95
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
96
|
+
thor (1.1.0)
|
|
97
|
+
unicode-display_width (1.7.0)
|
|
98
|
+
|
|
99
|
+
PLATFORMS
|
|
100
|
+
x86_64-darwin-19
|
|
101
|
+
|
|
102
|
+
DEPENDENCIES
|
|
103
|
+
bundler (~> 2.2)
|
|
104
|
+
faker (~> 2.15)
|
|
105
|
+
git_helper!
|
|
106
|
+
guard-rspec (~> 4.3)
|
|
107
|
+
rake (~> 13.0)
|
|
108
|
+
rspec (~> 3.9)
|
|
109
|
+
|
|
110
|
+
BUNDLED WITH
|
|
111
|
+
2.2.9
|
data/README.md
CHANGED
|
@@ -27,6 +27,11 @@ To see what version of git_helper you're running, run:
|
|
|
27
27
|
git-helper --version
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
To help you create the `~/.git_helper/config.yml` file and set up the plugins (see below), run this command and allow the command to walk you through the prompts:
|
|
31
|
+
```bash
|
|
32
|
+
git-helper setup
|
|
33
|
+
```
|
|
34
|
+
|
|
30
35
|
## Plugin Usage
|
|
31
36
|
|
|
32
37
|
As an additional option, you can set each of the following commands to be a git plugin, meaning you can call them in a way that feels even more git-native:
|
|
@@ -46,7 +51,7 @@ unzip path/to/downloaded/plugins.zip -d ~/.git_helper
|
|
|
46
51
|
|
|
47
52
|
Now, the plugins will live in `~/.git_helper/plugins/*`. Add the following line to your `~/.bash_profile`:
|
|
48
53
|
|
|
49
|
-
```
|
|
54
|
+
```bash
|
|
50
55
|
export PATH=/path/to/computer/home/.git_helper/plugins:$PATH
|
|
51
56
|
```
|
|
52
57
|
|
data/bin/git-helper
CHANGED
|
@@ -17,6 +17,13 @@ DOCUMENTATION
|
|
|
17
17
|
see Git Helper's GitHub repo: https://github.com/emmahsax/git_helper
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
+
desc 'Sets up Git Helper configs at ~/.git_helper/*'
|
|
21
|
+
command 'setup' do |c|
|
|
22
|
+
c.action do ||
|
|
23
|
+
GitHelper::Setup.new.execute
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
20
27
|
arg :old_owner
|
|
21
28
|
arg :new_owner
|
|
22
29
|
desc "Update a repository's remote URLs from an old GitHub owner to a new owner."
|
|
@@ -8,12 +8,12 @@ module GitHelper
|
|
|
8
8
|
config_file[:github_token]
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
def git_config_file_path
|
|
12
|
+
Dir.pwd.scan(/\A\/[\w]*\/[\w]*\//).first << git_config_file
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
private def
|
|
16
|
-
|
|
15
|
+
private def config_file
|
|
16
|
+
YAML.load_file(git_config_file_path)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
private def git_config_file
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module GitHelper
|
|
2
|
+
class Setup
|
|
3
|
+
def execute
|
|
4
|
+
if config_file_exists?
|
|
5
|
+
answer = highline.ask_yes_no("It looks like the #{config_file} file already exists. Do you wish to replace it? (y/n)")
|
|
6
|
+
puts
|
|
7
|
+
else
|
|
8
|
+
answer = true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
create_or_update_config_file if answer
|
|
12
|
+
|
|
13
|
+
answer = highline.ask_yes_no("Do you wish to set up the Git Helper plugins? (y/n)")
|
|
14
|
+
|
|
15
|
+
if answer
|
|
16
|
+
create_or_update_plugin_files
|
|
17
|
+
puts "\nNow add this line to your ~/.bash_profile:\n export PATH=/path/to/computer/home/.git_helper/plugins:$PATH"
|
|
18
|
+
puts "\nDone!"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private def create_or_update_config_file
|
|
23
|
+
contents = generate_file_contents
|
|
24
|
+
puts "\nCreating or updating your #{config_file} file..."
|
|
25
|
+
File.open(config_file, 'w') { |file| file.puts contents }
|
|
26
|
+
puts "\nDone!\n\n"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private def config_file_exists?
|
|
30
|
+
File.exists?(config_file)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private def generate_file_contents
|
|
34
|
+
file_contents = ''
|
|
35
|
+
|
|
36
|
+
if highline.ask_yes_no("Do you wish to set up GitHub credentials? (y/n)")
|
|
37
|
+
file_contents << ":github_user: #{ask_question('GitHub username?')}\n"
|
|
38
|
+
file_contents << ":github_token: " \
|
|
39
|
+
"#{ask_question('GitHub personal access token? (Navigate to https://github.com/settings/tokens ' \
|
|
40
|
+
'to create a new personal access token)')}\n"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if highline.ask_yes_no("\nDo you wish to set up GitLab credentials? (y/n)")
|
|
44
|
+
file_contents << ":gitlab_user: #{ask_question('GitLab username?')}\n"
|
|
45
|
+
file_contents << ":gitlab_token: " \
|
|
46
|
+
"#{ask_question('GitLab personal access token? (Navigate to https://gitlab.com/-/profile/personal_access_tokens ' \
|
|
47
|
+
'to create a new personal access token)')}\n"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
file_contents.strip
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private def ask_question(prompt)
|
|
54
|
+
answer = highline.ask("\n#{prompt}")
|
|
55
|
+
|
|
56
|
+
if answer.empty?
|
|
57
|
+
puts "\nThis question is required."
|
|
58
|
+
ask_question(prompt)
|
|
59
|
+
else
|
|
60
|
+
answer
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private def highline
|
|
65
|
+
@highline ||= GitHelper::HighlineCli.new
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private def config_file
|
|
69
|
+
GitHelper::GitConfigReader.new.git_config_file_path
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private def create_or_update_plugin_files
|
|
73
|
+
plugins_dir = "#{Dir.pwd.scan(/\A\/[\w]*\/[\w]*\//).first}/.git_helper/plugins"
|
|
74
|
+
plugins_url = 'https://api.github.com/repos/emmahsax/git_helper/contents/plugins'
|
|
75
|
+
header = 'Accept: application/vnd.github.v3.raw'
|
|
76
|
+
|
|
77
|
+
Dir.mkdir(plugins_dir) unless File.exists?(plugins_dir)
|
|
78
|
+
|
|
79
|
+
all_plugins = JSON.parse(`curl -s -H "#{header}" -L "#{plugins_url}"`)
|
|
80
|
+
|
|
81
|
+
all_plugins.each do |plugin|
|
|
82
|
+
plugin_content = `curl -s -H "#{header}" -L "#{plugins_url}/#{plugin['name']}"`
|
|
83
|
+
File.open("#{plugins_dir}/#{plugin['name']}", 'w') { |file| file.puts plugin_content }
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
data/lib/git_helper/version.rb
CHANGED
|
@@ -133,6 +133,7 @@ describe GitHelper::CodeRequest do
|
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
+
# Unfortunately this test sometimes fails... just rerun the tests if it does
|
|
136
137
|
context 'when response is neither' do
|
|
137
138
|
it 'should raise an error' do
|
|
138
139
|
allow(highline_cli).to receive(:ask).and_return(Faker::Lorem.word)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'git_helper'
|
|
3
|
+
|
|
4
|
+
describe GitHelper::Setup do
|
|
5
|
+
let(:response) { double(:response, readline: true, to_s: Faker::Lorem.sentence) }
|
|
6
|
+
let(:highline_cli) { double(:highline_cli, ask: response, ask_yes_no: true) }
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(GitHelper::HighlineCli).to receive(:new).and_return(highline_cli)
|
|
10
|
+
allow(subject).to receive(:puts)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
after do
|
|
14
|
+
GitHelper::Setup.instance_variable_set("@highline", nil)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '#execute' do
|
|
18
|
+
it 'should ask a question if the config file exists' do
|
|
19
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
20
|
+
expect(highline_cli).to receive(:ask_yes_no).and_return(true)
|
|
21
|
+
allow(subject).to receive(:create_or_update_config_file).and_return(true)
|
|
22
|
+
allow(subject).to receive(:create_or_update_plugin_files)
|
|
23
|
+
subject.execute
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should call to create or update the config file' do
|
|
27
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
28
|
+
allow(highline_cli).to receive(:ask_yes_no).and_return(true)
|
|
29
|
+
expect(subject).to receive(:create_or_update_config_file).and_return(true)
|
|
30
|
+
allow(subject).to receive(:create_or_update_plugin_files)
|
|
31
|
+
subject.execute
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should skip if the user opts not to continue' do
|
|
35
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
36
|
+
allow(highline_cli).to receive(:ask_yes_no).and_return(false)
|
|
37
|
+
expect(subject).not_to receive(:create_or_update_config_file)
|
|
38
|
+
expect(subject).not_to receive(:create_or_update_plugin_files)
|
|
39
|
+
subject.execute
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe '#create_or_update_config_file' do
|
|
44
|
+
it 'should generate the file based on the answers to the questions' do
|
|
45
|
+
expect(subject).to receive(:generate_file_contents)
|
|
46
|
+
allow(File).to receive(:open).and_return(nil)
|
|
47
|
+
subject.send(:create_or_update_config_file)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'should open the file for writing' do
|
|
51
|
+
allow(subject).to receive(:generate_file_contents)
|
|
52
|
+
expect(File).to receive(:open).and_return(nil)
|
|
53
|
+
subject.send(:create_or_update_config_file)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe '#config_file_exists?' do
|
|
58
|
+
it 'should return true if the file exists' do
|
|
59
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
60
|
+
expect(subject.send(:config_file_exists?)).to eq(true)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'should return false if the file does not exist' do
|
|
64
|
+
allow(File).to receive(:exists?).and_return(false)
|
|
65
|
+
expect(subject.send(:config_file_exists?)).to eq(false)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe '#ask_question' do
|
|
70
|
+
it 'should use highline to ask a question' do
|
|
71
|
+
expect(highline_cli).to receive(:ask).and_return(Faker::Lorem.word)
|
|
72
|
+
subject.send(:ask_question, Faker::Lorem.sentence)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'should recurse if the highline client gets an empty string' do
|
|
76
|
+
allow(highline_cli).to receive(:ask).and_return('', Faker::Lorem.word)
|
|
77
|
+
expect(subject).to receive(:ask_question).at_least(:twice).and_call_original
|
|
78
|
+
subject.send(:ask_question, Faker::Lorem.sentence)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'should return the answer if it is given' do
|
|
82
|
+
answer = Faker::Lorem.sentence
|
|
83
|
+
allow(highline_cli).to receive(:ask).and_return(answer)
|
|
84
|
+
expect(subject.send(:ask_question, Faker::Lorem.sentence)).to be(answer)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
describe '#generate_file_contents' do
|
|
89
|
+
it 'should ask two yes/no questions' do
|
|
90
|
+
expect(highline_cli).to receive(:ask_yes_no).exactly(2).times.and_return(false)
|
|
91
|
+
subject.send(:generate_file_contents)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'should ask two additional questions for each time the user says yes' do
|
|
95
|
+
allow(highline_cli).to receive(:ask_yes_no).exactly(2).times.and_return(true, false)
|
|
96
|
+
expect(subject).to receive(:ask_question).exactly(2).times.and_return(Faker::Lorem.word)
|
|
97
|
+
subject.send(:generate_file_contents)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it 'should ask four additional questions for each time the user says yes' do
|
|
101
|
+
allow(highline_cli).to receive(:ask_yes_no).exactly(2).times.and_return(true)
|
|
102
|
+
expect(subject).to receive(:ask_question).exactly(4).times.and_return(Faker::Lorem.word)
|
|
103
|
+
subject.send(:generate_file_contents)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it 'should return a string no matter what' do
|
|
107
|
+
allow(highline_cli).to receive(:ask_yes_no).exactly(2).times.and_return(true)
|
|
108
|
+
allow(subject).to receive(:ask_question).exactly(4).times.and_return(Faker::Lorem.word)
|
|
109
|
+
expect(subject.send(:generate_file_contents)).to be_a(String)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
describe '#create_or_update_plugin_files' do
|
|
114
|
+
let(:plugins) do
|
|
115
|
+
[
|
|
116
|
+
{
|
|
117
|
+
'name': 'plugin-file-one'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
'name': 'plugin-file-two'
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
let(:plugins_json) do
|
|
126
|
+
"[
|
|
127
|
+
{
|
|
128
|
+
\"name\": \"plugin-file-one\"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
\"name\": \"plugin-file-two\"
|
|
132
|
+
}
|
|
133
|
+
]"
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
it 'should create the directory if it does not exist' do
|
|
137
|
+
allow(File).to receive(:exists?).and_return(false)
|
|
138
|
+
allow(File).to receive(:open).and_return(nil)
|
|
139
|
+
expect(Dir).to receive(:mkdir)
|
|
140
|
+
allow(subject).to receive(:`).and_return(plugins_json)
|
|
141
|
+
allow(JSON).to receive(:parse).and_return(plugins)
|
|
142
|
+
subject.send(:create_or_update_plugin_files)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it 'should not create the directory if it already exists' do
|
|
146
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
147
|
+
allow(File).to receive(:open).and_return(nil)
|
|
148
|
+
expect(Dir).not_to receive(:mkdir)
|
|
149
|
+
allow(subject).to receive(:`).and_return(plugins_json)
|
|
150
|
+
allow(JSON).to receive(:parse).and_return(plugins)
|
|
151
|
+
subject.send(:create_or_update_plugin_files)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it 'should curl the GitHub API' do
|
|
155
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
156
|
+
allow(File).to receive(:open).and_return(nil)
|
|
157
|
+
allow(subject).to receive(:`).and_return(plugins_json)
|
|
158
|
+
expect(JSON).to receive(:parse).with(plugins_json).and_return(plugins)
|
|
159
|
+
subject.send(:create_or_update_plugin_files)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it 'should go through the loop for each plugin' do
|
|
163
|
+
allow(File).to receive(:exists?).and_return(true)
|
|
164
|
+
allow(File).to receive(:open).and_return(nil)
|
|
165
|
+
expect(subject).to receive(:`).exactly(3).times
|
|
166
|
+
allow(JSON).to receive(:parse).and_return(plugins)
|
|
167
|
+
subject.send(:create_or_update_plugin_files)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
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.
|
|
4
|
+
version: 3.3.0
|
|
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-
|
|
11
|
+
date: 2021-02-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gitlab
|
|
@@ -145,6 +145,7 @@ extensions: []
|
|
|
145
145
|
extra_rdoc_files: []
|
|
146
146
|
files:
|
|
147
147
|
- Gemfile
|
|
148
|
+
- Gemfile.lock
|
|
148
149
|
- Guardfile
|
|
149
150
|
- LICENSE
|
|
150
151
|
- README.md
|
|
@@ -165,6 +166,7 @@ files:
|
|
|
165
166
|
- lib/git_helper/new_branch.rb
|
|
166
167
|
- lib/git_helper/octokit_client.rb
|
|
167
168
|
- lib/git_helper/pull_request.rb
|
|
169
|
+
- lib/git_helper/setup.rb
|
|
168
170
|
- lib/git_helper/version.rb
|
|
169
171
|
- plugins.zip
|
|
170
172
|
- spec/git_helper/change_remote_spec.rb
|
|
@@ -181,6 +183,7 @@ files:
|
|
|
181
183
|
- spec/git_helper/new_branch_spec.rb
|
|
182
184
|
- spec/git_helper/octokit_client_spec.rb
|
|
183
185
|
- spec/git_helper/pull_request_spec.rb
|
|
186
|
+
- spec/git_helper/setup_spec.rb
|
|
184
187
|
- spec/spec_helper.rb
|
|
185
188
|
homepage: https://github.com/emmahsax/git_helper
|
|
186
189
|
licenses:
|
|
@@ -221,3 +224,4 @@ test_files:
|
|
|
221
224
|
- spec/git_helper/new_branch_spec.rb
|
|
222
225
|
- spec/git_helper/octokit_client_spec.rb
|
|
223
226
|
- spec/git_helper/pull_request_spec.rb
|
|
227
|
+
- spec/git_helper/setup_spec.rb
|