[Rspec-devel] Rake Task - not for Windows ?

aslak hellesoy aslak.hellesoy at gmail.com
Tue Aug 22 06:48:09 EDT 2006


On 8/22/06, DeeJay <smartgpx at gmail.com> wrote:
>
> "Question to DeeJay:
> 1) What exactly should we do to reproduce this on a windows box?
> 2) Does the spec task behave badly for both plain ruby and rcov usage?"
>
> To answer your questions first -
>
> 1)  As documented in #4891
>
> >  rake examples_with_rcov --trace
>
> where rakefile contains  the example given
> in the first reversed-out code box at
> http://rspec.rubyforge.org/tools/rcov.html
>
> (rcov is installed on the system and produces results in coverage if invoked
> from the command line.)
>
> The response, ignoring the file-selection report, is:
>
> rake aborted!
> undefined method `exitstatus' for nil:NilClass
> C:/OneClickRuby/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in
> `sh'
> C:/OneClickRuby/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in
> `sh'
> C:/OneClickRuby/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in
> `sh'
> C:/OneClickRuby/ruby/lib/ruby/gems/1.8/gems/rspec-0.6.0/lib/spec/rake/spectask.rb:140:in
> `run'
> [..further backtrace suppressed]
>
>
> 2) This only happens when t.rcov = true is set
>

Ok,  I think I know what causes the bug. Ruby/Rubygems/Windows has a
"bug" that makes it impossible to run a shell script without its
extension. On Windows, there is no rcov script (but an rcov.cmd or
rcov.bat one) and telling ruby to run rcov won't work. The error
message that is seen is a sideeffect and doesn't really help
diagnosing this.

I think we can fix this in the next release (using "ruby -S rcov"
instead of "rcov") to fire up rcov.

In the meanwhile, try to hack your spectask.rb and change the line:

  interpreter = @rcov ? "rcov" : "ruby"

to this:

  interpreter = @rcov ? "rcov.cmd" : "ruby"

or possibly

  interpreter = @rcov ? "rcov.bat" : "ruby"

Hope this helps.

>
> Some background.
>
> Assume (as a 'user-story' if you like) that I am coming to this with little
> previous
> experience or understanding of rake, rcov or rspec.
>
> Refer to http://rspec.rubyforge.org/tools/rcov.html
>
> What is the nature of the code in the reversed-out box? It looked like Ruby,
> so
> I tried passing it to ruby. Silence. It starts with "require 'rake' ", so it
> didn't
> seem logical to try to pass it to rake, but I tried. Silence. So I started
> clicking through
> http://rspec.rubyforge.org/rdoc/classes/Spec/Rake/SpecTask.html
> and when I got to the source for 'run' and could not find 'sh' documented in
> fxri I assumed I had found the  reason for what I perceived to be an
> incompatibility between SpecTask and Windows.
>
> A note with the sample task documenting how to run it would make
> life easier for newcomers.  :-)}
>
> I now know, by reference to bug #4891, that I have to invoke rake
> with an argument that is extracted from a text string buried half-way
> down the sample code. (I think I can see why, but I hope you can
> see why it isn't obvious to a newcomer?)
>

I have updated the website documentation in subversion so it's more
newcomer friendly. It will be on the website after the next release
(we only upload the website when we release a new version of RSpec).

>
> Thanks for listening -
>

Thanks for helping us improve things.

Aslak

> David/DeeJay
>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
>


More information about the Rspec-devel mailing list