A simple gem to detect which distro you are running
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
Gemfile
LICENSE
README.md
Rakefile
distroid.gemspec

README.md

Distroid Gem Version Dependency Status

distroid is a simple gem to detect the kernel, OS, and distro that the the current system is running on. Useful for situations where programs or commands to be run may differ between operating systems.

Installation

Add this line to your application's Gemfile:

gem 'distroid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install distroid

Usage

Using Distroid is as simple as including it into your project as you would normally. The most used function is simply Distroid::distro?, which will return the distro of the current computer as a symbol.

require 'distroid'

include Distroid

puts "Running Fedora" if Distroid::distro? == :fedora
puts "Running Debian" if Distroid::distro? == :debian
puts "Running SUSE"   if Distroid::distro? == :suse

Distroid's main purpose is making performing distro-specific tasks easy, such as: installing software, performing updates, and worming around config files.

require 'distroid'

include Distroid

if Distroid::distro? == :fedora
  `sudo yum install foo bar baz`
elsif Distroid::distro? == :debian
  `sudo apt-get install foo bar baz`
end

Contributing

  1. Fork it (http://github.com/joshbeitler/distroid/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request