ruby-pwsh 0.6.3 → 0.7.0

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: 06ed8290e061a3f294b067867612332e2d48bb2e8d13e54f884d9681ce1f72c3
4
- data.tar.gz: c5f9507058ff31dda8f97b732adfd9a046580b58f8b04d369f3d6ab98b3fcaf1
3
+ metadata.gz: f8334c3715e69873cda019ad2010187d15ad34a2b593426b567d056a4a1fc364
4
+ data.tar.gz: e66f5fccc419fc4d315c7db3def945bb3108d57c756bf55e5205039d1963c6c3
5
5
  SHA512:
6
- metadata.gz: f0500d503a3faf6f40983b823d00d0acf0f6b72d3f01f651a51755d5a78787143f89950450b241f646b6b756be1d0f95c3f28d2c7bf8edfdc753c44f60892b3f
7
- data.tar.gz: 2f7834903250dd77a18ffc81120ec1c48ae8a5facc8f32988542abe0e3af5ce8d30a1d1a795c806f7b295eb33a438967ddfa69165ce8bb9a351bf37e6c177abb
6
+ metadata.gz: 2522c738352df33e552c0fa26b48113b95b65ceece2cc03bbb48d731df5e1fc623ec8590e18b8152205fb07ff33fc1f1f1892ccbc6e399a729a61732385a48c7
7
+ data.tar.gz: 43c5e11f365df85d1b45978bc3ae8855668bd97168ac24ef9d3bffd77b9e4a709b0eb71872d19b63c0225f2c08061dfa346d8e2c7fd52133afd283c14db54b2c
@@ -2,6 +2,18 @@
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.7.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.0) (2021-01-20)
6
+
7
+ [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.3...0.7.0)
8
+
9
+ ### Added
10
+
11
+ - \(GH-75\) Including module name in vendored module path [\#85](https://github.com/puppetlabs/ruby-pwsh/pull/85) ([pmcmaw](https://github.com/pmcmaw))
12
+
13
+ ### Fixed
14
+
15
+ - Make root module path use puppetized module name [\#86](https://github.com/puppetlabs/ruby-pwsh/pull/86) ([michaeltlombardi](https://github.com/michaeltlombardi))
16
+
5
17
  ## [0.6.3](https://github.com/puppetlabs/ruby-pwsh/tree/0.6.3) (2020-12-16)
6
18
 
7
19
  [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.2...0.6.3)
@@ -70,6 +82,10 @@ All notable changes to this project will be documented in this file.The format i
70
82
 
71
83
  [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.3.0...0.4.0)
72
84
 
85
+ ### Added
86
+
87
+ - \(MODULES-10389\) Add puppet feature for dependent modules to leverage [\#20](https://github.com/puppetlabs/ruby-pwsh/pull/20) ([sanfrancrisko](https://github.com/sanfrancrisko))
88
+
73
89
  ## [0.3.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.3.0) (2019-12-04)
74
90
 
75
91
  [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.2.0...0.3.0)
@@ -358,17 +358,47 @@ class Puppet::Provider::DscBaseProvider
358
358
  # Because Puppet adds all of the modules to the LOAD_PATH we can be sure that the appropriate module lives here during an apply;
359
359
  # PROBLEM: This currently uses the downcased name, we need to capture the module name in the metadata I think.
360
360
  # During a Puppet agent run, the code lives in the cache so we can use the file expansion to discover the correct folder.
361
- root_module_path = $LOAD_PATH.select { |path| path.match?(%r{#{resource[:dscmeta_module_name].downcase}/lib}) }.first
361
+ root_module_path = $LOAD_PATH.select { |path| path.match?(%r{#{puppetize_name(resource[:dscmeta_module_name])}/lib}) }.first
362
362
  resource[:vendored_modules_path] = if root_module_path.nil?
363
363
  File.expand_path(Pathname.new(__FILE__).dirname + '../../../' + 'puppet_x/dsc_resources') # rubocop:disable Style/StringConcatenation
364
364
  else
365
365
  File.expand_path("#{root_module_path}/puppet_x/dsc_resources")
366
366
  end
367
+
368
+ # This handles setting the vendored_modules_path to include the puppet module name
369
+ # We now add the puppet module name into the path to allow multiple modules to with shared dsc_resources to be installed side by side
370
+ # The old vendored_modules_path: puppet_x/dsc_resources
371
+ # The new vendored_modules_path: puppet_x/<module_name>/dsc_resources
372
+ unless File.exist? resource[:vendored_modules_path]
373
+ resource[:vendored_modules_path] = if root_module_path.nil?
374
+ File.expand_path(Pathname.new(__FILE__).dirname + '../../../' + "puppet_x/#{puppetize_name(resource[:dscmeta_module_name])}/dsc_resources") # rubocop:disable Style/StringConcatenation
375
+ else
376
+ File.expand_path("#{root_module_path}/puppet_x/#{puppetize_name(resource[:dscmeta_module_name])}/dsc_resources")
377
+ end
378
+ end
379
+
380
+ # A warning is thrown if the something went wrong and the file was not created
381
+ raise "Unable to find expected vendored DSC Resource #{resource[:vendored_modules_path]}" unless File.exist? resource[:vendored_modules_path]
382
+
367
383
  resource[:attributes] = nil
384
+
368
385
  context.debug("should_to_resource: #{resource.inspect}")
369
386
  resource
370
387
  end
371
388
 
389
+ # Return a String containing a puppetized name. A puppetized name is a string that only
390
+ # includes lowercase letters, digits, underscores and cannot start with a digit.
391
+ #
392
+ # @return [String] with a puppeized module name
393
+ def puppetize_name(name)
394
+ # Puppet module names must be lower case
395
+ name = name.downcase
396
+ # Puppet module names must only include lowercase letters, digits and underscores
397
+ name = name.gsub(/[^a-z0-9_]/, '_')
398
+ # Puppet module names must not start with a number so if it does, append the letter 'a' to the name. Eg: '7zip' becomes 'a7zip'
399
+ name = name.match?(/^\d/) ? "a#{name}" : name # rubocop:disable Lint/UselessAssignment
400
+ end
401
+
372
402
  # Return a UUID with the dashes turned into underscores to enable the specifying of guaranteed-unique
373
403
  # variables in the PowerShell script.
374
404
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Pwsh
4
4
  # The version of the ruby-pwsh gem
5
- VERSION = '0.6.3'
5
+ VERSION = '0.7.0'
6
6
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puppetlabs-pwshlib",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
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.6.3
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-16 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PowerShell code manager for ruby.
14
14
  email:
@@ -54,7 +54,7 @@ metadata:
54
54
  homepage_uri: https://github.com/puppetlabs/ruby-pwsh
55
55
  source_code_uri: https://github.com/puppetlabs/ruby-pwsh
56
56
  changelog_uri: https://github.com/puppetlabs/ruby-pwsh
57
- post_install_message:
57
+ post_install_message:
58
58
  rdoc_options: []
59
59
  require_paths:
60
60
  - lib
@@ -69,9 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubyforge_project:
73
- rubygems_version: 2.7.6
74
- signing_key:
72
+ rubygems_version: 3.1.4
73
+ signing_key:
75
74
  specification_version: 4
76
75
  summary: PowerShell code manager for ruby.
77
76
  test_files: []