Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User-level bundler Gemfile

Tags:

bundler

I'd love to have a Gemfile in Bundler that just sets my own personal Gemfiles to always be bult into bundles...

aka ruby-debug, interactive-editor, and so forth.

Any idea how to do this?

like image 578
Scott Schulthess Avatar asked Apr 05 '11 15:04

Scott Schulthess


People also ask

What is the difference between Gemfile and Gemfile lock?

The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile. lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.

What is ~> Gemfile?

A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.

How do I use Gemfile in Ruby?

A Gemfile describes the gem dependencies required to execute associated Ruby code. Place the Gemfile in the root of the directory containing the associated code. For instance, in a Rails application, place the Gemfile in the same directory as the Rakefile .

How do I specify a Gemfile version?

There are several ways to specify gem versions: Use a specific version: gem "name-of-gem", "1.0" . You can find specific versions on Rubygems.org (provided that's the source you”re using) by searching for your gem and looking at the “Versions” listed. Use a version operator: gem "name-of-gem", ">1.0" .


2 Answers

We use this technique. Puth this in your Gemfile:

eval File.read(File.expand_path("Gemfile.personal")) if File.exists?(File.expand_path("Gemfile.personal"))

And then add your personal gems to Gemfile.personal. Of course exclude Gemfile.personal from your version control.

like image 67
BuGo Avatar answered Oct 11 '22 14:10

BuGo


One way to do this is to create different evnironments

group :scott do 
end

Then

bundle --with-env=scott

like image 28
Scott Schulthess Avatar answered Oct 11 '22 14:10

Scott Schulthess