On 10/31/07, Jeremy Evans <[EMAIL PROTECTED]> wrote:
> I'm not sure how easy it is to specify a advanced version spec (I've
> never needed to), but assuming it can be specified as a string, it's
> doable from the environment.

It's just the version prefixed with (in)equality or ~, see the link to
rubygems docs earlier in thread for more info.

The problem is that the current boot.rb hardcodes the prefix to "="
and assumes RAILS_GEM_VERSION.  Now that we've discussed this, I
realize that it should really be more flexible.  Given bitsweat's
excellent refactoring of boot.rb to make it testable and isolate
Rails::GemBoot.gem_version, we should go ahead and allow any rubygems
version spec in RAILS_GEM_VERSION.  I think the default is equality,
so it may be as easy as removing the "=" (but should still be
well-tested anyway).

I'll go ahead and try to code up a separate patch to implement this
behavior.  Even though it addresses some of my issues, it still
doesn't allow the flexibility that a preinit hook would.  It will
prune my pitch for the preinit patch, but I'll be unselfish and
hopefully code and karma will prevail.

> Given your scenario, my advice would be to wrap whatever command you
> use to start Rails (mongrel_rails, style, etc.) in a script that
> checks the gem version in the environment and downloads the gems
> before starting rails if they are not currently installed.

That's a great idea, and what we currently do as part of our cap
scripts.  As well as the beginning of our CI rake tasks.  As for
mongrel, I suppose I could write a plugin, but that's more
duplication.  Not to mention when we occasionally test under webrick
(handles PUTs differently), which doesn't have plugin support.

The point is, I want everything dependency-related (gem installation
and load path management) to be self-contained, be in one place, and
happen automatically whenever I run an app - whether that is during a
deploy, during local tests, during CI, or when I'm just firing up the
app via webrick or mongrel.  Call me a pie-in-the-sky dreamer, but I
know it's possible.  An _official_ pre-init hook is one of the key
requirements, though.  Yes, I can continue to hack boot.rb, which
would probably be easier than repeatedly explaining the justification
for a preinit hook, but I started this thread and patch based on the
principle that I shouldn't be editing a file that tells me not to edit
it :)

Thanks again for discussing, it's helping me to clarify things and
address the parts of the issue separately.

-- Chad

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to