modulesync 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -4
- data/.github/workflows/release.yml +1 -1
- data/.rubocop.yml +3 -48
- data/.rubocop_todo.yml +124 -19
- data/CHANGELOG.md +13 -0
- data/Gemfile +6 -5
- data/Rakefile +4 -11
- data/lib/modulesync/cli.rb +107 -107
- data/lib/modulesync/git_service/base.rb +2 -2
- data/lib/modulesync/git_service/github.rb +5 -5
- data/lib/modulesync/git_service/gitlab.rb +9 -9
- data/lib/modulesync/renderer.rb +1 -1
- data/lib/modulesync/repository.rb +2 -2
- data/lib/modulesync.rb +21 -21
- data/modulesync.gemspec +5 -9
- data/spec/helpers/faker/puppet_module_remote_repo.rb +4 -4
- data/spec/helpers/faker.rb +1 -0
- data/spec/unit/modulesync/git_service/factory_spec.rb +8 -2
- data/spec/unit/modulesync/git_service/github_spec.rb +23 -25
- data/spec/unit/modulesync/git_service/gitlab_spec.rb +26 -29
- data/spec/unit/modulesync/git_service_spec.rb +48 -47
- data/spec/unit/modulesync/settings_spec.rb +1 -1
- data/spec/unit/modulesync/source_code_spec.rb +5 -7
- metadata +21 -71
@@ -4,9 +4,9 @@ require 'modulesync/git_service'
|
|
4
4
|
describe ModuleSync::GitService do
|
5
5
|
before do
|
6
6
|
options = ModuleSync.config_defaults.merge({
|
7
|
-
|
8
|
-
|
9
|
-
ModuleSync.instance_variable_set
|
7
|
+
git_base: 'file:///tmp/dummy',
|
8
|
+
})
|
9
|
+
ModuleSync.instance_variable_set :@options, options
|
10
10
|
end
|
11
11
|
|
12
12
|
context 'when guessing the git service configuration' do
|
@@ -31,10 +31,10 @@ describe ModuleSync::GitService do
|
|
31
31
|
|
32
32
|
it 'build git service arguments from configuration entry' do
|
33
33
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
type: :gitlab,
|
35
|
+
endpoint: 'https://vcs.example.com/api/v4',
|
36
|
+
token: 'secret',
|
37
|
+
})
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -56,10 +56,10 @@ describe ModuleSync::GitService do
|
|
56
56
|
.and_return('secret')
|
57
57
|
|
58
58
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
type: :gitlab,
|
60
|
+
endpoint: 'https://vcs.example.com/api/v4',
|
61
|
+
token: 'secret',
|
62
|
+
})
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -70,20 +70,20 @@ describe ModuleSync::GitService do
|
|
70
70
|
.and_return('secret')
|
71
71
|
|
72
72
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
type: :gitlab,
|
74
|
+
endpoint: 'https://git.example.com/api/v4',
|
75
|
+
token: 'secret',
|
76
|
+
})
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
context 'without any environment variable sets' do
|
81
81
|
it 'returns a nil token' do
|
82
82
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
type: :gitlab,
|
84
|
+
endpoint: 'https://git.example.com/api/v4',
|
85
|
+
token: nil,
|
86
|
+
})
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -103,20 +103,20 @@ describe ModuleSync::GitService do
|
|
103
103
|
.and_return('secret')
|
104
104
|
|
105
105
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
type: :gitlab,
|
107
|
+
endpoint: 'https://gitlab.example.com/api/v4',
|
108
|
+
token: 'secret',
|
109
|
+
})
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
113
|
context 'without a GITLAB_TOKEN environment variable sets' do
|
114
114
|
it 'returns a nil token' do
|
115
115
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
type: :gitlab,
|
117
|
+
endpoint: 'https://gitlab.example.com/api/v4',
|
118
|
+
token: nil,
|
119
|
+
})
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -135,10 +135,10 @@ describe ModuleSync::GitService do
|
|
135
135
|
.and_return('secret')
|
136
136
|
|
137
137
|
expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
138
|
+
type: :github,
|
139
|
+
endpoint: 'https://vcs.example.com',
|
140
|
+
token: 'secret',
|
141
|
+
})
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -152,7 +152,7 @@ describe ModuleSync::GitService do
|
|
152
152
|
.with('GITLAB_TOKEN')
|
153
153
|
.and_return('secret')
|
154
154
|
|
155
|
-
expect{ModuleSync::GitService.configuration_for(sourcecode: sourcecode)}
|
155
|
+
expect { ModuleSync::GitService.configuration_for(sourcecode: sourcecode) }
|
156
156
|
.to raise_error ModuleSync::Error
|
157
157
|
end
|
158
158
|
end
|
@@ -163,31 +163,32 @@ describe ModuleSync::GitService do
|
|
163
163
|
RSpec.shared_examples 'hostname_extractor' do |url, hostname|
|
164
164
|
context "with '#{url}' URL" do
|
165
165
|
subject { ModuleSync::GitService::Base.extract_hostname(url) }
|
166
|
-
|
166
|
+
|
167
|
+
it "extracts #{hostname.nil? ? 'nil' : "'#{hostname}'"} as hostname" do
|
167
168
|
expect(subject).to eq(hostname)
|
168
169
|
end
|
169
170
|
end
|
170
171
|
end
|
171
172
|
|
172
|
-
|
173
|
+
describe '#extract_hostname' do
|
173
174
|
[
|
174
175
|
%w[ssh://user@host.xz:4444/path/to/repo.git/ host.xz],
|
175
|
-
%w[ssh://user@host.xz:/path/to/repo.git/
|
176
|
-
%w[ssh://host.xz/path/to/repo.git/
|
176
|
+
%w[ssh://user@host.xz:/path/to/repo.git/ host.xz],
|
177
|
+
%w[ssh://host.xz/path/to/repo.git/ host.xz],
|
177
178
|
|
178
|
-
%w[git://host.xz/path/to/repo.git/
|
179
|
-
%w[git://host.xz/path/to/repo/
|
180
|
-
%w[git://host.xz/path/to/repo
|
179
|
+
%w[git://host.xz/path/to/repo.git/ host.xz],
|
180
|
+
%w[git://host.xz/path/to/repo/ host.xz],
|
181
|
+
%w[git://host.xz/path/to/repo host.xz],
|
181
182
|
|
182
|
-
%w[user@host.xz:path/to/repo.git/
|
183
|
-
%w[user@host.xz:path/to/repo.git
|
184
|
-
%w[user@host.xz:path/to/repo
|
185
|
-
%w[host.xz:path/to/repo.git/
|
183
|
+
%w[user@host.xz:path/to/repo.git/ host.xz],
|
184
|
+
%w[user@host.xz:path/to/repo.git host.xz],
|
185
|
+
%w[user@host.xz:path/to/repo host.xz],
|
186
|
+
%w[host.xz:path/to/repo.git/ host.xz],
|
186
187
|
|
187
|
-
%w[https://host.xz:8443/path/to/repo.git/
|
188
|
-
%w[https://host.xz/path/to/repo.git/
|
188
|
+
%w[https://host.xz:8443/path/to/repo.git/ host.xz],
|
189
|
+
%w[https://host.xz/path/to/repo.git/ host.xz],
|
189
190
|
|
190
|
-
%w[ftp://host.xz/path/to/repo/
|
191
|
+
%w[ftp://host.xz/path/to/repo/ host.xz],
|
191
192
|
|
192
193
|
['/path/to/repo.git/', nil],
|
193
194
|
|
@@ -195,7 +196,7 @@ describe ModuleSync::GitService do
|
|
195
196
|
|
196
197
|
['something-invalid', nil],
|
197
198
|
].each do |url, hostname|
|
198
|
-
|
199
|
+
it_behaves_like 'hostname_extractor', url, hostname
|
199
200
|
end
|
200
201
|
end
|
201
202
|
end
|
@@ -1,17 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ModuleSync::SourceCode do
|
4
|
-
before do
|
5
|
-
options = ModuleSync.config_defaults.merge({
|
6
|
-
git_base: 'file:///tmp/dummy',
|
7
|
-
})
|
8
|
-
ModuleSync.instance_variable_set '@options', options
|
9
|
-
end
|
10
|
-
|
11
4
|
subject do
|
12
5
|
ModuleSync::SourceCode.new('namespace/name', nil)
|
13
6
|
end
|
14
7
|
|
8
|
+
before do
|
9
|
+
options = ModuleSync.config_defaults.merge({ git_base: 'file:///tmp/dummy' })
|
10
|
+
ModuleSync.instance_variable_set :@options, options
|
11
|
+
end
|
12
|
+
|
15
13
|
it 'has a repository namespace sets to "namespace"' do
|
16
14
|
expect(subject.repository_namespace).to eq 'namespace'
|
17
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modulesync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: cucumber
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,49 +67,7 @@ dependencies:
|
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.28.2
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.28.2
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-performance
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-rake
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-rspec
|
70
|
+
name: simplecov
|
127
71
|
requirement: !ruby/object:Gem::Requirement
|
128
72
|
requirements:
|
129
73
|
- - ">="
|
@@ -137,19 +81,19 @@ dependencies:
|
|
137
81
|
- !ruby/object:Gem::Version
|
138
82
|
version: '0'
|
139
83
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
84
|
+
name: voxpupuli-rubocop
|
141
85
|
requirement: !ruby/object:Gem::Requirement
|
142
86
|
requirements:
|
143
|
-
- - "
|
87
|
+
- - "~>"
|
144
88
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
89
|
+
version: '1.3'
|
146
90
|
type: :development
|
147
91
|
prerelease: false
|
148
92
|
version_requirements: !ruby/object:Gem::Requirement
|
149
93
|
requirements:
|
150
|
-
- - "
|
94
|
+
- - "~>"
|
151
95
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
96
|
+
version: '1.3'
|
153
97
|
- !ruby/object:Gem::Dependency
|
154
98
|
name: git
|
155
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,16 +126,22 @@ dependencies:
|
|
182
126
|
name: octokit
|
183
127
|
requirement: !ruby/object:Gem::Requirement
|
184
128
|
requirements:
|
185
|
-
- - "
|
129
|
+
- - ">="
|
186
130
|
- !ruby/object:Gem::Version
|
187
|
-
version: '4
|
131
|
+
version: '4'
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '7'
|
188
135
|
type: :runtime
|
189
136
|
prerelease: false
|
190
137
|
version_requirements: !ruby/object:Gem::Requirement
|
191
138
|
requirements:
|
192
|
-
- - "
|
139
|
+
- - ">="
|
193
140
|
- !ruby/object:Gem::Version
|
194
|
-
version: '4
|
141
|
+
version: '4'
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '7'
|
195
145
|
- !ruby/object:Gem::Dependency
|
196
146
|
name: puppet-blacksmith
|
197
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +151,7 @@ dependencies:
|
|
201
151
|
version: '3.0'
|
202
152
|
- - "<"
|
203
153
|
- !ruby/object:Gem::Version
|
204
|
-
version: '
|
154
|
+
version: '8'
|
205
155
|
type: :runtime
|
206
156
|
prerelease: false
|
207
157
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -211,7 +161,7 @@ dependencies:
|
|
211
161
|
version: '3.0'
|
212
162
|
- - "<"
|
213
163
|
- !ruby/object:Gem::Version
|
214
|
-
version: '
|
164
|
+
version: '8'
|
215
165
|
- !ruby/object:Gem::Dependency
|
216
166
|
name: thor
|
217
167
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
303
253
|
requirements:
|
304
254
|
- - ">="
|
305
255
|
- !ruby/object:Gem::Version
|
306
|
-
version: 2.
|
256
|
+
version: 2.7.0
|
307
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
258
|
requirements:
|
309
259
|
- - ">="
|