beaker-module_install_helper 0.1.0 → 0.1.1

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: a1a5d53299f555a39466b8de21cb35006475c29c
4
- data.tar.gz: c636a1beb7956aee0a2f169e176d683e6c3d1f2d
3
+ metadata.gz: 7ede48efbad22234618a4c29a6c867159ea71185
4
+ data.tar.gz: 4419511fba9522e71a5000fdce82c936ba4d58e6
5
5
  SHA512:
6
- metadata.gz: e6cbf3cc5e7c67da196b3e65ca8076f1b71c5cee693eb7c4b2f05a499382d7262e3f68f4b3302ff1e45d7ba22117fca86eb570bfdb80b8417ef430c0d69727dd
7
- data.tar.gz: a0b526e752430e0dbf37d2c92947a751781b0af24c830110488a4b54a0afc491808e3a79fef3e439a50b9fdef65483894cf51052114502e09326ade80fb5a12d
6
+ metadata.gz: 6304cb076b5e74fb961e55f09153c9e21a8834c0a2ba1aead19c2edd95c856d1166b1e2be3f6b57ae2fbeedb0b82bf2ad30feb25b89b77f42ea0ea9840683b83
7
+ data.tar.gz: 674f7c0c5b9f90d0eca68f0faa6922ffec5e924adf6d6be68399b2d0133f38fc3bd9e360644b199d50ee1a2fecb3c497c93fc9b916d2ef77a3c0292b9867ebd2
@@ -18,6 +18,9 @@ Lint/AmbiguousRegexpLiteral:
18
18
  Style/ClassAndModuleChildren:
19
19
  Enabled: false
20
20
 
21
+ Style/GlobalVars:
22
+ Enabled: false
23
+
21
24
  Bundler/DuplicatedGem:
22
25
  Enabled: false
23
26
 
@@ -28,4 +31,4 @@ Metrics/LineLength:
28
31
  Max: 100
29
32
 
30
33
  Metrics/MethodLength:
31
- Enabled: false
34
+ Enabled: false
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'beaker-module_install_helper'
7
- spec.version = '0.1.0'
7
+ spec.version = '0.1.1'
8
8
  spec.authors = ['Puppet']
9
9
  spec.email = ['wilson@puppet.com']
10
10
 
@@ -15,24 +15,25 @@ module Beaker::ModuleInstallHelper
15
15
  # the source on the local machine
16
16
  def install_module_on(host)
17
17
  copy_module_to(host,
18
- source: @module_source_dir,
18
+ source: $module_source_dir,
19
19
  module_name: module_name_from_metadata)
20
20
  end
21
21
 
22
22
  # This method calls the install_module_dependencies_on method for each
23
23
  # host which is a master, or if no master is present, on all agent nodes.
24
24
  def install_module_dependencies
25
- hosts_to_install_module_on.each do |host|
26
- install_module_dependencies_on(host)
27
- end
25
+ install_module_dependencies_on(host)
28
26
  end
29
27
 
30
28
  # This method will install the module under tests module dependencies on the
31
29
  # specified host from the dependencies list in metadata.json
32
30
  def install_module_dependencies_on(host)
31
+ host = [host] if host.is_a?(Hash)
33
32
  deps = module_dependencies_from_metadata
34
- deps.each do |dep|
35
- install_puppet_module_via_pmt_on(host, dep)
33
+ host.each do |hst|
34
+ deps.each do |dep|
35
+ install_puppet_module_via_pmt_on(hst, dep)
36
+ end
36
37
  end
37
38
  end
38
39
 
@@ -70,7 +71,7 @@ module Beaker::ModuleInstallHelper
70
71
 
71
72
  # Here we iterate the releases of the given module and pick the most recent
72
73
  # that matches to version requirement
73
- forge_data['releases'].sort_by { |k| k['version'] }.reverse.each do |rel|
74
+ forge_data['releases'].each do |rel|
74
75
  return rel['version'] if vrs.all? { |vr| vr.match?('', rel['version']) }
75
76
  end
76
77
 
@@ -120,9 +121,9 @@ module Beaker::ModuleInstallHelper
120
121
  # This method uses the module_source_directory path to read the metadata.json
121
122
  # file into a json array
122
123
  def module_metadata
123
- metadata_path = "#{@module_source_dir}/metadata.json"
124
+ metadata_path = "#{$module_source_dir}/metadata.json"
124
125
  unless File.exist?(metadata_path)
125
- raise "Error loading metadata.json file from #{@module_source_dir}"
126
+ raise "Error loading metadata.json file from #{$module_source_dir}"
126
127
  end
127
128
  JSON.parse(File.read(metadata_path))
128
129
  end
@@ -147,4 +148,4 @@ end
147
148
 
148
149
  include Beaker::ModuleInstallHelper
149
150
  # Use the caller (requirer) of this file to begin search for module source dir
150
- @module_source_dir = get_module_source_directory caller[0][/[^:]+/]
151
+ $module_source_dir = get_module_source_directory caller[0][/[^:]+/]
@@ -35,7 +35,7 @@ describe Beaker::ModuleInstallHelper do
35
35
 
36
36
  context 'module_metadata' do
37
37
  before do
38
- @module_source_dir = '/a/b/c/d'
38
+ $module_source_dir = '/a/b/c/d'
39
39
  allow(File).to receive(:exist?)
40
40
  .with('/a/b/c/d/metadata.json')
41
41
  .and_return(true)
@@ -71,7 +71,7 @@ describe Beaker::ModuleInstallHelper do
71
71
  let(:module_source_dir) { '/a/b/c/d' }
72
72
 
73
73
  before do
74
- @module_source_dir = '/a/b/c/d'
74
+ $module_source_dir = '/a/b/c/d'
75
75
  allow(File).to receive(:exist?).and_return(true)
76
76
  allow(File).to receive(:read).and_return('{"name": "puppetlabs-vcsrepo"}')
77
77
 
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec