kpn_spec_methods 0.1.0 → 0.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 +5 -5
- data/lib/kpn_spec_methods/version.rb +1 -1
- data/lib/kpn_spec_methods.rb +78 -78
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5425abc1e76a63201e232c75184b9e9dfd37cbfd7c7a447d3a6d05387a41091a
|
4
|
+
data.tar.gz: 25872c326743acef284d686d61409b67f3d3038ee657b5e92bd7f4229fc01815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde97d3be8f89f6bc4ba3a8500bf1c493203e41821e29f117e395195039d5aef803387647c7070f4c9bcb9cfee4e3d7cf6086a89a0d509becf3577a487c8951c
|
7
|
+
data.tar.gz: 39b7009841d110463652097e4c75fd31e38a4e2f661a36df5b2f341d630ab5c93fa25f9951aca3691e83274814edb9baccb6eca496d0733be935b608d075eb66
|
data/lib/kpn_spec_methods.rb
CHANGED
@@ -1,78 +1,78 @@
|
|
1
|
-
# Static functions previously located in spec_helper_acceptance_methods.rb
|
2
|
-
|
3
|
-
module KpnSpecMethods
|
4
|
-
# Fetches all modules from the fixtures file
|
5
|
-
def self.clone_dependent_modules
|
6
|
-
fixtures = YAML.load_file('.fixtures.yml')['fixtures']
|
7
|
-
fixtures['repositories'].each do |module_name, value|
|
8
|
-
ssh_link =
|
9
|
-
if value.is_a?(Hash)
|
10
|
-
value['repo']
|
11
|
-
else
|
12
|
-
value
|
13
|
-
end
|
14
|
-
ref =
|
15
|
-
if value.is_a?(Hash) and value.has_key?('ref')
|
16
|
-
value['ref']
|
17
|
-
else
|
18
|
-
'
|
19
|
-
end
|
20
|
-
system("git clone --branch #{ref} #{ssh_link} spec/fixtures/modules/#{module_name}")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Standard way to copy modules by individual file transfer
|
25
|
-
def self.install_dependent_modules
|
26
|
-
fixtures = YAML.load_file('.fixtures.yml')['fixtures']
|
27
|
-
fixtures['repositories'].each do |module_name, value|
|
28
|
-
# Check metadata.json and only copy modules that support target OS
|
29
|
-
copy_module = true
|
30
|
-
if File.file?("./spec/fixtures/modules/#{module_name}/metadata.json")
|
31
|
-
metadata = JSON.parse(File.open("./spec/fixtures/modules/#{module_name}/metadata.json").read)
|
32
|
-
if metadata.key?("operatingsystem_support") and metadata["operatingsystem_support"].select { |os| os["operatingsystem"].downcase == fact('osfamily').downcase }.count == 0
|
33
|
-
copy_module = false
|
34
|
-
end
|
35
|
-
end
|
36
|
-
if copy_module
|
37
|
-
copy_module_to(hosts, :source => "./spec/fixtures/modules/#{module_name}", :module_name => module_name)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.log_msg(msg)
|
43
|
-
default.logger.notify "# #{msg}"
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.log_title(msg)
|
47
|
-
default.logger.notify "###### #{msg} ######"
|
48
|
-
end
|
49
|
-
|
50
|
-
# Quicker way to copy modules by archiving
|
51
|
-
def self.compress_copy_dependent_modules
|
52
|
-
# Determine OS family for tar or zip usage
|
53
|
-
os = host_inventory['facter']['kernel']
|
54
|
-
if os == 'windows'
|
55
|
-
compress_command = 'cd spec/fixtures/modules/; /usr/bin/zip -qr ../../../archive/modules.zip * -x *.git* ;cd -'
|
56
|
-
extract_command = 'powershell.exe -nologo -noprofile -command "& { Add-Type -A \'System.IO.Compression.FileSystem\'; [IO.Compression.ZipFile]::ExtractToDirectory(\'C:\ProgramData\PuppetLabs\code\modules\modulesarchive\modules.zip\', \'C:\ProgramData\PuppetLabs\code\modules\\\'); }"'
|
57
|
-
elsif os == 'Linux'
|
58
|
-
compress_command = "cd spec/fixtures/modules/; /usr/bin/tar -cf ../../../archive/modules.tar * --exclude='*.git'; cd -"
|
59
|
-
extract_command = 'tar -xf /etc/puppetlabs/code/modules/modulesarchive/modules.tar -C /etc/puppetlabs/code/modules/; rm -rf /etc/puppetlabs/code/modules/modulesarchive'
|
60
|
-
else
|
61
|
-
# Switch to old transfer if os is not found
|
62
|
-
print "\033[31m Warning: OS family fact could not be determined for module copying \n"
|
63
|
-
print "\033[31m Switching to sluggish old transfer... \n"
|
64
|
-
install_dependent_modules
|
65
|
-
return
|
66
|
-
end
|
67
|
-
|
68
|
-
# Archive the cloned modules
|
69
|
-
system('mkdir archive') unless File.directory?('archive')
|
70
|
-
system(compress_command)
|
71
|
-
|
72
|
-
# Copy the archive to machine
|
73
|
-
copy_module_to(hosts, source: 'archive', module_name: 'modulesarchive') if File.file?('archive/modules.tar' || 'archive/modules.zip')
|
74
|
-
hosts.each do |host|
|
75
|
-
on host, extract_command
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
1
|
+
# Static functions previously located in spec_helper_acceptance_methods.rb
|
2
|
+
|
3
|
+
module KpnSpecMethods
|
4
|
+
# Fetches all modules from the fixtures file
|
5
|
+
def self.clone_dependent_modules
|
6
|
+
fixtures = YAML.load_file('.fixtures.yml')['fixtures']
|
7
|
+
fixtures['repositories'].each do |module_name, value|
|
8
|
+
ssh_link =
|
9
|
+
if value.is_a?(Hash)
|
10
|
+
value['repo']
|
11
|
+
else
|
12
|
+
value
|
13
|
+
end
|
14
|
+
ref =
|
15
|
+
if value.is_a?(Hash) and value.has_key?('ref')
|
16
|
+
"--branch #{value['ref']}"
|
17
|
+
else
|
18
|
+
''
|
19
|
+
end
|
20
|
+
system("git clone --single-branch #{ref} #{ssh_link} spec/fixtures/modules/#{module_name}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Standard way to copy modules by individual file transfer
|
25
|
+
def self.install_dependent_modules
|
26
|
+
fixtures = YAML.load_file('.fixtures.yml')['fixtures']
|
27
|
+
fixtures['repositories'].each do |module_name, value|
|
28
|
+
# Check metadata.json and only copy modules that support target OS
|
29
|
+
copy_module = true
|
30
|
+
if File.file?("./spec/fixtures/modules/#{module_name}/metadata.json")
|
31
|
+
metadata = JSON.parse(File.open("./spec/fixtures/modules/#{module_name}/metadata.json").read)
|
32
|
+
if metadata.key?("operatingsystem_support") and metadata["operatingsystem_support"].select { |os| os["operatingsystem"].downcase == fact('osfamily').downcase }.count == 0
|
33
|
+
copy_module = false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
if copy_module
|
37
|
+
copy_module_to(hosts, :source => "./spec/fixtures/modules/#{module_name}", :module_name => module_name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.log_msg(msg)
|
43
|
+
default.logger.notify "# #{msg}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.log_title(msg)
|
47
|
+
default.logger.notify "###### #{msg} ######"
|
48
|
+
end
|
49
|
+
|
50
|
+
# Quicker way to copy modules by archiving
|
51
|
+
def self.compress_copy_dependent_modules
|
52
|
+
# Determine OS family for tar or zip usage
|
53
|
+
os = host_inventory['facter']['kernel']
|
54
|
+
if os == 'windows'
|
55
|
+
compress_command = 'cd spec/fixtures/modules/; /usr/bin/zip -qr ../../../archive/modules.zip * -x *.git* ;cd -'
|
56
|
+
extract_command = 'powershell.exe -nologo -noprofile -command "& { Add-Type -A \'System.IO.Compression.FileSystem\'; [IO.Compression.ZipFile]::ExtractToDirectory(\'C:\ProgramData\PuppetLabs\code\modules\modulesarchive\modules.zip\', \'C:\ProgramData\PuppetLabs\code\modules\\\'); }"'
|
57
|
+
elsif os == 'Linux'
|
58
|
+
compress_command = "cd spec/fixtures/modules/; /usr/bin/tar -cf ../../../archive/modules.tar * --exclude='*.git'; cd -"
|
59
|
+
extract_command = 'tar -xf /etc/puppetlabs/code/modules/modulesarchive/modules.tar -C /etc/puppetlabs/code/modules/; rm -rf /etc/puppetlabs/code/modules/modulesarchive'
|
60
|
+
else
|
61
|
+
# Switch to old transfer if os is not found
|
62
|
+
print "\033[31m Warning: OS family fact could not be determined for module copying \n"
|
63
|
+
print "\033[31m Switching to sluggish old transfer... \n"
|
64
|
+
install_dependent_modules
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
# Archive the cloned modules
|
69
|
+
system('mkdir archive') unless File.directory?('archive')
|
70
|
+
system(compress_command)
|
71
|
+
|
72
|
+
# Copy the archive to machine
|
73
|
+
copy_module_to(hosts, source: 'archive', module_name: 'modulesarchive') if File.file?('archive/modules.tar') || File.file?('archive/modules.zip')
|
74
|
+
hosts.each do |host|
|
75
|
+
on host, extract_command
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpn_spec_methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kpn
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.10
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- noreply@kpn.com
|
44
44
|
executables: []
|
@@ -52,7 +52,7 @@ licenses:
|
|
52
52
|
- Apache-2.0
|
53
53
|
metadata:
|
54
54
|
allowed_push_host: https://rubygems.org
|
55
|
-
post_install_message:
|
55
|
+
post_install_message:
|
56
56
|
rdoc_options: []
|
57
57
|
require_paths:
|
58
58
|
- lib
|
@@ -67,9 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
|
71
|
-
|
72
|
-
signing_key:
|
70
|
+
rubygems_version: 3.3.7
|
71
|
+
signing_key:
|
73
72
|
specification_version: 4
|
74
73
|
summary: This gem contains the spec acceptance helper methods that were previously
|
75
74
|
located in spec_helper_acceptance_methods.rb
|