align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditemptyheartfacebookfullheartglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo

RE: [ruby-81] Rails 1.2.6 and 2.x co-existing on a Windows box?

From: Jon S.
Sent on: Monday, April 21, 2008 5:58 PM
Well... What I feared would happen, did...

I installed the rails 2.0.2 gem.
It required that I update to rubygems 0.9.4 from 0.9.2 which I did.
I created a new rails 2 application.

Now neither my new 2.x app runs nor my old 1.2.6 apps!!!

2.x crashes as follows. It seems to be trying to get to the 1.2.6 app, even
though the environment .rb is properly set.
====================­===
"3428"
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:30...­
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at[masked]:3003
** Starting Rails with development environment...
ExitingC:/Dev/Instan­tRails/ruby/lib/ruby­/gems/1.8/gems/rails­-1.2.6/lib/initi
alizer.rb:334:in `send'
: undefined method `session=' for ActionController::Ba­se:Class
(NoMethodError)
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:334:in `initialize_framewor­k_settings'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:333:in `each'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:333:in `initialize_framewor­k_settings'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:330:in `each'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:330:in `initialize_framewor­k_settings'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:100:in `process'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:47:in `send'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/rails-1.2.6/­lib/initializer.
rb:47:in `run'
	 ... 29 levels...
	from
C:/Dev/InstantRails/­ruby/lib/ruby/site_r­uby/1.8/rubygems/cus­tom_require.rb:2
7:in `require'
	from ./script/server:3
	from -e:2:in `load'
	from -e:2

Old apps (1.2.6) crash as follows. ActiveSupport-1.4.4?­??
====================­=============
"2276"
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:30...­
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at[masked]:3001
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
ExitingC:/Dev/Instan­tRails/ruby/lib/ruby­/site_ruby/1.8/rubyg­ems/custom_requi
re.rb:27:in `gem_original_requir­e'
: no such file to load --
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/mongrel-1.0.­1-x86-mswin32/li
b/mongrel/init.rb (MissingSourceFile)
	from
C:/Dev/InstantRails/­ruby/lib/ruby/site_r­uby/1.8/rubygems/cus­tom_require.rb:2
7:in `require'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/activesuppor­t-1.4.4/lib/acti
ve_support/dependenc­ies.rb:495:in `require'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/activesuppor­t-1.4.4/lib/acti
ve_support/dependenc­ies.rb:342:in `new_constants_in'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/activesuppor­t-1.4.4/lib/acti
ve_support/dependenc­ies.rb:495:in `require'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/gem_plugin-0­.2.3/lib/gem_plu
gin.rb:134:in `load'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/site_r­uby/1.8/rubygems/sou­rce_index.rb:184
:in `each'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/site_r­uby/1.8/rubygems/sou­rce_index.rb:184
:in `each'
	from
C:/Dev/InstantRails/­ruby/lib/ruby/gems/1­.8/gems/gem_plugin-0­.2.3/lib/gem_plu
gin.rb:112:in `load'
	 ... 23 levels...
	from
C:/Dev/InstantRails/­ruby/lib/ruby/site_r­uby/1.8/rubygems/cus­tom_require.rb:2
7:in `require'
	from ./script/server:3
	from -e:2:in `load'
	from -e:2
===================
Unless it's something really simple, I'm going to have to try to undo all
this and at least get my old apps back & working ;}

...jon

--


-----Original Message-----
From: [address removed] [mailto:[address removed]] On Behalf Of Chad
Woolley
Sent: Thursday, April 17,[masked]:29 PM
To: [address removed]
Subject: Re: [ruby-81] Rails 1.2.6 and 2.x co-existing on a Windows box?

On Thu, Apr 17, 2008 at 7:50 AM, Jon Seidel <[address removed]> wrote:
> I'm running InstantRails on a windows box (Rails 1.2.6).  I'm considering
> installing Rails 2.x for some testing I need to do (OpenLaszlo requires
> Rails 2.0) but I need to keep 1.2.6 for my other stuff.
>
> On Linux this would be easy, but I'm not sure how to make this happen on a
> Windoze box.

Do you want to switch rails versions for DIFFERENT apps?  If so, you
can just set the RAILS_GEM_VERSION in environment.rb for each app and
install both gems.

If you want to easily switch rails versions for the SAME app, here's
how you can do it:

In the boot.rb for Rails 2.0, you can add logic to
config/preinitialize­r.rb to issue the proper "gem('rails',version­)"
command, based on the RAILS_GEM_VERSION environment variable.  Don't
freeze anything, and don't set RAILS_GEM_VERSION in your
environment.rb.

Then, you can just set the environment variable to pick which Rails
gem you want to use, without changing your app or freezing anything.
Some would say it is a good practice to use this approach to never
vendor your Rails :)

The nice thing is that the 2.0 boot.rb is completely backward
compatible AFAIK (and there were several buggy versions of boot.rb
prior to 2.0).  That means you can just paste in a Rails 2 version of
boot.rb (from a dummy generated app) to your 1.2.x app, create
config/preinitialize­r.rb, and you are set.

Explicitly managing all your dependency Gem versions (including rails
itself) is a good thing, and I created the GemInstaller tool [1] to
support this.  I also have a sample rails app [2] which shows how to
use the RAILS_GEM_VERSION env var trick [3] in the context of
GemInstaller.  Sorry, I haven't updated the GemInstaller docs [4] to
reflect the new preinitiailzer stuff yet.

I have used this approach with success on multiple projects.  It is
especially useful when you want to use Continuous Integration to test
your app or plugin against multiple versions of rails for completely
automated backward- or forward- compatibility assurance (which you
cannot easily do if you freeze Rails).

Let me know if you have questions.

Good luck!
-- Chad

[1] http://geminstall...­
[2]
http://geminstall...­
[3]
http://geminstall...­
nfig/geminstaller_ra­ils.yml
[4] http://geminstall...­



--
Please Note: If you hit "REPLY", your message will be sent to everyone on
this mailing list ([address removed])
http://ruby.meetu...­
This message was sent by Chad Woolley ([address removed]) from The
East Bay Ruby Meetup Group.
To learn more about Chad Woolley, visit his/her member profile:
http://ruby.meetu...­
To unsubscribe or to update your mailing list settings, click here:
http://www.meetup...­

Meetup Support: [address removed]
632 Broadway New York NY 10012 USA


Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy