chef-winrm-fs 1.4.2 → 1.4.4

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.
@@ -1,52 +1,52 @@
1
- trap {
2
- $e = $_.Exception
3
- $e.InvocationInfo.ScriptName
4
- do {
5
- $e.Message
6
- $e = $e.InnerException
7
- } while ($e)
8
- break
9
- }
10
-
11
- function folder($path){
12
- $path | ? {-not (test-path $_)} | % {$null = mkdir $_}
13
- }
14
-
15
- Function Decode-Files($hash) {
16
- foreach ($key in $hash.keys) {
17
- $value = $hash[$key]
18
- $tzip, $dst = $Value["tmpzip"], $Value["dst"]
19
- if ($tzip) {Unzip-File $tzip $dst}
20
- New-Object psobject -Property @{dst=$dst;src_sha1=$key;tmpzip=$tzip}
21
- }
22
- }
23
-
24
- Function Unzip-File($src, $dst) {
25
- $unpack = $src -replace '\.zip'
26
- $dst_parent = Split-Path -Path $dst -Parent
27
- if(!(Test-Path $dst_parent)) { $dst = $dst_parent }
28
- folder $unpack, $dst
29
- try {
30
- try{
31
- [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)
32
- }
33
- catch {
34
- Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop
35
- [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)
36
- }
37
- }
38
- catch {
39
- Try {
40
- $s = New-Object -ComObject Shell.Application
41
- ($s.NameSpace($unpack)).CopyHere(($s.NameSpace($src)).Items(), 0x610) | Out-Null
42
- }
43
- Finally {
44
- [void][Runtime.Interopservices.Marshal]::ReleaseComObject($s)
45
- }
46
- }
47
- dir $unpack | cp -dest "$dst/" -force -recurse
48
- rm $unpack -recurse -force
49
- }
50
-
51
- $hash_file = <%= hash_file %>
52
- Decode-Files $hash_file | ConvertTo-Csv -NoTypeInformation
1
+ trap {
2
+ $e = $_.Exception
3
+ $e.InvocationInfo.ScriptName
4
+ do {
5
+ $e.Message
6
+ $e = $e.InnerException
7
+ } while ($e)
8
+ break
9
+ }
10
+
11
+ function folder($path){
12
+ $path | ? {-not (test-path $_)} | % {$null = mkdir $_}
13
+ }
14
+
15
+ Function Decode-Files($hash) {
16
+ foreach ($key in $hash.keys) {
17
+ $value = $hash[$key]
18
+ $tzip, $dst = $Value["tmpzip"], $Value["dst"]
19
+ if ($tzip) {Unzip-File $tzip $dst}
20
+ New-Object psobject -Property @{dst=$dst;src_sha1=$key;tmpzip=$tzip}
21
+ }
22
+ }
23
+
24
+ Function Unzip-File($src, $dst) {
25
+ $unpack = $src -replace '\.zip'
26
+ $dst_parent = Split-Path -Path $dst -Parent
27
+ if(!(Test-Path $dst_parent)) { $dst = $dst_parent }
28
+ folder $unpack, $dst
29
+ try {
30
+ try{
31
+ [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)
32
+ }
33
+ catch {
34
+ Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop
35
+ [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)
36
+ }
37
+ }
38
+ catch {
39
+ Try {
40
+ $s = New-Object -ComObject Shell.Application
41
+ ($s.NameSpace($unpack)).CopyHere(($s.NameSpace($src)).Items(), 0x610) | Out-Null
42
+ }
43
+ Finally {
44
+ [void][Runtime.Interopservices.Marshal]::ReleaseComObject($s)
45
+ }
46
+ }
47
+ dir $unpack | cp -dest "$dst/" -force -recurse
48
+ rm $unpack -recurse -force
49
+ }
50
+
51
+ $hash_file = <%= hash_file %>
52
+ Decode-Files $hash_file | ConvertTo-Csv -NoTypeInformation
@@ -1,47 +1,54 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright 2015 Shawn Neal <sneal@sneal.net>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- require "erubi"
19
-
20
- module WinRM
21
- module FS
22
- # PS1 scripts
23
- module Scripts
24
- # rubocop:disable Metrics/MethodLength
25
- def self.render(template, context)
26
- # rubocop:enable Metrics/MethodLength
27
- template_path = File.expand_path(
28
- "#{File.dirname(__FILE__)}/#{template}.ps1.erb"
29
- )
30
- template = File.read(template_path)
31
- case context
32
- when Hash
33
- b = binding
34
- locals = context.collect { |k, _| "#{k} = context[#{k.inspect}]; " }
35
- b.eval(locals.join)
36
- when Binding
37
- b = context
38
- when NilClass
39
- b = binding
40
- else
41
- raise ArgumentError
42
- end
43
- b.eval(Erubi::Engine.new(template).src)
44
- end
45
- end
46
- end
47
- end
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright 2015 Shawn Neal <sneal@sneal.net>
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require "erubi"
19
+
20
+ module WinRM
21
+ module FS
22
+ # PS1 scripts
23
+ module Scripts
24
+ # Compiled template sources, keyed by template name. The .ps1.erb files
25
+ # ship inside the gem and cannot change while it is loaded, so reading
26
+ # and compiling one more than once is wasted work.
27
+ COMPILED = {} # rubocop:disable Style/MutableConstant
28
+
29
+ # rubocop:disable Metrics/MethodLength
30
+ def self.render(template, context)
31
+ # rubocop:enable Metrics/MethodLength
32
+ src = COMPILED[template] ||= begin
33
+ template_path = File.expand_path(
34
+ "#{File.dirname(__FILE__)}/#{template}.ps1.erb"
35
+ )
36
+ Erubi::Engine.new(File.read(template_path)).src.freeze
37
+ end
38
+ case context
39
+ when Hash
40
+ b = binding
41
+ locals = context.collect { |k, _| "#{k} = context[#{k.inspect}]; " }
42
+ b.eval(locals.join)
43
+ when Binding
44
+ b = context
45
+ when NilClass
46
+ b = binding
47
+ else
48
+ raise ArgumentError
49
+ end
50
+ b.eval(src)
51
+ end
52
+ end
53
+ end
54
+ end
data/lib/chef-winrm-fs.rb CHANGED
@@ -1,29 +1,28 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright 2015 Shawn Neal <sneal@sneal.net>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- require "chef-winrm" unless defined?(WinRM::Connection)
19
- require "logger"
20
- require "pathname" unless defined?(Pathname)
21
- require_relative "chef-winrm-fs/exceptions"
22
- require_relative "chef-winrm-fs/file_manager"
23
-
24
- module WinRM
25
- # WinRM File System
26
- module FS
27
- # Top level module code
28
- end
29
- end
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright 2015 Shawn Neal <sneal@sneal.net>
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require "chef-winrm" unless defined?(WinRM::Connection)
19
+ require "pathname" unless defined?(Pathname)
20
+ require_relative "chef-winrm-fs/exceptions"
21
+ require_relative "chef-winrm-fs/file_manager"
22
+
23
+ module WinRM
24
+ # WinRM File System
25
+ module FS
26
+ # Top level module code
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-winrm-fs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Neal
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-10-29 00:00:00.000000000 Z
12
+ date: 2026-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef-winrm
@@ -65,14 +65,14 @@ dependencies:
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: '3.4'
69
69
  type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: '3.4'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: csv
78
78
  requirement: !ruby/object:Gem::Requirement