Spec Server on Windows - missing fork

Really tired of 30 second startup times to run Test::Unit tests, I would
give my left pinky for a solution to running spec_server on windows. Is
there some monkey patch that can avoid daemonizing the process
altogether (Im fine if it runs as any kind of process at all). TIA.
Error below - I have open3 and win32-process already but no dice.

Dean

rake spec:server:start
(in C:/ChessOnRails/trunk)
Starting up spec server.
Loading Rails environment
Ready
script/spec_server:81:in fork': fork() function is unimplemented on this machine (NotImplementedErr or) from script/spec_server:81:indaemonize’
from script/spec_server:113

gem list win32

*** LOCAL GEMS ***

win32-api (1.2.0, 1.0.4)
win32-clipboard (0.4.3)
win32-dir (0.3.2)
win32-eventlog (0.4.6)
win32-file (0.5.4)
win32-file-stat (1.2.7)
win32-open3 (0.2.6)
win32-process (0.5.9, 0.5.3)
win32-sapi (0.1.4)
win32-sound (0.4.1)

On Sat, Aug 2, 2008 at 6:22 PM, Dean R. [email protected]
wrote:

Starting up spec server.
Loading Rails environment
Ready
script/spec_server:81:in fork': fork() function is unimplemented on this machine (NotImplementedErr or) from script/spec_server:81:indaemonize’
from script/spec_server:113

No fork() love for us Windows users, try putting this into a batch file
(like spec_server.bat)

@echo off
start “spec_server” /min ruby.exe script\spec_server

One problem is that spec_server is not trapping Ctrl-C, so you will
require
to use Ctrl-break to stop the minized spec_server.

HTH,

Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

Exactly the kind of monkey patch I was looking for - thanks Luis !

I also saw you could edit the spec_server file to make

if options[:daemon]

into

if options[:daemon] and false or something similar, but a no touch
solution like yours is nice, and thanks for the Ctrl-Break tip.

D

Luis L. wrote:

No fork() love for us Windows users, try putting this into a batch file
(like spec_server.bat)

@echo off
start “spec_server” /min ruby.exe script\spec_server

One problem is that spec_server is not trapping Ctrl-C, so you will
require
to use Ctrl-break to stop the minized spec_server.

On Sat, Aug 2, 2008 at 9:04 PM, Mark W. [email protected]
wrote:

spec_server is one of the hidden gems of the RSpec world. It’s not
completely a slam-dunk to use, and I know people who don’t use it because of
various problems, but it’s worth working through those problems, especially
if you do T/BDD.

Yes, is a hidden gem but also have is own glitches.

One is the lack of possiblity to actually quit gracefully (they need
to trap INT and properly stop the DRb server.

Second and trickest one is reloading of the environment. Right now if
you change parts that are outside the reload mechanism of Rails,
spec_server will fail. Haven’t had time to investigate into it, sorry.

The other one is related to ANSI escape, at least on Windows.
spec_server takes spec/spec.opts and enable ANSI colors if the option
is present, but that still confuses script/spec -X and generate
garbage.

I’ve set up a vim script that runs just the current spec, where “current” is
defined as “the last spec the cursor was on” (even if you’re editing the
model or whatever). Wherever I am, I can just hit Ctrl-X and see the results
of the test almost instantly. Beat that, TextMate!

I use autotest, I just save the file and it’s executed, then I get the
total test results without distraction, beat that :wink:

Regards,

Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

spec_server is one of the hidden gems of the RSpec world. It’s not
completely a slam-dunk to use, and I know people who don’t use it
because of
various problems, but it’s worth working through those problems,
especially
if you do T/BDD.

I’ve set up a vim script that runs just the current spec, where
“current” is
defined as “the last spec the cursor was on” (even if you’re editing the
model or whatever). Wherever I am, I can just hit Ctrl-X and see the
results
of the test almost instantly. Beat that, TextMate!

///ark

On Sat, Aug 2, 2008 at 1:43 PM, Luis L. [email protected]
wrote:

One is the lack of possiblity to actually quit gracefully (they need
to trap INT and properly stop the DRb server.

I just do rake spec:server:stop. This is necessary before running rake
spec,
for instance, since rake spec drops the test database which spec_server
keeps open.

Second and trickest one is reloading of the environment. Right now if

you change parts that are outside the reload mechanism of Rails,
spec_server will fail. Haven’t had time to investigate into it, sorry.

I have a shell script called spec_restart, which just does a rake
spec:server:stop followed by rake spec:server:start. I can’t say I use
it
very much, though.

I use autotest, I just save the file and it’s executed, then I get the
total test results without distraction, beat that :wink:

I use autotest, too (well, rspactor, which is much the same thing). But
it
loads the Rails environment every time it’s triggered. The whole point
of
spec_server is that it doesn’t have to do that. autotest also runs
entire
spec file(s). With my little script, only one spec gets run, which helps
keep things narrowed down while debugging.

With both autotest and spec_server running, you kind of get the best of
both
worlds - you can T/BDD one spec at a time very quickly but also make
sure
that any other potentially affected specs are run too. Before you check
in,
of course, you do a rake spec.

///ark

On Sat, Aug 2, 2008 at 3:43 PM, Luis L. [email protected]
wrote:

to trap INT and properly stop the DRb server.
Patches welcome!

On Aug 2, 2008, at 4:43 PM, Luis L. wrote:

Yes, is a hidden gem but also have is own glitches.

One is the lack of possiblity to actually quit gracefully (they need
to trap INT and properly stop the DRb server.

Second and trickest one is reloading of the environment. Right now if
you change parts that are outside the reload mechanism of Rails,
spec_server will fail. Haven’t had time to investigate into it, sorry.

Yeah - this is usually the trickiest. Generally, as long as something
is loaded (instead of required) everything should work fine. Also -
be advised that if you set cache_classes = true in your test
environment, this is doing the same as requiring your files, meaning
the spec_server won’t work at all.

Scott

On Aug 6, 2008, at 12:04 AM, David C. wrote:

Yes, is a hidden gem but also have is own glitches.

One is the lack of possiblity to actually quit gracefully (they need
to trap INT and properly stop the DRb server.

Patches welcome!

http://www.patchesthecat.com/

I couldn’t resist.

On Wed, Aug 6, 2008 at 6:04 AM, David C. [email protected]
wrote:

One is the lack of possiblity to actually quit gracefully (they need
to trap INT and properly stop the DRb server.

Patches welcome!

I will!!

I’m not complaining, but giving a warning :wink:

I need to find it the time, so maybe around next week will have a few
hours to setup the environment and provide a patch for it.


Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs