[rspec-devel] discovering rails version
aslak hellesoy
aslak.hellesoy at gmail.com
Mon Apr 23 18:11:11 EDT 2007
On 4/23/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> On 4/22/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> > On 4/22/07, David Chelimsky <dchelimsky at gmail.com> 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?
> > >
> >
> > Look at the rev number of the Rails working copy?
> >
> > ruby -e 'puts `svn info`.match(/Revision: (.*)/n)[1]'
>
> That only works for when rails is specifically checked out (not
> exported) into vendor/rails.
>
I thought the context was Spec::Rails's own build environment. Did you
mean we need to detect this in Spec::Rails when used in an arbitrary
Rails project?
In that case, why not assume the version is whatever
Rails::VERSION::STRING says - unless it's specified expplicitly in
Spec::Configure (we could add a hook for it)
Aslak
> Other ideas?
>
> >
> > Aslak
> >
> > > Thanks,
> > > David
> > > _______________________________________________
> > > rspec-devel mailing list
> > > rspec-devel at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/rspec-devel
> > >
> > _______________________________________________
> > rspec-devel mailing list
> > rspec-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-devel
> >
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
More information about the rspec-devel
mailing list