Sha256: cbdd962642eeaf5717618b39ef480bd7f7053fdd4640fcab993bb6189fbb95ea

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# -*- encoding: UTF-8 -*-

module CSD
  module Extensions
    # This namespace is given to all extensions made to third-party Gems.
    #
    module Gem
      # This module comprises extensions to the Array object.
      #
      module Platform
  
        # This method returns a human-readable string for the current OS and CPU architecture.
        #
        def humanize
          version_string = version ? ", version #{version}" : ''
          "#{os} (#{cpu}#{version_string})"
        end
        
        # On linux systems, this method returns the current kernel version.
        #
        def kernel_version
          Cmd.run('uname --kernel-version', :silent => true).output.to_s.chop if os == 'linux'
        end
        
        # On linux systems, this method returns the current kernel release.
        #
        def kernel_release
          Cmd.run('uname --kernel-release', :silent => true).output.to_s.chop if os == 'linux'
        end
  
      end
    end
  end
end

module Gem
  class Platform #:nodoc:
    include CSD::Extensions::Gem::Platform
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csd-0.1.7 lib/csd/extensions/gem/platform.rb