Class: Inspec::Resources::PowershellScript
- Defined in:
- lib/resources/powershell.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Cmd
Instance Method Summary collapse
-
#exist? ⇒ Boolean
we cannot determine if a command exists, because that does not work for scripts.
-
#initialize(script) ⇒ PowershellScript
constructor
A new instance of PowershellScript.
-
#strip ⇒ Object
Removes leading and trailing whitespace from stdout.
- #to_s ⇒ Object
Methods inherited from Cmd
#exit_status, #result, #stderr, #stdout
Constructor Details
#initialize(script) ⇒ PowershellScript
Returns a new instance of PowershellScript.
21 22 23 24 25 26 27 28 |
# File 'lib/resources/powershell.rb', line 21 def initialize(script) unless inspec.os.windows? return skip_resource 'The `script` resource is not supported on your OS yet.' end # since WinRM 2.0 and the default use of powershell for local execution in # train, we do not need to wrap the script here anymore super(script) end |
Instance Method Details
#exist? ⇒ Boolean
we cannot determine if a command exists, because that does not work for scripts
31 32 33 |
# File 'lib/resources/powershell.rb', line 31 def exist? nil end |
#strip ⇒ Object
Removes leading and trailing whitespace from stdout
36 37 38 |
# File 'lib/resources/powershell.rb', line 36 def strip result.stdout.strip unless result.stdout.nil? end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/resources/powershell.rb', line 40 def to_s 'Powershell' end |