winrm-transport 1.0.0 → 1.0.1
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/CHANGELOG.md +20 -0
 - data/README.md +1 -1
 - data/lib/winrm/transport/file_transporter.rb +5 -3
 - data/lib/winrm/transport/version.rb +1 -1
 - data/support/decode_files.ps1 +25 -35
 - data/winrm-transport.gemspec +0 -1
 - metadata +2 -16
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ed77e7070e00d3297d006565411a84fa4c7599b9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0d6ae6a15fb437ed6bb691cc937fe0d5125b08d2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 34d86ef488009afa559bed219b460745f2b74838b94eff8aca67ed225dd8ac1c84f65f56a18ac9a10e908b25cc7db9b039494f36d3c53da07195c470a1b78a9a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 12891bec59e93d70c6d0b85e9d368c3a2598977a9200c16fd86fb85390d7835f1b2b9e2df07db6131d29a236d0ffa86a81b57c67b3ccd4294a24c5db1c1548bf
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 1.0.1 / 2015-05-20
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ### Bug fixes
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Pull request [#4][]: Fix unpacking process for the compressed folders. ([@smurawski][])
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ### Improvements
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * Pull request [#6][]: Minor grammatical update to the README. ([@jmccann][])
         
     | 
| 
      
 10 
     | 
    
         
            +
            * Pull request [#5][]: Remove fakefs as a development dependency. ([@fnichol][])
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       1 
13 
     | 
    
         
             
            ## 1.0.0 / 2015-03-29
         
     | 
| 
       2 
14 
     | 
    
         | 
| 
       3 
15 
     | 
    
         
             
            The initial release.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            <!--- The following link definition list is generated by PimpMyChangelog --->
         
     | 
| 
      
 18 
     | 
    
         
            +
            [#4]: https://github.com/test-kitchen/winrm-transport/issues/4
         
     | 
| 
      
 19 
     | 
    
         
            +
            [#5]: https://github.com/test-kitchen/winrm-transport/issues/5
         
     | 
| 
      
 20 
     | 
    
         
            +
            [#6]: https://github.com/test-kitchen/winrm-transport/issues/6
         
     | 
| 
      
 21 
     | 
    
         
            +
            [@fnichol]: https://github.com/fnichol
         
     | 
| 
      
 22 
     | 
    
         
            +
            [@jmccann]: https://github.com/jmccann
         
     | 
| 
      
 23 
     | 
    
         
            +
            [@smurawski]: https://github.com/smurawski
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -27,7 +27,7 @@ Or install it yourself as: 
     | 
|
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            ## Usage
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
            This a library gem and doesn't have any CLI commands. There are 2 primary object classes:
         
     | 
| 
      
 30 
     | 
    
         
            +
            This is a library gem and doesn't have any CLI commands. There are 2 primary object classes:
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
            * [WinRM::Transport::CommandExecutor][command_executor]: an object which can
         
     | 
| 
       33 
33 
     | 
    
         
             
              execute multiple commands and PowerShell script in one shared remote shell
         
     | 
| 
         @@ -178,7 +178,6 @@ module WinRM 
     | 
|
| 
       178 
178 
     | 
    
         
             
                    debug { "Running check_files.ps1" }
         
     | 
| 
       179 
179 
     | 
    
         
             
                    hash_file = create_remote_hash_file(check_files_ps_hash(files))
         
     | 
| 
       180 
180 
     | 
    
         
             
                    vars = %{$hash_file = "#{hash_file}"\n}
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
181 
     | 
    
         
             
                    output = service.run_powershell_script(
         
     | 
| 
       183 
182 
     | 
    
         
             
                      [vars, check_files_script].join("\n")
         
     | 
| 
       184 
183 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -253,7 +252,10 @@ module WinRM 
     | 
|
| 
       253 
252 
     | 
    
         
             
                      vars = %{$hash_file = "#{hash_file}"\n}
         
     | 
| 
       254 
253 
     | 
    
         | 
| 
       255 
254 
     | 
    
         
             
                      output = service.run_powershell_script(
         
     | 
| 
       256 
     | 
    
         
            -
                        [vars, 
     | 
| 
      
 255 
     | 
    
         
            +
                        [vars,
         
     | 
| 
      
 256 
     | 
    
         
            +
                         ". #{decode_files_script}",
         
     | 
| 
      
 257 
     | 
    
         
            +
                         "Decode-Files (Invoke-Input $hash_file) | ConvertTo-Csv -NoTypeInformation"
         
     | 
| 
      
 258 
     | 
    
         
            +
                        ].join("\n")
         
     | 
| 
       257 
259 
     | 
    
         
             
                      )
         
     | 
| 
       258 
260 
     | 
    
         
             
                      parse_response(output)
         
     | 
| 
       259 
261 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -376,7 +378,7 @@ module WinRM 
     | 
|
| 
       376 
378 
     | 
    
         
             
                    if obj.is_a?(Hash)
         
     | 
| 
       377 
379 
     | 
    
         
             
                      obj.map { |k, v|
         
     | 
| 
       378 
380 
     | 
    
         
             
                        %{#{pad(depth + 2)}#{ps_hash(k)} = #{ps_hash(v, depth + 2)}}
         
     | 
| 
       379 
     | 
    
         
            -
                      }.join(" 
     | 
| 
      
 381 
     | 
    
         
            +
                      }.join(";\n").insert(0, "@{\n").insert(-1, "\n#{pad(depth)}}")
         
     | 
| 
       380 
382 
     | 
    
         
             
                    else
         
     | 
| 
       381 
383 
     | 
    
         
             
                      %{"#{obj}"}
         
     | 
| 
       382 
384 
     | 
    
         
             
                    end
         
     | 
    
        data/support/decode_files.ps1
    CHANGED
    
    | 
         @@ -1,60 +1,50 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            Function Cleanup($o) { if (($o 
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Function Decode-Base64File($src, $dst) {
         
     | 
| 
       4 
     | 
    
         
            -
              Try {
         
     | 
| 
       5 
     | 
    
         
            -
                $in = (Get-Item $src).OpenRead()
         
     | 
| 
       6 
     | 
    
         
            -
                $b64 = New-Object -TypeName System.Security.Cryptography.FromBase64Transform
         
     | 
| 
       7 
     | 
    
         
            -
                $m = [System.Security.Cryptography.CryptoStreamMode]::Read
         
     | 
| 
       8 
     | 
    
         
            -
                $d = New-Object -TypeName System.Security.Cryptography.CryptoStream $in,$b64,$m
         
     | 
| 
       9 
     | 
    
         
            -
                echo $null > $dst
         
     | 
| 
       10 
     | 
    
         
            -
                Copy-Stream $d ($out = [System.IO.File]::OpenWrite($dst))
         
     | 
| 
       11 
     | 
    
         
            -
              } Finally { Cleanup $in; Cleanup $out; Cleanup $d }
         
     | 
| 
       12 
     | 
    
         
            -
            }
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            Function Cleanup($o) { if (($o) -and ($o.GetType().GetMethod("Dispose") -ne $null)) { $o.Dispose() } }
         
     | 
| 
      
 2 
     | 
    
         
            +
            Function Decode-Base64File($src, $dst) {set-content -Encoding Byte -Path $dst -Value ([Convert]::FromBase64String([IO.File]::ReadAllLines($src)))}
         
     | 
| 
       14 
3 
     | 
    
         
             
            Function Copy-Stream($src, $dst) { $b = New-Object Byte[] 4096; while (($i = $src.Read($b, 0, $b.Length)) -ne 0) { $dst.Write($b, 0, $i) } }
         
     | 
| 
      
 4 
     | 
    
         
            +
            function Resolve-ProviderPath{ $input | % {if ($_){(Resolve-Path $_).ProviderPath} else{$null}} }
         
     | 
| 
      
 5 
     | 
    
         
            +
            Function Release-COM($o) { if ($o -ne $null) { [void][Runtime.Interopservices.Marshal]::ReleaseComObject($o) } }
         
     | 
| 
      
 6 
     | 
    
         
            +
            function Test-NETStack($Version, $r = 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4') { [bool]("$r\Full", "$r\Client" | ? {(gp $_).Version -like "$($Version)*"}) }
         
     | 
| 
      
 7 
     | 
    
         
            +
            function Test-IOCompression {($PSVersionTable.PSVersion.Major -ge 3) -and (Test-NETStack '4.5')}
         
     | 
| 
      
 8 
     | 
    
         
            +
            set-alias RPP -Value Resolve-ProviderPath
         
     | 
| 
       15 
9 
     | 
    
         | 
| 
       16 
10 
     | 
    
         
             
            Function Decode-Files($hash) {
         
     | 
| 
       17 
     | 
    
         
            -
              $hash. 
     | 
| 
       18 
     | 
    
         
            -
                $ 
     | 
| 
      
 11 
     | 
    
         
            +
              foreach ($key in $hash.keys) {
         
     | 
| 
      
 12 
     | 
    
         
            +
                $value = $hash[$key]
         
     | 
| 
      
 13 
     | 
    
         
            +
                $tmp, $tzip, $dst = $Key, $Value["tmpzip"], $Value["dst"]
         
     | 
| 
       19 
14 
     | 
    
         
             
                $sMd5 = (Get-Item $tmp).BaseName.Replace("b64-", "")
         
     | 
| 
       20 
     | 
    
         
            -
                $tzip, $dst = (Unresolve-Path $_.Value["tmpzip"]), (Unresolve-Path $_.Value["dst"])
         
     | 
| 
       21 
15 
     | 
    
         
             
                $decoded = if ($tzip -ne $null) { $tzip } else { $dst }
         
     | 
| 
       22 
16 
     | 
    
         
             
                Decode-Base64File $tmp $decoded
         
     | 
| 
       23 
17 
     | 
    
         
             
                Remove-Item $tmp -Force
         
     | 
| 
       24 
18 
     | 
    
         
             
                $dMd5 = Get-MD5Sum $decoded
         
     | 
| 
       25 
     | 
    
         
            -
                $verifies =  
     | 
| 
       26 
     | 
    
         
            -
                if ($tzip) { 
     | 
| 
      
 19 
     | 
    
         
            +
                $verifies = $sMd5 -like $dMd5
         
     | 
| 
      
 20 
     | 
    
         
            +
                if ($tzip) {Unzip-File $tzip $dst;Remove-Item $tzip -Force}
         
     | 
| 
       27 
21 
     | 
    
         
             
                New-Object psobject -Property @{ dst = $dst; verifies = $verifies; src_md5 = $sMd5; dst_md5 = $dMd5; tmpfile = $tmp; tmpzip = $tzip }
         
     | 
| 
       28 
     | 
    
         
            -
              } 
     | 
| 
      
 22 
     | 
    
         
            +
              }
         
     | 
| 
       29 
23 
     | 
    
         
             
            }
         
     | 
| 
       30 
24 
     | 
    
         | 
| 
       31 
25 
     | 
    
         
             
            Function Get-MD5Sum($src) {
         
     | 
| 
       32 
26 
     | 
    
         
             
              Try {
         
     | 
| 
       33 
     | 
    
         
            -
                $c = New-Object -TypeName  
     | 
| 
      
 27 
     | 
    
         
            +
                $c = New-Object -TypeName Security.Cryptography.MD5CryptoServiceProvider
         
     | 
| 
       34 
28 
     | 
    
         
             
                $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
         
     | 
| 
       35 
     | 
    
         
            -
                 
     | 
| 
       36 
     | 
    
         
            -
              }  
     | 
| 
      
 29 
     | 
    
         
            +
                ([BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
         
     | 
| 
      
 30 
     | 
    
         
            +
              } catch [exception]{throw $_} finally { Cleanup $c; Cleanup $in }
         
     | 
| 
       37 
31 
     | 
    
         
             
            }
         
     | 
| 
       38 
32 
     | 
    
         | 
| 
       39 
33 
     | 
    
         
             
            Function Invoke-Input($in) {
         
     | 
| 
       40 
     | 
    
         
            -
              $in =  
     | 
| 
      
 34 
     | 
    
         
            +
              $in = $in | rpp
         
     | 
| 
       41 
35 
     | 
    
         
             
              Decode-Base64File $in ($decoded = "$($in).ps1")
         
     | 
| 
       42 
36 
     | 
    
         
             
              $expr = Get-Content $decoded | Out-String
         
     | 
| 
       43 
37 
     | 
    
         
             
              Remove-Item $in,$decoded -Force
         
     | 
| 
       44 
     | 
    
         
            -
               
     | 
| 
      
 38 
     | 
    
         
            +
              Invoke-Expression "$expr"
         
     | 
| 
       45 
39 
     | 
    
         
             
            }
         
     | 
| 
       46 
40 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
            Function Release-COM($o) { if ($o -ne $null) { [void][System.Runtime.Interopservices.Marshal]::ReleaseComObject($o) } }
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            Function Unresolve-Path($p) { if ($p -eq $null) { return $null } else { return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($p) } }
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
41 
     | 
    
         
             
            Function Unzip-File($src, $dst) {
         
     | 
| 
       52 
     | 
    
         
            -
              $ 
     | 
| 
       53 
     | 
    
         
            -
              if ( 
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                Try { $s = New-Object -ComObject Shell.Application; ($dp = $s.NameSpace($dst)).CopyHere(($z = $s.NameSpace($src)).Items(), 0x610) } Finally { Release-Com $s; Release-Com $z; Release-COM $dp }
         
     | 
| 
      
 42 
     | 
    
         
            +
              $unpack = $src -replace '\.zip'
         
     | 
| 
      
 43 
     | 
    
         
            +
              if (Test-IOCompression) {Add-Type -AN System.IO.Compression.FileSystem; [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)}
         
     | 
| 
      
 44 
     | 
    
         
            +
              else {
         
     | 
| 
      
 45 
     | 
    
         
            +
                Try {$s = New-Object -ComObject Shell.Application; ($dp = $s.NameSpace($unpack)).CopyHere(($z = $s.NameSpace($src)).Items(), 0x610)} Finally {Release-Com $s; Release-Com $z; Release-COM $dp}
         
     | 
| 
       57 
46 
     | 
    
         
             
              }
         
     | 
| 
      
 47 
     | 
    
         
            +
              if (-not (test-path $dst)) {$null = mkdir $dst }
         
     | 
| 
      
 48 
     | 
    
         
            +
              dir $unpack | cp -dest "$dst/" -force -recurse
         
     | 
| 
      
 49 
     | 
    
         
            +
              rm $unpack -recurse -force
         
     | 
| 
       58 
50 
     | 
    
         
             
            }
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
            Decode-Files (Invoke-Input $hash_file) | ConvertTo-Csv -NoTypeInformation
         
     | 
    
        data/winrm-transport.gemspec
    CHANGED
    
    | 
         @@ -35,7 +35,6 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       35 
35 
     | 
    
         
             
              spec.add_development_dependency "bundler",    "~> 1.9"
         
     | 
| 
       36 
36 
     | 
    
         
             
              spec.add_development_dependency "rake",       "~> 10.0"
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              spec.add_development_dependency "fakefs",     "~> 0.4"
         
     | 
| 
       39 
38 
     | 
    
         
             
              spec.add_development_dependency "minitest"
         
     | 
| 
       40 
39 
     | 
    
         
             
              spec.add_development_dependency "mocha",      "~> 1.1"
         
     | 
| 
       41 
40 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: winrm-transport
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Fletcher Nichol
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-05-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: winrm
         
     | 
| 
         @@ -86,20 +86,6 @@ dependencies: 
     | 
|
| 
       86 
86 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       87 
87 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       88 
88 
     | 
    
         
             
                    version: '10.0'
         
     | 
| 
       89 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       90 
     | 
    
         
            -
              name: fakefs
         
     | 
| 
       91 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
     | 
    
         
            -
                requirements:
         
     | 
| 
       93 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       94 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       95 
     | 
    
         
            -
                    version: '0.4'
         
     | 
| 
       96 
     | 
    
         
            -
              type: :development
         
     | 
| 
       97 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       98 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       99 
     | 
    
         
            -
                requirements:
         
     | 
| 
       100 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       101 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       102 
     | 
    
         
            -
                    version: '0.4'
         
     | 
| 
       103 
89 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       104 
90 
     | 
    
         
             
              name: minitest
         
     | 
| 
       105 
91 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |