On Feb 13, 11:42 am, Sarah Allen <[email protected]>
wrote:
> I'm picking up a Rails app that is using a lot of older gems. We're
> using Rails 2.0.2 and planning to move to to Rails 2.3 along with
> upgrading the the dependencies. However, in the meantime, we're moving
> servers around and adding new folks to the dev team, so I thought it
> wise to "freeze" the gems. I'm trying to follow the methodology
> described here:http://errtheblog.com/posts/50-vendor-everything
> and here:http://wiki.joyent.com/shared:kb:installing-rails
>
> Unfortunately, the gems don't seem to be found.
>
> Here's what I did... I had all the old gems installed to ~/.gems and all
> the tests passed. Then I unpacked the gems into /vendor/gems
>
> cd ~/rails/vendor/gems
> gem unpack exifr
> gem unpack rmagick
> gem unpack tzinfo
> gem unpack uuidtools
>
> I added the following to config/enviroment.rb inside
> Rails::Initializer.run do |config|
>
> config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
> File.directory?(lib = "#{dir}/lib") ? lib : dir
> end
> # print out my load_paths for debugging
> config.load_paths.each do |p|
> puts p
> end
>
> and later:
> require 'rubygems'
> gem 'exifr', '=0.10.6'
> gem 'uidtools', '=1.0.2'
> gem 'rmagick', '=1.15.8'
> gem 'tzinfo', '=0.3.5'
>
>
Take a careful look at the errtheblog article - you should be using
require, not gem here.
The gem statements only add the gem directories to the load_path.
In the long run, you should definitely switch over to using
config.gem, but that isn't an
option with Rails 2.0.3.
BTW, even changing to 'require's is still going to leave you with
problems, as RMagick's
native component hasn't been built yet. I don't know of any easy way
to do it in your
situation. You might want, for the short term, to just leave the 'gem'
lines in your environment
and keep the gem packages for the gems you need around. That way, the
code will complain
loudly if the gems needed aren't installed.
--Matt Jones
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---