ruby-pwsh 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -25
- data/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb +3 -0
- data/lib/pwsh/version.rb +1 -1
- data/spec/acceptance/dsc/basic.rb +205 -0
- data/spec/acceptance/dsc/cim_instances.rb +82 -0
- data/spec/acceptance/dsc/class.rb +129 -0
- data/spec/acceptance/dsc/complex.rb +139 -0
- data/spec/exit-27.ps1 +1 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb +2026 -0
- data/spec/unit/pwsh/util_spec.rb +286 -0
- data/spec/unit/pwsh/version_spec.rb +10 -0
- data/spec/unit/pwsh/windows_powershell_spec.rb +116 -0
- data/spec/unit/pwsh_spec.rb +823 -0
- metadata +14 -19
- data/.gitattributes +0 -2
- data/.github/workflows/ci.yml +0 -109
- data/.gitignore +0 -23
- data/.pmtignore +0 -21
- data/.rspec +0 -3
- data/CHANGELOG.md +0 -204
- data/CODEOWNERS +0 -2
- data/CONTRIBUTING.md +0 -155
- data/DESIGN.md +0 -70
- data/Gemfile +0 -54
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -188
- data/design-comms.png +0 -0
- data/metadata.json +0 -82
- data/pwshlib.md +0 -92
- data/ruby-pwsh.gemspec +0 -39
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.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PowerShell code manager for ruby.
|
14
14
|
email:
|
@@ -17,21 +17,8 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".gitattributes"
|
21
|
-
- ".github/workflows/ci.yml"
|
22
|
-
- ".gitignore"
|
23
|
-
- ".pmtignore"
|
24
|
-
- ".rspec"
|
25
20
|
- ".rubocop.yml"
|
26
|
-
- CHANGELOG.md
|
27
|
-
- CODEOWNERS
|
28
|
-
- CONTRIBUTING.md
|
29
|
-
- DESIGN.md
|
30
|
-
- Gemfile
|
31
|
-
- LICENSE.txt
|
32
21
|
- README.md
|
33
|
-
- Rakefile
|
34
|
-
- design-comms.png
|
35
22
|
- lib/puppet/feature/pwshlib.rb
|
36
23
|
- lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb
|
37
24
|
- lib/puppet/provider/dsc_base_provider/invoke_dsc_resource_functions.ps1
|
@@ -44,9 +31,17 @@ files:
|
|
44
31
|
- lib/ruby-pwsh.rb
|
45
32
|
- lib/templates/RubyPwsh.cs
|
46
33
|
- lib/templates/init.ps1
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
34
|
+
- spec/acceptance/dsc/basic.rb
|
35
|
+
- spec/acceptance/dsc/cim_instances.rb
|
36
|
+
- spec/acceptance/dsc/class.rb
|
37
|
+
- spec/acceptance/dsc/complex.rb
|
38
|
+
- spec/exit-27.ps1
|
39
|
+
- spec/spec_helper.rb
|
40
|
+
- spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb
|
41
|
+
- spec/unit/pwsh/util_spec.rb
|
42
|
+
- spec/unit/pwsh/version_spec.rb
|
43
|
+
- spec/unit/pwsh/windows_powershell_spec.rb
|
44
|
+
- spec/unit/pwsh_spec.rb
|
50
45
|
homepage: https://github.com/puppetlabs/ruby-pwsh
|
51
46
|
licenses:
|
52
47
|
- MIT
|
@@ -69,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
64
|
- !ruby/object:Gem::Version
|
70
65
|
version: '0'
|
71
66
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
67
|
+
rubygems_version: 3.1.6
|
73
68
|
signing_key:
|
74
69
|
specification_version: 4
|
75
70
|
summary: PowerShell code manager for ruby.
|
data/.gitattributes
DELETED
data/.github/workflows/ci.yml
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
schedule:
|
6
|
-
- cron: "0 0 * * *"
|
7
|
-
workflow_dispatch:
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
rubocop:
|
11
|
-
runs-on: ${{ matrix.os }}
|
12
|
-
strategy:
|
13
|
-
fail-fast: false
|
14
|
-
matrix:
|
15
|
-
os:
|
16
|
-
- windows-latest
|
17
|
-
- ubuntu-latest
|
18
|
-
ruby: ["2.7"]
|
19
|
-
steps:
|
20
|
-
- name: Checkout Source
|
21
|
-
uses: actions/checkout@v2
|
22
|
-
- name: Activate Ruby
|
23
|
-
uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
26
|
-
bundler-cache: true
|
27
|
-
- name: Print Test Environment
|
28
|
-
run: |
|
29
|
-
ruby -v
|
30
|
-
gem -v
|
31
|
-
bundle -v
|
32
|
-
pwsh -v
|
33
|
-
- name: Run Rubocop Tests
|
34
|
-
run: |
|
35
|
-
bundle exec rake rubocop
|
36
|
-
spec:
|
37
|
-
runs-on: ${{ matrix.os }}
|
38
|
-
strategy:
|
39
|
-
fail-fast: false
|
40
|
-
matrix:
|
41
|
-
os:
|
42
|
-
- windows-latest
|
43
|
-
- windows-2016
|
44
|
-
- ubuntu-latest
|
45
|
-
- ubuntu-18.04
|
46
|
-
ruby: ["2.5", "2.7"]
|
47
|
-
steps:
|
48
|
-
- name: Checkout Source
|
49
|
-
uses: actions/checkout@v2
|
50
|
-
- name: Activate Ruby
|
51
|
-
uses: ruby/setup-ruby@v1
|
52
|
-
with:
|
53
|
-
ruby-version: ${{ matrix.ruby }}
|
54
|
-
bundler-cache: true
|
55
|
-
- name: Print Test Environment
|
56
|
-
run: |
|
57
|
-
ruby -v
|
58
|
-
gem -v
|
59
|
-
bundle -v
|
60
|
-
pwsh -v
|
61
|
-
- name: Run Spec Tests
|
62
|
-
run: |
|
63
|
-
bundle exec rake spec
|
64
|
-
acceptance-dsc:
|
65
|
-
runs-on: ${{ matrix.os }}
|
66
|
-
strategy:
|
67
|
-
fail-fast: false
|
68
|
-
matrix:
|
69
|
-
os:
|
70
|
-
- windows-latest
|
71
|
-
- windows-2016
|
72
|
-
puppet:
|
73
|
-
- 6
|
74
|
-
- 7
|
75
|
-
include:
|
76
|
-
- puppet: 6
|
77
|
-
ruby: 2.5
|
78
|
-
- puppet: 7
|
79
|
-
ruby: 2.7
|
80
|
-
env:
|
81
|
-
PUPPET_GEM_VERSION: ${{ matrix.puppet }}
|
82
|
-
steps:
|
83
|
-
- name: Checkout Source
|
84
|
-
uses: actions/checkout@v2
|
85
|
-
- name: Activate Ruby
|
86
|
-
uses: ruby/setup-ruby@v1
|
87
|
-
with:
|
88
|
-
ruby-version: ${{ matrix.ruby }}
|
89
|
-
bundler-cache: true
|
90
|
-
- name: Print Test Environment
|
91
|
-
run: |
|
92
|
-
ruby -v
|
93
|
-
gem -v
|
94
|
-
bundle -v
|
95
|
-
pwsh -v
|
96
|
-
- name: Ensure WinRM is working
|
97
|
-
shell: powershell
|
98
|
-
run: |
|
99
|
-
Get-ChildItem WSMan:\localhost\Listener\ -OutVariable Listeners | Format-List * -Force
|
100
|
-
$HTTPListener = $Listeners | Where-Object -FilterScript { $_.Keys.Contains('Transport=HTTP') }
|
101
|
-
If ($HTTPListener.Count -eq 0) {
|
102
|
-
winrm create winrm/config/Listener?Address=*+Transport=HTTP
|
103
|
-
winrm e winrm/config/listener
|
104
|
-
}
|
105
|
-
- name: Run Acceptance Tests
|
106
|
-
shell: powershell
|
107
|
-
run: |
|
108
|
-
bundle exec rake dsc:acceptance:spec_prep
|
109
|
-
bundle exec rake dsc:acceptance:spec
|
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/_yardoc/
|
4
|
-
/coverage/
|
5
|
-
/doc/
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/tmp/
|
9
|
-
/bin/
|
10
|
-
|
11
|
-
# rspec failure tracking
|
12
|
-
.rspec_status
|
13
|
-
|
14
|
-
Gemfile.local
|
15
|
-
Gemfile.lock
|
16
|
-
|
17
|
-
# build output
|
18
|
-
/ruby-pwsh-*.gem
|
19
|
-
|
20
|
-
# Acceptance Testing fixtures
|
21
|
-
/spec/fixtures/modules/
|
22
|
-
/spec/fixtures/test.pp
|
23
|
-
/spec/fixtures/website/
|
data/.pmtignore
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
.bundle
|
2
|
-
.yardoc
|
3
|
-
doc
|
4
|
-
.git
|
5
|
-
spec
|
6
|
-
.gitattributes
|
7
|
-
.gitignore
|
8
|
-
.rspec
|
9
|
-
.rspec_status
|
10
|
-
.rubocop.yml
|
11
|
-
.travis.yml
|
12
|
-
CODEOWNERS
|
13
|
-
CONTRIBUTING.md
|
14
|
-
design-comms.png
|
15
|
-
DESIGN.md
|
16
|
-
pwshlib.md
|
17
|
-
Gemfile
|
18
|
-
Gemfile.lock
|
19
|
-
Rakefile
|
20
|
-
ruby-pwsh.gemspec
|
21
|
-
*.gem
|
data/.rspec
DELETED
data/CHANGELOG.md
DELETED
@@ -1,204 +0,0 @@
|
|
1
|
-
# Change log
|
2
|
-
|
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
|
-
|
5
|
-
## [v0.10.2](https://github.com/puppetlabs/ruby-pwsh/tree/v0.10.2) - 2022-06-24
|
6
|
-
|
7
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.10.1...v0.10.2)
|
8
|
-
|
9
|
-
### Fixed
|
10
|
-
|
11
|
-
- (GH-188) Filter current environment variables [#189](https://github.com/puppetlabs/ruby-pwsh/pull/189) ([chelnak](https://github.com/chelnak))
|
12
|
-
|
13
|
-
## [0.10.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.10.1) (2021-08-23)
|
14
|
-
|
15
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.10.0...0.10.1)
|
16
|
-
|
17
|
-
### Fixed
|
18
|
-
|
19
|
-
- \(GH-180\) Ensure instance\_key respects full uniqueness of options [\#181](https://github.com/puppetlabs/ruby-pwsh/pull/181) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
20
|
-
- \(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))
|
21
|
-
|
22
|
-
## [0.10.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.10.0) (2021-07-02)
|
23
|
-
|
24
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.9.0...0.10.0)
|
25
|
-
|
26
|
-
### Added
|
27
|
-
|
28
|
-
- \(GH-172\) Enable use of class-based DSC Resources by munging PSModulePath [\#173](https://github.com/puppetlabs/ruby-pwsh/pull/173) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
29
|
-
|
30
|
-
## [0.9.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.9.0) (2021-06-28)
|
31
|
-
|
32
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.8.0...0.9.0)
|
33
|
-
|
34
|
-
### Added
|
35
|
-
|
36
|
-
- \(GH-147\) Refactor Invocation methods to use shared helper and write error logs when appropriate [\#152](https://github.com/puppetlabs/ruby-pwsh/pull/152) ([david22swan](https://github.com/david22swan))
|
37
|
-
- \(GH-145\) Improve DSC secrets redaction [\#150](https://github.com/puppetlabs/ruby-pwsh/pull/150) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
38
|
-
- \(GH-145\) Add insync? and invoke\_test\_method to dsc provider [\#124](https://github.com/puppetlabs/ruby-pwsh/pull/124) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
39
|
-
- \(MAINT\) Clarify supported platforms [\#113](https://github.com/puppetlabs/ruby-pwsh/pull/113) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
40
|
-
|
41
|
-
### Fixed
|
42
|
-
|
43
|
-
- \(IAC-1657\) Fix for invalid DateTime value error in `invoke_get_method` [\#169](https://github.com/puppetlabs/ruby-pwsh/pull/169) ([david22swan](https://github.com/david22swan))
|
44
|
-
- \(GH-154\) Ensure values returned from `invoke_get_method` are recursively sorted in the DSC Base Provider to reduce canonicalization warnings. [\#160](https://github.com/puppetlabs/ruby-pwsh/pull/160) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
45
|
-
- \(GH-154\) Fix return data from `Invoke-DscResource` for empty strings and single item arrays in DSC Base Provider [\#159](https://github.com/puppetlabs/ruby-pwsh/pull/159) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
46
|
-
- \(GH-155\) Fix CIM Instance munging in `invoke_get_method` for DSC Base Provider [\#158](https://github.com/puppetlabs/ruby-pwsh/pull/158) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
47
|
-
- \(GH-154\) Fix canonicalization in `get` method for DSC Base Provider [\#157](https://github.com/puppetlabs/ruby-pwsh/pull/157) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
48
|
-
- \(GH-144\) Enable order-insensitive comparisons for DSC [\#151](https://github.com/puppetlabs/ruby-pwsh/pull/151) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
49
|
-
- \(GH-143\) Handle order insensitive arrays in the `same?` method of the DSC Base Provider [\#148](https://github.com/puppetlabs/ruby-pwsh/pull/148) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
50
|
-
- \(GH-127\) Canonicalize enums correctly [\#131](https://github.com/puppetlabs/ruby-pwsh/pull/131) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
51
|
-
- \(GH-125\) Fix dsc provider canonicalization for absent resources [\#129](https://github.com/puppetlabs/ruby-pwsh/pull/129) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
52
|
-
- \(MODULES-11051\) Ensure environment variables are not incorrectly munged in the PowerShell Host [\#128](https://github.com/puppetlabs/ruby-pwsh/pull/128) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
53
|
-
- \(MODULES-11026\) Ensure the PowerShell manager works with v7 [\#122](https://github.com/puppetlabs/ruby-pwsh/pull/122) ([n3snah](https://github.com/n3snah))
|
54
|
-
- \(Maint\) Ensure canonicalize correctly compares sorted hashes [\#118](https://github.com/puppetlabs/ruby-pwsh/pull/118) ([Hvid](https://github.com/Hvid))
|
55
|
-
|
56
|
-
## [0.8.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.8.0) (2021-03-01)
|
57
|
-
|
58
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.7.4...0.8.0)
|
59
|
-
|
60
|
-
## [0.7.4](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.4) (2021-02-12)
|
61
|
-
|
62
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.7.3...0.7.4)
|
63
|
-
|
64
|
-
### Fixed
|
65
|
-
|
66
|
-
- \(GH-105\) Ensure set runs on ambiguous ensure states [\#108](https://github.com/puppetlabs/ruby-pwsh/pull/108) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
67
|
-
- \(GH-105\) Ensure canonicalized\_cache check validates against namevar [\#107](https://github.com/puppetlabs/ruby-pwsh/pull/107) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
68
|
-
|
69
|
-
## [0.7.3](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.3) (2021-02-03)
|
70
|
-
|
71
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.7.2...0.7.3)
|
72
|
-
|
73
|
-
### Fixed
|
74
|
-
|
75
|
-
- \(MAINT\) Place nil check when assigning is\_same [\#101](https://github.com/puppetlabs/ruby-pwsh/pull/101) ([bwilcox](https://github.com/bwilcox))
|
76
|
-
|
77
|
-
## [0.7.2](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.2) (2021-02-03)
|
78
|
-
|
79
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.7.1...0.7.2)
|
80
|
-
|
81
|
-
### Fixed
|
82
|
-
|
83
|
-
- \(GH-97\) Memoize class variables in initialize [\#98](https://github.com/puppetlabs/ruby-pwsh/pull/98) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
84
|
-
- \(MAINT\) Ensure is\_same check works for nil manifest values [\#96](https://github.com/puppetlabs/ruby-pwsh/pull/96) ([bwilcox](https://github.com/bwilcox))
|
85
|
-
|
86
|
-
## [0.7.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.1) (2021-02-02)
|
87
|
-
|
88
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.7.0...0.7.1)
|
89
|
-
|
90
|
-
### Fixed
|
91
|
-
|
92
|
-
- \(MAINT\) Correctly canonicalize enumerable values in dsc [\#92](https://github.com/puppetlabs/ruby-pwsh/pull/92) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
93
|
-
- \(MAINT\) Ensure vendored path check works with mix of module builds [\#91](https://github.com/puppetlabs/ruby-pwsh/pull/91) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
94
|
-
- \(GH-84\) Fix empty array parameter check [\#90](https://github.com/puppetlabs/ruby-pwsh/pull/90) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
95
|
-
- \(MAINT\) Minor fixes to CIM instance handling [\#89](https://github.com/puppetlabs/ruby-pwsh/pull/89) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
96
|
-
|
97
|
-
## [0.7.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.0) (2021-01-20)
|
98
|
-
|
99
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.3...0.7.0)
|
100
|
-
|
101
|
-
### Added
|
102
|
-
|
103
|
-
- \(GH-75\) Including module name in vendored module path [\#85](https://github.com/puppetlabs/ruby-pwsh/pull/85) ([pmcmaw](https://github.com/pmcmaw))
|
104
|
-
|
105
|
-
### Fixed
|
106
|
-
|
107
|
-
- Make root module path use puppetized module name [\#86](https://github.com/puppetlabs/ruby-pwsh/pull/86) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
108
|
-
|
109
|
-
## [0.6.3](https://github.com/puppetlabs/ruby-pwsh/tree/0.6.3) (2020-12-16)
|
110
|
-
|
111
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.2...0.6.3)
|
112
|
-
|
113
|
-
### Fixed
|
114
|
-
|
115
|
-
- \(MAINT\) Add handling for when dsc\_ensure is stripped [\#78](https://github.com/puppetlabs/ruby-pwsh/pull/78) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
116
|
-
|
117
|
-
## [0.6.2](https://github.com/puppetlabs/ruby-pwsh/tree/0.6.2) (2020-12-09)
|
118
|
-
|
119
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.1...0.6.2)
|
120
|
-
|
121
|
-
### Fixed
|
122
|
-
|
123
|
-
- \(MAINT\) Ensure parameters are canonicalized [\#75](https://github.com/puppetlabs/ruby-pwsh/pull/75) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
124
|
-
|
125
|
-
## [0.6.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.6.1) (2020-11-25)
|
126
|
-
|
127
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.0...0.6.1)
|
128
|
-
|
129
|
-
### Fixed
|
130
|
-
|
131
|
-
- \(maint\) - Removal of inappropriate terminology [\#70](https://github.com/puppetlabs/ruby-pwsh/pull/70) ([pmcmaw](https://github.com/pmcmaw))
|
132
|
-
- \(Maint\) Fix ensurability in the dsc base provider [\#69](https://github.com/puppetlabs/ruby-pwsh/pull/69) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
133
|
-
|
134
|
-
## [0.6.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.6.0) (2020-11-24)
|
135
|
-
|
136
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.5.1...0.6.0)
|
137
|
-
|
138
|
-
### Added
|
139
|
-
|
140
|
-
- \(GH-81\) Handle parameters in the dsc base provider [\#62](https://github.com/puppetlabs/ruby-pwsh/pull/62) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
141
|
-
- \(GH-74\) Remove special handling for ensure in the dsc base provider [\#61](https://github.com/puppetlabs/ruby-pwsh/pull/61) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
142
|
-
- \(GH-59\) Refactor away from Simple Provider [\#60](https://github.com/puppetlabs/ruby-pwsh/pull/60) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
143
|
-
|
144
|
-
### Fixed
|
145
|
-
|
146
|
-
- \(GH-57\) Handle datetimes in dsc [\#58](https://github.com/puppetlabs/ruby-pwsh/pull/58) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
147
|
-
- \(GH-55\) Handle intentionally empty arrays [\#56](https://github.com/puppetlabs/ruby-pwsh/pull/56) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
148
|
-
|
149
|
-
## [0.5.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.5.1) (2020-09-25)
|
150
|
-
|
151
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.5.0...0.5.1)
|
152
|
-
|
153
|
-
### Fixed
|
154
|
-
|
155
|
-
- \(MAINT\) Ensure dsc provider finds dsc resources during agent run [\#45](https://github.com/puppetlabs/ruby-pwsh/pull/45) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
156
|
-
|
157
|
-
## [0.5.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.5.0) (2020-08-20)
|
158
|
-
|
159
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.4.1...0.5.0)
|
160
|
-
|
161
|
-
### Added
|
162
|
-
|
163
|
-
- \(IAC-1045\) Add the DSC base Puppet provider to pwshlib [\#39](https://github.com/puppetlabs/ruby-pwsh/pull/39) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
164
|
-
|
165
|
-
## [0.4.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.4.1) (2020-02-13)
|
166
|
-
|
167
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.4.0...0.4.1)
|
168
|
-
|
169
|
-
### Fixed
|
170
|
-
|
171
|
-
- Ensure ruby versions older than 2.3 function correctly [\#30](https://github.com/puppetlabs/ruby-pwsh/pull/30) ([binford2k](https://github.com/binford2k))
|
172
|
-
|
173
|
-
## [0.4.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.4.0) (2020-01-14)
|
174
|
-
|
175
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.3.0...0.4.0)
|
176
|
-
|
177
|
-
### Added
|
178
|
-
|
179
|
-
- \(MODULES-10389\) Add puppet feature for dependent modules to leverage [\#20](https://github.com/puppetlabs/ruby-pwsh/pull/20) ([sanfrancrisko](https://github.com/sanfrancrisko))
|
180
|
-
|
181
|
-
## [0.3.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.3.0) (2019-12-04)
|
182
|
-
|
183
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.2.0...0.3.0)
|
184
|
-
|
185
|
-
### Added
|
186
|
-
|
187
|
-
- \(FEAT\) Add method for symbolizing hash keys [\#16](https://github.com/puppetlabs/ruby-pwsh/pull/16) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
188
|
-
|
189
|
-
### Fixed
|
190
|
-
|
191
|
-
- \(FEAT\) Ensure hash key casing methods work on arrays [\#15](https://github.com/puppetlabs/ruby-pwsh/pull/15) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
192
|
-
|
193
|
-
## [0.2.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.2.0) (2019-11-26)
|
194
|
-
|
195
|
-
[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.1.0...0.2.0)
|
196
|
-
|
197
|
-
### Added
|
198
|
-
|
199
|
-
- \(FEAT\) Add quality of life utilities [\#11](https://github.com/puppetlabs/ruby-pwsh/pull/11) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
200
|
-
- \(FM-8422\) Make library releasable as a Puppet module [\#8](https://github.com/puppetlabs/ruby-pwsh/pull/8) ([michaeltlombardi](https://github.com/michaeltlombardi))
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/CODEOWNERS
DELETED
data/CONTRIBUTING.md
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
# Contributing to ruby-pwsh
|
2
|
-
|
3
|
-
So you want to contribute to the ruby-pwsh gem: Great! Below are some instructions to get you started doing
|
4
|
-
that very thing while setting expectations around code quality as well as a few tips for making the
|
5
|
-
process as easy as possible.
|
6
|
-
|
7
|
-
## Table of Contents
|
8
|
-
|
9
|
-
1. [Getting Started](#getting-started)
|
10
|
-
1. [Commit Checklist](#commit-checklist)
|
11
|
-
1. [Submission](#submission)
|
12
|
-
1. [More about commits](#more-about-commits)
|
13
|
-
1. [Testing](#testing)
|
14
|
-
- [Running Tests](#running-tests)
|
15
|
-
- [Writing Tests](#writing-tests)
|
16
|
-
1. [Get Help](#get-help)
|
17
|
-
|
18
|
-
## Getting Started
|
19
|
-
|
20
|
-
- Fork the module repository on GitHub and clone to your workspace
|
21
|
-
- Make your changes!
|
22
|
-
|
23
|
-
## Commit Checklist
|
24
|
-
|
25
|
-
### The Basics
|
26
|
-
|
27
|
-
- [x] my commit is a single logical unit of work
|
28
|
-
- [x] I have checked for unnecessary whitespace with "git diff --check"
|
29
|
-
- [x] my commit does not include commented out code or unneeded files
|
30
|
-
|
31
|
-
### The Content
|
32
|
-
|
33
|
-
- [x] my commit includes tests for the bug I fixed or feature I added
|
34
|
-
- [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality
|
35
|
-
- [x] my code passes existing test suites
|
36
|
-
|
37
|
-
### The Commit Message
|
38
|
-
|
39
|
-
- [x] the first line of my commit message includes:
|
40
|
-
- [x] an issue number (if applicable), e.g. "(GH-xxxx) This is the first line"
|
41
|
-
- [x] a short description (50 characters is the soft limit, excluding issue number(s))
|
42
|
-
- [x] the body of my commit message:
|
43
|
-
- [x] is meaningful
|
44
|
-
- [x] uses the imperative, present tense: "change", not "changed" or "changes"
|
45
|
-
- [x] includes motivation for the change, and contrasts its implementation with the previous behavior
|
46
|
-
|
47
|
-
## Submission
|
48
|
-
|
49
|
-
### Pre-requisites
|
50
|
-
|
51
|
-
- Make sure you have a [GitHub account](https://github.com/join)
|
52
|
-
- [Create an issue](https://github.com/puppetlabs/ruby-pwsh/issues/new/choose), or [watch the issue](https://github.com/puppetlabs/ruby-pwsh/issues) you are patching for.
|
53
|
-
|
54
|
-
### Push and PR
|
55
|
-
|
56
|
-
- Push your changes to your fork
|
57
|
-
- [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization
|
58
|
-
|
59
|
-
## More about commits
|
60
|
-
|
61
|
-
1. Make separate commits for logically separate changes.
|
62
|
-
|
63
|
-
Please break your commits down into logically consistent units which include new or changed tests relevant to the rest of the change.
|
64
|
-
The goal of doing this is to make the diff easier to read for whoever is reviewing your code.
|
65
|
-
In general, the easier your diff is to read, the more likely someone will be happy to review it and get it into the code base.
|
66
|
-
|
67
|
-
If you are going to refactor a piece of code, please do so as a separate commit from your feature or bug fix changes.
|
68
|
-
|
69
|
-
We also really appreciate changes that include tests to make sure the bug is not re-introduced, and that the feature is not accidentally broken.
|
70
|
-
|
71
|
-
Describe the technical detail of the change(s).
|
72
|
-
If your description starts to get too long, that is a good sign that you probably need to split up your commit into more finely grained pieces.
|
73
|
-
|
74
|
-
Commits which plainly describe the things which help reviewers check the patch and future developers understand the code are much more likely to be merged in with a minimum of bike-shedding or requested changes.
|
75
|
-
Ideally, the commit message would include information, and be in a form suitable for inclusion in the release notes for the version of Puppet that includes them.
|
76
|
-
|
77
|
-
Please also check that you are not introducing any trailing whitespace or other "whitespace errors".
|
78
|
-
You can do this by running `git diff --check` on your changes before you commit.
|
79
|
-
|
80
|
-
2. Sending your patches
|
81
|
-
|
82
|
-
To submit your changes via a GitHub pull request, we _highly_ recommend that you have them on a topic branch, instead of directly on "main".
|
83
|
-
It makes things much easier to keep track of, especially if you decide to work on another thing before your first change is merged in.
|
84
|
-
|
85
|
-
GitHub has some pretty good [general documentation](http://help.github.com/) on using their site.
|
86
|
-
They also have documentation on [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
|
87
|
-
|
88
|
-
In general, after pushing your topic branch up to your repository on GitHub, you can switch to the branch in the GitHub UI and click "Pull Request" towards the top of the page in order to open a pull request.
|
89
|
-
|
90
|
-
3. Update the related GitHub issue.
|
91
|
-
|
92
|
-
If there is a GitHub issue associated with the change you submitted, then you should update the issue to include the location of your branch, along with any other commentary you may wish to make.
|
93
|
-
|
94
|
-
# Testing
|
95
|
-
|
96
|
-
## Getting Started
|
97
|
-
|
98
|
-
Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages,
|
99
|
-
or Gems, are required to build, develop, and test this software.
|
100
|
-
|
101
|
-
Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to
|
102
|
-
install all dependencies needed for this project in the project root by running
|
103
|
-
|
104
|
-
```shell
|
105
|
-
# Unless you're doing a release, you don't need the puppet gem group
|
106
|
-
% bundle install --path .bundle/gems --without puppet
|
107
|
-
Fetching gem metadata from https://rubygems.org/........
|
108
|
-
Fetching gem metadata from https://rubygems.org/..
|
109
|
-
Using rake (10.1.0)
|
110
|
-
Using builder (3.2.2)
|
111
|
-
-- 8><-- many more --><8 --
|
112
|
-
Your bundle is complete!
|
113
|
-
Use `bundle show [gemname]` to see where a bundled gem is installed.
|
114
|
-
```
|
115
|
-
|
116
|
-
NOTE: some systems may require you to run this command with sudo.
|
117
|
-
|
118
|
-
If you already have those gems installed, make sure they are up-to-date:
|
119
|
-
|
120
|
-
```shell
|
121
|
-
% bundle update
|
122
|
-
```
|
123
|
-
|
124
|
-
## Running Tests
|
125
|
-
|
126
|
-
With all dependencies in place and up-to-date, run the tests:
|
127
|
-
|
128
|
-
### Unit Tests
|
129
|
-
|
130
|
-
```shell
|
131
|
-
% bundle exec rake spec
|
132
|
-
```
|
133
|
-
|
134
|
-
This executes all the [rspec tests](https://rspec.info/) in the `spec` directory.
|
135
|
-
|
136
|
-
## If you have commit access to the repository
|
137
|
-
|
138
|
-
Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge
|
139
|
-
in your changes.
|
140
|
-
The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that all changes go through a code review process.**
|
141
|
-
|
142
|
-
The record of someone performing the merge is the record that they performed the code review.
|
143
|
-
Again, this should be someone other than the author of the topic branch.
|
144
|
-
|
145
|
-
## Get Help
|
146
|
-
|
147
|
-
### On the web
|
148
|
-
|
149
|
-
- [General GitHub documentation](http://help.github.com/)
|
150
|
-
- [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
151
|
-
|
152
|
-
### On chat
|
153
|
-
|
154
|
-
- Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli
|
155
|
-
- IRC (freenode) #puppet-dev, #voxpupuli
|
data/DESIGN.md
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# PowerShell Manager: Design and Architecture
|
2
|
-
|
3
|
-
This gem allows the use of a long-lived manager to which Ruby can send PowerShell invocations and receive the exection output.
|
4
|
-
This reduces the overhead time to execute PowerShell commands from seconds to milliseconds because each execution does not need to spin up a PowerShell process, execute a single pipeline, and tear the process down.
|
5
|
-
|
6
|
-
The manager operates by instantiating a custom PowerShell host process to which Ruby can then send commands over an IO pipe—
|
7
|
-
on Windows machines, named pipes, on Unix/Linux, Unix Domain Sockets.
|
8
|
-
|
9
|
-
## Communication Between Ruby and PowerShell Host Process
|
10
|
-
|
11
|
-
Communication between Ruby and the PowerShell host process uses binary encoded strings with a [4-byte prefix indicating how long the message is](https://en.wikipedia.org/wiki/Type-length-value).
|
12
|
-
The length prefix is a Little Endian encoded 32-bit integer.
|
13
|
-
The string being passed is always UTF-8.
|
14
|
-
|
15
|
-
Before a command string is sent to the PowerShell host process, a single 1-byte command identifier is sent—
|
16
|
-
`0` to tell the process to exit, `1` to tell the process to execute the next incoming string.
|
17
|
-
|
18
|
-
The PowerShell code to be executed is always wrapped in the following for execution to standardize behavior inside the PowerShell host process:
|
19
|
-
|
20
|
-
```powershell
|
21
|
-
$params = @{
|
22
|
-
Code = @'
|
23
|
-
#{powershell_code}
|
24
|
-
'@
|
25
|
-
TimeoutMilliseconds = #{timeout_ms}
|
26
|
-
WorkingDirectory = "#{working_dir}"
|
27
|
-
ExecEnvironmentVariables = #{exec_environment_variables}
|
28
|
-
}
|
29
|
-
|
30
|
-
Invoke-PowerShellUserCode @params
|
31
|
-
```
|
32
|
-
|
33
|
-
The code itself is placed inside a herestring and the timeout (integer), working directory (string), and environment variables (hash), if any, are passed as well.
|
34
|
-
|
35
|
-
![Diagram of communication flow for execution between Ruby and PowerShell manager](./design-comms.png)
|
36
|
-
|
37
|
-
### Output
|
38
|
-
|
39
|
-
The return from a Ruby command will always include:
|
40
|
-
|
41
|
-
+ `stdout` from the output streams, as if using `*>&1` to redirect
|
42
|
-
+ `exitcode` for the exit code of the execution; this will always be `0`, unless an exit code is specified or an exception is _thrown_.
|
43
|
-
+ `stderr` will always be an empty array.
|
44
|
-
+ `errormessage` will be the exception message of any thrown exception during execution.
|
45
|
-
+ `native_stdout` will always be nil.
|
46
|
-
|
47
|
-
#### Error Handling
|
48
|
-
|
49
|
-
Because PowerShell does not halt execution when an error is encountered, only when an terminating exception is thrown, the manager _also_ continues to execute until it encounters a terminating exception when executing commands.
|
50
|
-
This means that `Write-Error` messages will go to the stdout log but will not cause a change in the `exitcode` or populate the `errormessage` field.
|
51
|
-
Using `Throw` or any other method of generating a terminating exception _will_ set the `exitcode` to `1` and populate the `errormessage` field.
|
52
|
-
|
53
|
-
## Multiple PowerShell Host Processes
|
54
|
-
|
55
|
-
Until told otherwise, or they break, or their parent process closes, the instantiated PowerShell host processes will remain alive and waiting for further commands.
|
56
|
-
The significantly speeds up the execution of serialized commands, making continual interoperation between Ruby and PowerShell less complex for the developer leveraging this library.
|
57
|
-
|
58
|
-
In order to do this, the manager class has a class variable, `@@instances`, which contains a hash of the PowerShell hosts:
|
59
|
-
|
60
|
-
+ The key is the unique combination of options - path to the executable, flags, and additional options - passed to create the instance.
|
61
|
-
+ The value is the current state of that instance of the PowerShell host process.
|
62
|
-
|
63
|
-
If you attempt to instantiate an instance of the manager using the `instance` method, it will _first_ look to see if the specified manager and host process are already built and alive - if the manager instance does not exist or the host process is dead, _then_ it will spin up a new host process.
|
64
|
-
|
65
|
-
In test executions, standup of an instance takes around 1.5 seconds - accessing a pre-existing instance takes thousandths of a second.
|
66
|
-
|
67
|
-
## Multithreading
|
68
|
-
|
69
|
-
The manager and PowerShell host process are designed to be used single-threadedly with the PowerShell host expecting a single command and returning a single output at a time.
|
70
|
-
It does not at this time have additional guarding against being sent commands by multiple processes, but since the handles are unique IDs, this should not happen in practice.
|