Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a local gem in console with bundled environment

I want to customize my development environment with a few extra gems. I am using bundler with rails 3.0.x. I have those extra gems in my local system and i dont want to add them into my Gemfile. How can i by pass bundler and require these gems in my console which was opened using bundle exec ?

like image 337
AshwinKumarS Avatar asked May 09 '13 13:05

AshwinKumarS


1 Answers

I found one way to do it, though it's a little hacky.

$ gem install gem_name
$ gem which gem_name
# outputs <full path to gem>/lib/gem_name.rb

$ rails console
> $LOAD_PATH << "<full path to gem>/lib"
> require 'gem_name'

I'm doing this to play around with different Ruby performance gems, although it might just be easier to add it to your Gemfile, bundle, and then revert before you push up your changes.

like image 93
evanbikes Avatar answered Sep 20 '22 14:09

evanbikes