Sha256: a587592101664d23a08797c5213bfce02fa05cf64cc6659983e43ab005509efb

Contents?: true

Size: 637 Bytes

Versions: 23

Compression:

Stored size: 637 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
        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
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
specinfra-2.27.0 lib/specinfra/helper/os.rb
specinfra-2.26.1 lib/specinfra/helper/os.rb
specinfra-2.26.0 lib/specinfra/helper/os.rb