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.82.25 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.24 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.23 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.22 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.21 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.20 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.19 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.18 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.17 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.16 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.15 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.14 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.13 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.12 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.11 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.10 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.9 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.8 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.7 lib/specinfra/backend/powershell/command.rb
specinfra-2.82.6 lib/specinfra/backend/powershell/command.rb