Sha256: a526561a28654330365a31f18760fbc4d2f29a3e3f70be4a02522b180935888f

Contents?: true

Size: 890 Bytes

Versions: 152

Compression:

Stored size: 890 Bytes

Contents

require 'specinfra/helper/detect_os'

module Specinfra
  module Helper
    module Os
      def os
        property[:os] = {} if ! property[:os]
        if ! property[:os].include?(:family)
          property[:os] = detect_os
        end
        property[:os]
      end

      private
      def detect_os
        return Specinfra.configuration.os if Specinfra.configuration.os

        backend = Specinfra.configuration.backend
        if backend == :cmd || backend == :winrm
          return { :family => 'windows', :release => nil, :arch => nil }
        end

        Specinfra::Helper::DetectOs.subclasses.each do |c|
          res = c.detect
          if res
            res[:arch] ||= Specinfra.backend.run_command('uname -m').stdout.strip
            return res
          end
        end
        raise NotImplementedError, "Specinfra failed os detection."
      end
    end
  end
end

Version data entries

152 entries across 152 versions & 3 rubygems

Version Path
specinfra-rb19-2.44.7 lib/specinfra/helper/os.rb
specinfra-2.70.2 lib/specinfra/helper/os.rb
specinfra-2.70.1 lib/specinfra/helper/os.rb
specinfra-2.70.0 lib/specinfra/helper/os.rb
specinfra-2.69.0 lib/specinfra/helper/os.rb
specinfra-2.68.2 lib/specinfra/helper/os.rb
specinfra-2.68.1 lib/specinfra/helper/os.rb
specinfra-2.68.0 lib/specinfra/helper/os.rb
specinfra-2.67.10 lib/specinfra/helper/os.rb
specinfra-2.67.9 lib/specinfra/helper/os.rb
specinfra-2.67.8 lib/specinfra/helper/os.rb
specinfra-2.67.7 lib/specinfra/helper/os.rb
specinfra-2.67.6 lib/specinfra/helper/os.rb
specinfra-2.67.5 lib/specinfra/helper/os.rb
specinfra-2.67.3 lib/specinfra/helper/os.rb
specinfra-2.67.2 lib/specinfra/helper/os.rb
specinfra-2.67.1 lib/specinfra/helper/os.rb
specinfra-2.67.0 lib/specinfra/helper/os.rb
specinfra-2.66.9 lib/specinfra/helper/os.rb
specinfra-2.66.8 lib/specinfra/helper/os.rb