Sha256: 9fa310bf9a3a705de7589254f7a5ed8968147115284ce2079768f300b6027b3f

Contents?: true

Size: 661 Bytes

Versions: 6

Compression:

Stored size: 661 Bytes

Contents

module Shutter
  class OS
    def initialize
      unless File.exist?('/proc/version')
        @version = "Unknown"
      end
    end

    def family
      @family ||= ENV['OS'] ? ENV['OS'] : RUBY_PLATFORM.split('-').last
    end

    def version
      @version ||= IO.read('/proc/version')
    end

    def linux?
      return family == "linux"
    end

    def dist
      case version
      when /Red Hat/
        "RedHat"
      when /Debian/
        "Debian"
      when /Ubuntu/
        "Ubuntu"
      else
        "Unknown"
      end
    end

    def redhat?
      dist == "RedHat"
    end

    alias :centos? :redhat? 
    alias :fedora? :redhat?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shutter-0.0.7 lib/shutter/os.rb
shutter-0.0.6 lib/shutter/os.rb
shutter-0.0.5 lib/shutter/os.rb
shutter-0.0.4 lib/shutter/os.rb
shutter-0.0.3 lib/shutter/os.rb
shutter-0.0.2 lib/shutter/os.rb