Skip to content

Instantly share code, notes, and snippets.

@johnmcdowall
Forked from oleander/gist:948109
Created May 23, 2012 19:16
Show Gist options
  • Save johnmcdowall/2777192 to your computer and use it in GitHub Desktop.
Save johnmcdowall/2777192 to your computer and use it in GitHub Desktop.
def r(this)
require this
puts "#{this} is now loaded."
rescue LoadError
puts "The gem '#{this}' is missing."
puts "Should I install it? [y/n]"
if gets =~ /yes|y/i
puts "Installing #{this}, hold on."
if `gem install #{this}` =~ /Successfully/
Gem.clear_paths
require this
puts "Done, gem loaded."
end
else
puts "Okey, goodbye."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment