[rspec-devel] discovering rails version
Brandon Keepers
bkeepers at gmail.com
Tue Apr 24 16:40:53 EDT 2007
On Apr 22, 2007, at 1:33 AM, David Chelimsky wrote:
> Hi all,
>
> Edge rails has been using new template extensions (.erb instead of
> .rhtml), which means that Spec::Rails' generators need to find out
> what version of rails you are running so it can do the right thing. A
> couple of weeks ago, Rails::VERSION::STRING was returning 1.2.0 in
> edge. Ironically, rspec was able to use that information temporarily
> to distinguish edge from the published versions, since 1.2.0 was
> retracted when 1.2.1 was released.
>
> So I posted a request to rails trac () to change the version number to
> something larger that 1.2.3 so the generator can ask if
> Rails::VERSION::STRING <= 1.2.3 to decide what kind of template to
> generate.
>
> As it turns out, a change to the version was committed in the last few
> days. Unfortunately it was changed to 1.2.3, which means that the real
> 1.2.3 AND edge (the imposter) are both identifying themselves as
> 1.2.3, which means that Spec::Rails' generators can't know to do the
> right thing for edge, which means that rspec:pre_commit fails against
> edge unless you manually change railties/lib/rails/version.rb to say
> 1.2.4. I've done this locally, but since we don't commit rails to
> rspec's svn, if you're doing any work on rspec you'll have to make
> this change locally to get pre_commit to pass edge rails.
>
> So I posted an additional plea (with a patch) to rails trac to make
> the version 1.2.4, but I understand that the rails team is busy and
> don't expect this to be fixed very quickly, if at all.
>
> So - any suggestions as to a different way of determining the rails
> version?
ActionView::Base.const_defined?
('DEFAULT_TEMPLATE_HANDLER_PREFERENCE') &&
ActionView::Base::DEFAULT_TEMPLATE_HANDLER_PREFERENCE.include?
('erb')
DEFAULT_TEMPLATE_HANDLER_PREFERENCE was just added a couple weeks
ago, so it won't help for people on an older version of edge, but it
at least gives something to go off of.
Brandon
More information about the rspec-devel
mailing list