class Specinfra::Backend::PowerShell::Command
Attributes
import_functions[R]
script[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/specinfra/backend/powershell/command.rb, line 6 def initialize &block @import_functions = [] @script = "" instance_eval(&block) if block_given? end
Public Instance Methods
convert_regexp(target)
click to toggle source
# File lib/specinfra/backend/powershell/command.rb, line 20 def convert_regexp(target) case target when Regexp target.source else target.to_s.gsub '(^\/|\/$)', '' end end
exec(code)
click to toggle source
# File lib/specinfra/backend/powershell/command.rb, line 16 def exec code @script = code end
get_identity(id)
click to toggle source
# File lib/specinfra/backend/powershell/command.rb, line 29 def get_identity id raise "You must provide a specific Windows user/group" if id =~ /(owner|group|others)/ identity = id || 'Everyone' end
to_s()
click to toggle source
# File lib/specinfra/backend/powershell/command.rb, line 34 def to_s @script end
using(*functions)
click to toggle source
# File lib/specinfra/backend/powershell/command.rb, line 12 def using *functions functions.each { |f| import_functions << f } end