«

»

Jun
29

Bundler default Gemfile and custom Gemfile, example of wirble

Hi all,
A simple trick I want to share with you if you are using Bundler (or rails 3)
It matters if you want to install wirble gem in your workstation but not in your server

Sometimes, you want to include some gem that are not mandatory for your application to run but you want to use in your workstation. E.g wirble, awesome_print etc … or other debugging tools

Just write something like this in your Gemfile

# Gemfile
if File.exist?(file = File.expand_path('../myGemfile',__FILE__))
  instance_eval(File.read(file))
end

Now in your myGemfile

# myGemfile
gem 'wirble'
gem 'awesome_print'

That’s all! You can now require ‘wirble’ or ‘awesome_print’ in your rails console

2 comments

  1. Scott Schulthess says:

    The correct way to do this is to create a development section in your gemfile and put wirble there, then make sure to use the correct bundler commands when doing a deployment.

  2. Hallelujah says:

    Thanks for the tip.
    I did not read all the Bundler and Gemfile specs and docs

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">