cem_win_spec 0.1.12 → 0.1.14
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 +1 -1
- data/exe/cem-win-spec +4 -4
- data/lib/cem_win_spec/test_runner.rb +21 -0
- data/lib/cem_win_spec/version.rb +1 -1
- data/lib/cem_win_spec/win_exec/cmd/base_cmd.rb +23 -4
- data/lib/cem_win_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d4530fab1780a403202924db23059ee908aee18579749d5309aeda74f73e1ad
|
|
4
|
+
data.tar.gz: a5b9e26782c793d8ccafa9cd95cec199acd2fddc04bb7d8366c637140f020d05
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 768194d5fea142be421c43082de2820c79a8d406bee1ce97b4e59a80182078de8fbeb2648a33271f40970d98d14156cc9a9854c6e5ee6b06c066be13f90070df
|
|
7
|
+
data.tar.gz: 40aed8c14cd610c59438f6b97f869f99563fbb38ce7a48cdda33b10041c2d72dafd143253a84ccf94acd6a98af7ddf4f6d6ec521f624462171c7dec9aaa0efa1
|
data/Gemfile.lock
CHANGED
data/exe/cem-win-spec
CHANGED
|
@@ -20,9 +20,9 @@ parser = OptionParser.new do |opts|
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
opts.on('-p', '--puppet-version [VERSION]', 'Puppet version to test against') do |version|
|
|
23
|
-
unless %w[7 8].include?(version)
|
|
23
|
+
unless %w[7 8 9].include?(version)
|
|
24
24
|
warn "Unknown Puppet version: #{version}"
|
|
25
|
-
warn 'Valid versions are: 7, 8'
|
|
25
|
+
warn 'Valid versions are: 7, 8, 9'
|
|
26
26
|
puts opts
|
|
27
27
|
exit 1
|
|
28
28
|
end
|
|
@@ -30,9 +30,9 @@ parser = OptionParser.new do |opts|
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
opts.on('-r', '--ruby-version [VERSION]', 'Ruby version to test against') do |version|
|
|
33
|
-
unless %w[2 3].include?(version)
|
|
33
|
+
unless %w[2 3 4].include?(version)
|
|
34
34
|
warn "Unknown Ruby version: #{version}"
|
|
35
|
-
warn 'Valid versions are: 2, 3'
|
|
35
|
+
warn 'Valid versions are: 2, 3, 4'
|
|
36
36
|
puts opts
|
|
37
37
|
exit 1
|
|
38
38
|
end
|
|
@@ -66,6 +66,27 @@ module CemWinSpec
|
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
def install_ruby(**opts)
|
|
70
|
+
new_command('Install ruby', **opts) do
|
|
71
|
+
tool_dir = remote_ruby_tool_dir
|
|
72
|
+
choco_ver = remote_choco_ruby_version
|
|
73
|
+
ruby_ver = remote_ruby_version
|
|
74
|
+
next unless tool_dir && choco_ver && ruby_ver
|
|
75
|
+
|
|
76
|
+
remote_run(
|
|
77
|
+
[
|
|
78
|
+
"$rubyBin = '#{tool_dir}\\bin'",
|
|
79
|
+
"$uList = (uru ls 2>&1 | Out-String)",
|
|
80
|
+
"if (-not (Test-Path $rubyBin)) { choco install ruby --version=#{choco_ver} -y --no-progress }",
|
|
81
|
+
"if ($uList -notmatch '#{ruby_ver}') { uru admin add $rubyBin }",
|
|
82
|
+
],
|
|
83
|
+
ruby_cmd: false,
|
|
84
|
+
add_envs: false,
|
|
85
|
+
chdir: false,
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
69
90
|
def setup_ruby(**opts)
|
|
70
91
|
@setup_ruby ||= new_command('Set up ruby', **opts) do
|
|
71
92
|
remote_run(
|
data/lib/cem_win_spec/version.rb
CHANGED
|
@@ -11,10 +11,17 @@ module CemWinSpec
|
|
|
11
11
|
PUPPET_VER_TO_RUBY_VER = {
|
|
12
12
|
'7' => '278',
|
|
13
13
|
'8' => '322',
|
|
14
|
+
'9' => '405',
|
|
14
15
|
}.freeze
|
|
15
16
|
TOOL_DIR_BY_RUBY_VER = {
|
|
16
|
-
'278' => 'C
|
|
17
|
-
'322' => 'C
|
|
17
|
+
'278' => 'C:\tools\ruby\2.7.8',
|
|
18
|
+
'322' => 'C:\tools\ruby\3.2.2',
|
|
19
|
+
'405' => 'C:\tools\ruby\4.0.5',
|
|
20
|
+
}.freeze
|
|
21
|
+
CHOCO_VERSION_BY_RUBY_VER = {
|
|
22
|
+
'278' => '2.7.8',
|
|
23
|
+
'322' => '3.2.2',
|
|
24
|
+
'405' => '4.0.5',
|
|
18
25
|
}.freeze
|
|
19
26
|
|
|
20
27
|
attr_accessor :working_dir, :env_vars, :puppet_version
|
|
@@ -34,8 +41,8 @@ module CemWinSpec
|
|
|
34
41
|
end
|
|
35
42
|
|
|
36
43
|
ver = value.to_s
|
|
37
|
-
raise ArgumentError, 'puppet_version only supports major versions 7 and
|
|
38
|
-
unless ver.match?(/^(7|8)(\.\d+)?\.\d+$/)
|
|
44
|
+
raise ArgumentError, 'puppet_version only supports major versions 7, 8, and 9' unless ver.match?(/^(7|8|9).*/)
|
|
45
|
+
unless ver.match?(/^(7|8|9)(\.\d+)?\.\d+$/)
|
|
39
46
|
ver = "#{ver}.0"
|
|
40
47
|
end
|
|
41
48
|
|
|
@@ -73,6 +80,18 @@ module CemWinSpec
|
|
|
73
80
|
PUPPET_VER_TO_RUBY_VER[puppet_version.split('.')[0]]
|
|
74
81
|
end
|
|
75
82
|
|
|
83
|
+
def ruby_tool_dir
|
|
84
|
+
return nil unless ruby_version
|
|
85
|
+
|
|
86
|
+
TOOL_DIR_BY_RUBY_VER[ruby_version]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def choco_ruby_version
|
|
90
|
+
return nil unless ruby_version
|
|
91
|
+
|
|
92
|
+
CHOCO_VERSION_BY_RUBY_VER[ruby_version]
|
|
93
|
+
end
|
|
94
|
+
|
|
76
95
|
# Formats the command to be run
|
|
77
96
|
# @param cmd [String, Array[String]] the command to be run
|
|
78
97
|
# @param ruby_cmd [Boolean] Whether the command is a ruby command and should be ran
|
data/lib/cem_win_spec.rb
CHANGED
|
@@ -51,6 +51,7 @@ module CemWinSpec
|
|
|
51
51
|
sre_out = setup_remote_environment(runner)
|
|
52
52
|
working_dir = sre_out.stdout.chomp
|
|
53
53
|
logger.debug "Working dir: #{working_dir}"
|
|
54
|
+
install_ruby(runner, **options)
|
|
54
55
|
upload_out = upload_module(runner, working_dir)
|
|
55
56
|
module_dir = upload_out.stdout.chomp
|
|
56
57
|
logger.debug "Module dir: #{module_dir}"
|
|
@@ -128,6 +129,12 @@ module CemWinSpec
|
|
|
128
129
|
end
|
|
129
130
|
end
|
|
130
131
|
|
|
132
|
+
def self.install_ruby(runner, **opts)
|
|
133
|
+
validate_output(no_output_strat: :debug) do
|
|
134
|
+
runner.install_ruby(**opts).run
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
131
138
|
def self.setup_remote_ruby(runner, module_dir, **opts)
|
|
132
139
|
validate_output do
|
|
133
140
|
runner.setup_ruby(operation_timeout: 300,
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cem_win_spec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Heston Snodgrass
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: winrm
|