beaker-module_install_helper 0.1.2 → 0.1.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335eced6501675a1215d9492779c7efca77c62bc
|
4
|
+
data.tar.gz: 32c5045a4faed8fc92bc44e019164f6d711b9176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e39c82c94044ee48d18d07004b47dd0e55dc90427f976e924a49044c6416c1d2a7080dda980420372a7947f62bd04fd87ef518736152f79fdb27b55ce180d6
|
7
|
+
data.tar.gz: 23e6824f988c904633fde2338bce5fb72c4950a1cefa093df1113cbc43ef1551ea43dbc9b772c3e0855066e07acd797c890dc66a47c03a7aca1ccb31d46f39fb
|
@@ -86,7 +86,7 @@ module Beaker::ModuleInstallHelper
|
|
86
86
|
# and upper bounds. The function then uses the forge rest endpoint to find
|
87
87
|
# the most recent release of the given module matching the version requirement
|
88
88
|
def module_version_from_requirement(mod_name, vr_str)
|
89
|
-
uri = URI("#{forge_api}
|
89
|
+
uri = URI("#{forge_api}v3/modules/#{mod_name}")
|
90
90
|
response = Net::HTTP.get(uri)
|
91
91
|
forge_data = JSON.parse(response)
|
92
92
|
|
@@ -170,18 +170,24 @@ module Beaker::ModuleInstallHelper
|
|
170
170
|
|
171
171
|
def forge_host
|
172
172
|
fh = ENV['BEAKER_FORGE_HOST']
|
173
|
-
|
173
|
+
unless fh.nil?
|
174
|
+
fh = 'https://' + fh if fh !~ /^(https:\/\/|http:\/\/)/i
|
175
|
+
fh += '/' unless fh != /\/$/
|
176
|
+
return fh
|
177
|
+
end
|
178
|
+
|
174
179
|
'https://forge.puppet.com/'
|
175
180
|
end
|
176
181
|
|
177
182
|
def forge_api
|
178
|
-
fh = forge_host
|
179
|
-
return 'https://forgeapi.puppetlabs.com' if fh == 'https://forge.puppet.com/'
|
180
|
-
|
181
183
|
fa = ENV['BEAKER_FORGE_API']
|
182
|
-
|
184
|
+
unless fa.nil?
|
185
|
+
fa = 'https://' + fa if fa !~ /^(https:\/\/|http:\/\/)/i
|
186
|
+
fa += '/' unless fa != /\/$/
|
187
|
+
return fa
|
188
|
+
end
|
183
189
|
|
184
|
-
|
190
|
+
'https://forgeapi.puppetlabs.com/'
|
185
191
|
end
|
186
192
|
end
|
187
193
|
|
@@ -242,27 +242,16 @@ describe Beaker::ModuleInstallHelper do
|
|
242
242
|
allow(ENV).to receive(:[]).with('BEAKER_FORGE_HOST').and_return(nil)
|
243
243
|
allow(ENV).to receive(:[]).with('BEAKER_FORGE_API').and_return(nil)
|
244
244
|
|
245
|
-
expect(forge_api).to eq('https://forgeapi.puppetlabs.com')
|
245
|
+
expect(forge_api).to eq('https://forgeapi.puppetlabs.com/')
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
249
249
|
context 'with BEAKER_FORGE_HOST and BEAKER_FORGE_API env variables specified' do
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
allow(ENV).to receive(:[]).with('BEAKER_FORGE_API').and_return('an-api-url')
|
250
|
+
it 'returns specified forge api with trailing slash' do
|
251
|
+
allow(ENV).to receive(:[]).with('BEAKER_FORGE_HOST').and_return('custom')
|
252
|
+
allow(ENV).to receive(:[]).with('BEAKER_FORGE_API').and_return('an-api-url/')
|
254
253
|
|
255
|
-
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
context 'with trailing slash' do
|
260
|
-
it 'returns specified forge api without trailing slash' do
|
261
|
-
allow(ENV).to receive(:[]).with('BEAKER_FORGE_HOST').and_return('custom')
|
262
|
-
allow(ENV).to receive(:[]).with('BEAKER_FORGE_API').and_return('an-api-url/')
|
263
|
-
|
264
|
-
expect(forge_api).to eq('an-api-url')
|
265
|
-
end
|
254
|
+
expect(forge_api).to eq('https://an-api-url/')
|
266
255
|
end
|
267
256
|
end
|
268
257
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-module_install_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|