Freeze gems


#1

Hello everyone. Anyone run into this problem?

I have an rails app which is running rails 2.2.2 with rubygems 1.2.0
on a dev box. Rails is frozen and in SVN. The hosting server is
running gems 0.9 which appears to be incompatible with rails 2.x. Is
there a way to freeze rubygems (aka, gem) into a rails project so I do
not impact other’s applications?

What I have done (using 1.3.1 as a test case):

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar zxvf rubygems-1.3.1.tgz
mv rubygems-1.3.1/lib lib/rubygems
cd
svn add lib/rubygems
svn ci -m ‘added libraries’
rake deploy (to push app into production)

The idea was I would place the lib/rubygems directory ahead of
everything in the load path…

edit config/environment.rb

Add additional load paths for your own custom dirs

config.load_paths.insert(0, %W( #{RAILS_ROOT}/lib/rubygems/lib ).to_s)

on the dev box this looks correct (./script/about):

About your application’s environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.1
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2

On production it still is using the older version.:
./script/about
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:214:in
install_gem_spec_stubs': undefined methodloaded_specs’ for
Gem:Module (NoMethodError)

It appears to still load 0.9.6 on the way.

Regards,

Josh Richard


#2

On 2 Feb 2009, at 17:59, josh_richard wrote:

Hello everyone. Anyone run into this problem?

I have an rails app which is running rails 2.2.2 with rubygems 1.2.0
on a dev box. Rails is frozen and in SVN. The hosting server is
running gems 0.9 which appears to be incompatible with rails 2.x. Is
there a way to freeze rubygems (aka, gem) into a rails project so I do
not impact other’s applications?

You probably want to fiddle with $: right at the top of environment.rb

Fred


#3

You probably want to fiddle with $: right at the top of environment.rb

Fred

Thanks Fred,

This did not work.

Josh


#4

Fred,

I followed this link since it was close to what was needed. I added
the ENV variables to the rails project with no success.

http://www.rubygems.org/read/chapter/15#page101

There are may examples on the net about how to freeze gems, but I am
not finding any documentation about how to freeze rubygems itself.

This seems like a problem which should be common to site host ISPs.

thanks, all.

Josh