Sha256: 43c58616245e360cd5dd42e4d9803c527c06df77735eb6f930d51d8d8c1b74cf

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

module SpecInfra
  module Helper
    module DetectOS
      def commands
        self.class.const_get('SpecInfra').const_get('Command').const_get(os[:family]).new
      end

      def os
        property[:os_by_host] = {} if ! property[:os_by_host]
        host = SpecInfra.configuration.ssh ? SpecInfra.configuration.ssh.host : 'localhost'

        if property[:os_by_host][host]
          os_by_host = property[:os_by_host][host]
        else
          # Set command object explicitly to avoid `stack too deep`
          raise "crash me" if caller.length > 500
          os_by_host = backend(SpecInfra::Command::Base.new).check_os

          property[:os_by_host][host] = os_by_host
        end

        os_by_host
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
specinfra-1.12.0 lib/specinfra/helper/detect_os.rb