On 10/31/07, Chad Woolley <[EMAIL PROTECTED]> wrote:
>
> On 10/25/07, Michael Koziarski <[EMAIL PROTECTED]> wrote:
> > What are the other issues that you've hit? If it's just about choosing
> > a different version of rails, then can't you just set
> > RAILS_GEM_VERSION in environment.rb?
> >
> > I still don't buy the need for a pre-initializers rig, but perhaps
> > there's a simpler option hiding somewhere.
>
> I just saw this was taken off the 2.0 milestone list. This is a
> simple patch with tests which addresses a real limitation of the
> current Rails. I don't think I've done a good job explaining it so
> far, so I'll try again in the form of a failing test scenario.
>
> Here is the scenario which is not currently possible without a
> preinitializer hook:
>
> 1. I want my app to use the stable gem (e.g. 1.2.5) by default, _even_
> if I have a beta gem installed (e.g. 1.2.5.7919)
> 2. I also want to use RubyGems Advanced Versioning [1] in my
> RAILS_GEM_VERSION environment variable to use the _latest_ beta gem
> that I have installed, e.g.: RAILS_GEM_VERSION='>1.2.5' or '~>1.2.5.0'
> 3. I want this to happen automatically without having to modify my app
> (no freezing rails or modifying environment.rb), because I want my
> Continuous Integration system to automatically run my app against
> multiple rails versions for regression and edge-rails testing by
> simply setting the RAILS_GEM_VERSION env var prior to the build.
>
> With this patch, I can have complete control over the gem version
> which is loaded, and what is set in the RAILS_GEM_VERSION constant
> before the normal boot gem-selection process occurs.
>
> I'm flexible, if you want me to rewrite it to not have the
> 'preinitializers' directory and instead just have a magic hook
> filename, I'm glad to rewrite the patch. Just let me know.
If all you want to do is change RAILS_GEM_VERSION to test different
versions of Rails, why don't you just change boot.rb to default to
ENV['RAILS_GEM_VERSION']:
Index: config/boot.rb
===================================================================
--- config/boot.rb (revision 323)
+++ config/boot.rb (working copy)
@@ -19,7 +19,7 @@
environment_without_comments =
IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l|
l =~ /^#/ }.join
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
- rails_gem_version = $1
+ rails_gem_version = ENV['RAILS_GEM_VERSION'] || $1
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION :
rails_gem_version
# Asking for 1.1.6 will give you 1.1.6.5206, if available --
makes it easier to use beta gems
That should be fairly to use with a CI system. DTSTTCPW.
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---