Created
August 15, 2011 21:21
-
-
Save lucashungaro/1147895 to your computer and use it in GitHub Desktop.
hack to load "system" gems not listed in your Gemfile when using Rails console - add this snippet to your ~/.irbrc
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
# Add all gems installed in the system to the $LOAD_PATH so they can be used in Rails console with Bundler | |
if defined?(::Bundler) | |
current_ruby_version = `rbenv version`.split(" ").first | |
gem_paths = Dir.glob("#{ENV["HOME"]}/.rbenv/versions/#{current_ruby_version}/lib/ruby/gems/**/gems/*/lib") | |
gem_paths.each do |path| | |
$LOAD_PATH << path | |
end | |
end | |
# now you can just normally install these gems ('gem install <gem-name>') into your system and keep your Gemfile listing only your app's dependencies. I use this with wirble, awesome_print and looksee and it works just fine. :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment