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.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install distroid
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
- Fork it (
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request