ruby-pwsh 0.10.0 → 0.10.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
  SHA256:
3
- metadata.gz: 350652f7e3803a522f6ad56512a75778277bef24bb3963fa9713522517f511cc
4
- data.tar.gz: '02500121972f8b43463d6e3db9d37ab7324bcecb521b0fc482a9540d1c7bb88b'
3
+ metadata.gz: bdcbcec4cceaa40f4fabaad50f9d7409382c14eb1a98a345af5770aa1ae78f31
4
+ data.tar.gz: 48f16a70a2305b398a9098d453ae743a6c2630a94cdc8d6716250e1e4ee83464
5
5
  SHA512:
6
- metadata.gz: 5f3e181119fc56713f3f326081ec0f84540308f8918425afc7b10e89baa6813456b3e369b98b7c7ae255484ba425dee0e00239cce5d98683b013d8971ad5d27a
7
- data.tar.gz: 0eaa28aeb753b121d46cd83127ff0dffdaa4cbf8bb0463b07b069fea0a339461a71d1746232e9cc3ad49413daa07b315c0a11b55eb85700f54bcda5667606db4
6
+ metadata.gz: 7c19486fd5452d81c71e7939fddaa78c66972ddb425806fc894b1aeecf0cb94b917955d29245130095ee5c4c85d63f2ba12176b6ef8fe4ce7e6f9f653bb0224c
7
+ data.tar.gz: b12c1ab52269745152a29ce446876a3e06f3b9f9aab1d254157d8f93c6cccb1e7f997c118488229e22d8800a1a1a17af0557a8c0af2ea386d3e80e80c2f5bfd0
data/.gitignore CHANGED
@@ -18,4 +18,6 @@ Gemfile.lock
18
18
  /ruby-pwsh-*.gem
19
19
 
20
20
  # Acceptance Testing fixtures
21
- /spec/fixtures/modules/
21
+ /spec/fixtures/modules/
22
+ /spec/fixtures/test.pp
23
+ /spec/fixtures/website/
data/CHANGELOG.md CHANGED
@@ -2,7 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
4
4
 
