Class: Chef::PowerShell
- Inherits:
-
Object
- Object
- Chef::PowerShell
- Defined in:
- lib/chef/powershell.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(script) ⇒ Object
constructor
Run a command under PowerShell via a managed (.NET) COM interop API.
Constructor Details
#initialize(script) ⇒ Object
Run a command under PowerShell via a managed (.NET) COM interop API. This implementation requires the managed dll to be registered on the target machine.
Requires: .NET Framework 4.0 or higher on the target machine.
35 36 37 38 |
# File 'lib/chef/powershell.rb', line 35 def initialize(script) raise "Chef::PowerShell can only be used on the Windows platform." unless RUBY_PLATFORM =~ /mswin|mingw32|windows/ exec(script) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
25 26 27 |
# File 'lib/chef/powershell.rb', line 25 def errors @errors end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
24 25 26 |
# File 'lib/chef/powershell.rb', line 24 def result @result end |
Instance Method Details
#error? ⇒ Boolean
40 41 42 43 |
# File 'lib/chef/powershell.rb', line 40 def error? return true if errors.count > 0 false end |