As far as I know both rails:freeze:gems
and rake gems:unpack
are placing the gems to /vendor
. rails:freeze:gems
places them to /vendor/rails
, gems:unpack
place them to /vendor/gems
. The point for me seems to be the same, however. In both cases the goal is to fix the gems and their versions as they were during the development. Is there any other difference? It seems to me a duplication now..
views:
586answers:
1From my understanding, gem:unpack will unpack any third party gem your app needs into vendor/gems.
rails:freeze:gems freezes only those gems having to do with rails itself, so it freezes your app to a specific version of rails. Thus the different /vendor/rails directory.
To comment a bit more:
There's this line in config/environment.rb
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
So by default, rails will check to see if the vendor/rails directory exists, and use the versions of those gems if it does. If not, you must set which version of rails it will use, and rails will try to pull in the gems from your local system.
So the only difference between the two commands I see is that rails:freeze:gems
dumps ONLY the rails files into vendor/rails, which is exactly where rails wants them to be.
The reason you want to use gem:unpack
is to dump third party gems your application depends on, so wherever your app is run those gems won't need to be installed locally.
You can think of rails:freeze:gems
as a shortcut that simply does a gem:unpack
of only the rails gems into the directory rails expects (/vendor/rails), so that you don't have to manually do it. But yes, behind the scenes I expect rails:freeze:gems
probably uses gem:unpack