5
- ## [0.10.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.10.0) (2021-07-01)
5
+ ## [0.10.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.10.1) (2021-08-23)
6
+
7
+ [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.10.0...0.10.1)
8
+
9
+ ### Fixed
10
+
11
+ - \(GH-180\) Ensure instance\_key respects full uniqueness of options [\#181](https://github.com/puppetlabs/ruby-pwsh/pull/181) ([michaeltlombardi](https://github.com/michaeltlombardi))
12
+ - \(GH-165\) Ensure null-value nested cim instance arrays are appropriately munged [\#177](https://github.com/puppetlabs/ruby-pwsh/pull/177) ([michaeltlombardi](https://github.com/michaeltlombardi))
13
+
14
+ ## [0.10.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.10.0) (2021-07-02)
6
15
 
7
16
  [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.9.0...0.10.0)
8
17
 
data/Rakefile CHANGED
@@ -99,6 +99,63 @@ task :build_module do
99
99
  File.open('README.md', 'wb') { |file| file.write(actual_readme_content) }
100
100
  end
101
101
 
102
+ # Used in vendor_dsc_module
103
+ TAR_LONGLINK = '././@LongLink'
104
+
105
+ # Vendor a Puppetized DSC Module to spec/fixtures/modules.
106
+ #
107
+ # This is necessary because `puppet module install` fails on modules with
108
+ # long file paths, like xpsdesiredstateconfiguration
109
+ #
110
+ # @param command [String] command to execute.
111
+ # @return [Object] the standard out stream.
112
+ def vendor_dsc_module(name, version, destination)
113
+ require 'open-uri'
114
+ require 'rubygems/package'
115
+ require 'zlib'
116
+
117
+ module_uri = "https://forge.puppet.com/v3/files/dsc-#{name}-#{version}.tar.gz"
118
+ tar_gz_archive = File.expand_path("#{name}.tar.gz", ENV['TEMP'])
119
+
120
+ # Download the archive from the forge
121
+ File.open(tar_gz_archive, 'wb') do |file|
122
+ file.write(URI.open(module_uri).read) # rubocop:disable Security/Open
123
+ end
124
+
125
+ # Unzip to destination
126
+ # Taken directly from StackOverflow:
127
+ # - https://stackoverflow.com/a/19139114
128
+ Gem::Package::TarReader.new(Zlib::GzipReader.open(tar_gz_archive)) do |tar|
129
+ dest = nil
130
+ tar.each do |entry|
131
+ if entry.full_name == TAR_LONGLINK
132
+ dest = File.join(destination, entry.read.strip)
133
+ next
134
+ end
135
+ dest ||= File.join(destination, entry.full_name)
136
+ if entry.directory?
137
+ File.delete(dest) if File.file?(dest)
138
+ FileUtils.mkdir_p(dest, mode: entry.header.mode, verbose: false)
139
+ elsif entry.file?
140
+ FileUtils.rm_rf(dest) if File.directory?(dest)
141
+ File.open(dest, 'wb') do |f|
142
+ f.print(entry.read)
143
+ end
144
+ FileUtils.chmod(entry.header.mode, dest, verbose: false)
145
+ elsif entry.header.typeflag == '2' # Symlink!
146
+ File.symlink(entry.header.linkname, dest)
147
+ end
148
+ dest = nil
149
+ end
150
+ end
151
+
152
+ # Rename folder to just the module name, as needed by Puppet
153
+ Dir.glob("#{destination}/*#{name}*").each do |existing_folder|
154
+ new_folder = File.expand_path(name, destination)
155
+ FileUtils.mv(existing_folder, new_folder)
156
+ end
157
+ end
158
+
102
159
  namespace :dsc do
103
160
  namespace :acceptance do
104
161
  desc 'Prep for running DSC acceptance tests'
@@ -107,24 +164,21 @@ namespace :dsc do
107
164
  modules_folder = File.expand_path('spec/fixtures/modules', File.dirname(__FILE__))
108
165
  FileUtils.mkdir_p(modules_folder) unless Dir.exist?(modules_folder)
109
166
  # symlink the parent folder to the modules folder for puppet
110
- File.symlink(File.dirname(__FILE__), File.expand_path('pwshlib', modules_folder))
167
+ symlink_path = File.expand_path('pwshlib', modules_folder)
168
+ File.symlink(File.dirname(__FILE__), symlink_path) unless Dir.exist?(symlink_path)
111
169
  # Install each of the required modules for acceptance testing
112
170
  # Note: This only works for modules in the dsc namespace on the forge.
113
171
  puppetized_dsc_modules = [
114
172
  { name: 'powershellget', version: '2.2.5-0-1' },
115
- { name: 'jeadsc', version: '0.7.2-0-2' } # update to 0.7.2-0-3 on release
173
+ { name: 'jeadsc', version: '0.7.2-0-2' }, # update to 0.7.2-0-3 on release
174
+ { name: 'xpsdesiredstateconfiguration', version: '9.1.0-0-1' },
175
+ { name: 'xwebadministration', version: '3.2.0-0-2' },
176
+ { name: 'accesscontroldsc', version: '1.4.1-0-3' }
116
177
  ]
117
178
  puppetized_dsc_modules.each do |puppet_module|
118
179
  next if Dir.exist?(File.expand_path(puppet_module[:name], modules_folder))
119
180
 
120
- install_command = [
121
- 'bundle exec puppet module install',
122
- "dsc-#{puppet_module[:name]}",
123
- "--version #{puppet_module[:version]}",
124
- '--ignore-dependencies',
125
- "--target-dir #{modules_folder}"
126
- ].join(' ')
127
- run_local_command(install_command)
181
+ vendor_dsc_module(puppet_module[:name], puppet_module[:version], modules_folder)
128
182
  end
129
183
  end
130
184
  RSpec::Core::RakeTask.new(:spec) do |t|
@@ -115,7 +115,7 @@ Function ConvertTo-CanonicalResult {
115
115
  }
116
116
 
117
117
  if ($Property.Definition -match 'InstanceArray') {
118
- If ($Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
118
+ If ($null -eq $Value -or $Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
119
119
  }
120
120
 
121
121
  $ResultObject.$PropertyName = $Value
data/lib/pwsh/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Pwsh
4
4
  # The version of the ruby-pwsh gem
5
- VERSION = '0.10.0'
5
+ VERSION = '0.10.1'
6
6
  end
data/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puppetlabs-pwshlib",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "author": "puppetlabs",
5
5
  "summary": "Provide library code for interoperating with PowerShell.",
6
6
  "license": "MIT",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-pwsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-02 00:00:00.000000000 Z
11
+ date: 2021-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PowerShell code manager for ruby.
14
14
  email: