Greetings and/or salutations
I'm a little (very very) confused by these things. Does a Gemfile specify what is in a given Gemset? Or does using a particular Gemset before running "$ rails new project_name" specify what'll be in that Gemfile?
Jump to content
The ultimate community for Ruby on Rails developers.
Posted 31 January 2014 - 09:36 AM
ffmegaman has it.
Normally you can have a global gemset. This is a box of all the gems you've installed on your computer.
Sometimes you'd like to organise this box. You do this, by creating a new one, and fill it with specific gems. These specific gems comes from the Gemfile (or are at least specified in the Gemfile). When running bundle install you look at the Gemfile, then at the Gemfile.lock and then into the box (gemset). If the gem is specified in the Gemfile, you look to Gemfile.lock as to which version the project is locked to. Then you look into the gemset and see if you already have this gem installed in this version, or if you need to download it.
When doing a bundle update, you just look at Gemfile and try to figure out which version of all the gems are satisfying all the constrains (dependencies) and then you look into the box to see which gems should be updated.
I hope that clarified it a bit?
Posted 31 January 2014 - 01:48 PM
Do note that gemsets are a RVM specific thing. If you're not running with RVM, no need to worry about it.
No, there are no consequences of not using either gemsets or RVM (I myself use rbenv instead)
More info can be found on RVM's page: http://rvm.io/gemsets/basics
Posted 05 February 2014 - 11:25 AM
Thank you for both of your responses! They've helped demystify a few points.
So if I go:
$ rvm use 2.0.0@railstutorial_rails_4_0 --create --default
(taken from Michael Hartl's book)
means that I'm now using rails 2.0.0 and associating the railstutorial_rails_4_0 gemset with it as the default gemset.
Now, in my gemfile I've got:
source 'https://rubygems.org' ruby '2.0.0' #ruby-gemset=railstutorial_rails_4_0 gem 'rails', '4.0.2' group :development do gem 'sqlite3', '1.3.8' end gem 'sass-rails', '4.0.1' gem 'uglifier', '2.1.1' gem 'coffee-rails', '4.0.1' gem 'jquery-rails', '3.0.4' gem 'turbolinks', '1.1.1' gem 'jbuilder', '1.0.2' group :doc do gem 'sdoc', '0.3.20', require: false end
Why is the #ruby-gemset=railstutorial_rails_4_0 line necessary? Doesn't the previous line, ruby '2.0.0', mean that I'm using ruby 2.0.0 which is already associated with that gemset?
0 members, 0 guests, 0 anonymous users