Created
February 13, 2012 13:12
-
-
Save brymck/1816919 to your computer and use it in GitHub Desktop.
System configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
=begin | |
To run, copy and paste the following command into a console: | |
ruby < <(curl -s https://raw.github.com/gist/1816919/469a4086833ce3b3496476aef1246c5d81b7ac99/gistfile1.rb) | |
And shucks, if that doesn't work, there's always this: | |
bash --version && \ | |
brew --version && \ | |
bundle --version && \ | |
curl --version && \ | |
git --version && \ | |
openssl version && \ | |
sw_vers -productVersion && \ | |
ruby --version && \ | |
gem --version && \ | |
rvm --version | |
=end | |
PROGRAMS = { | |
"bash" => "bash --version", | |
"Bundler" => "bundle --version", | |
"curl" => "curl --version", | |
"git" => "git --version", | |
"Homebrew" => "brew --version", | |
"OpenSSL" => "openssl version", | |
"OSX" => "sw_vers -productVersion", | |
"Ruby" => "ruby --version", | |
"RubyGems" => "gem --version", | |
"RVM" => "rvm --version" | |
} | |
NOT_INSTALLED = /command not found/ | |
VERSION_PART = /\d+\.[\d.]+(?:b|p|r|rc|\()?(?:\d*)\)?/ | |
longest_key = PROGRAMS.keys.map(&:size).max | |
PROGRAMS.each do |name, command| | |
padding = " " * (longest_key - name.size) | |
result = %x[#{command} 2>&1] | |
if result =~ NOT_INSTALLED | |
version = "not installed" | |
else | |
version = result[VERSION_PART] | |
end | |
puts "#{name}: #{padding}#{version}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment