Sha256: 9dd3e91f21a9dbd1adbbc3a6023962b77103ac9280832d349211cd71fcb5fa40

Contents?: true

Size: 870 Bytes

Versions: 41

Compression:

Stored size: 870 Bytes

Contents

module Specinfra
  module Backend
    module PowerShell
      class Command
        attr_reader :import_functions, :script
        def initialize &block
          @import_functions = []
          @script = ""
          instance_eval(&block) if block_given?
        end

        def using *functions
          functions.each { |f| import_functions << f }
        end

        def exec code
          @script = code
        end

        def convert_regexp(target)
          case target
          when Regexp
            target.source
          else
            target.to_s.gsub '(^\/|\/$)', ''
          end
        end

        def get_identity id
          raise "You must provide a specific Windows user/group" if id =~ /(owner|group|others)/
          identity = id || 'Everyone'
        end

        def to_s
          @script
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
specinfra-2.91.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.90.1 lib/specinfra/backend/powershell/command.rb
specinfra-2.90.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.89.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.88.2 lib/specinfra/backend/powershell/command.rb
specinfra-2.88.1 lib/specinfra/backend/powershell/command.rb
specinfra-2.88.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.87.2 lib/specinfra/backend/powershell/command.rb
specinfra-2.87.1 lib/specinfra/backend/powershell/command.rb
specinfra-2.87.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.86.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.85.1 lib/specinfra/backend/powershell/command.rb
specinfra-2.85.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.84.1 lib/specinfra/backend/powershell/command.rb
specinfra-2.84.0 lib/specinfra/backend/powershell/command.rb
specinfra-2.83.4 lib/specinfra/backend/powershell/command.rb
specinfra-2.83.3 lib/specinfra/backend/powershell/command.rb
specinfra-2.83.2 lib/specinfra/backend/powershell/command.rb
specinfra-2.83.1 lib/specinfra/backend/powershell/command.rb
specinfra-2.83.0 lib/specinfra/backend/powershell/command.rb