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:in `daemonize'' 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) -- Posted via http://www.ruby-forum.com/.
On Sat, Aug 2, 2008 at 6:22 PM, Dean Radcliffe <lists at ruby-forum.com> wrote:> 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:in `daemonize'' > 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 Lavena 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080802/f4ff0bdb/attachment.html>
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 Lavena 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.-- Posted via http://www.ruby-forum.com/.
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080802/35807095/attachment.html>
On Sat, Aug 2, 2008 at 9:04 PM, Mark Wilden <mark.wilden at gmail.com> 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 ;-) Regards, -- Luis Lavena 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
On Sat, Aug 2, 2008 at 1:43 PM, Luis Lavena <luislavena at gmail.com> 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 ;-) >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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080802/be1046cd/attachment-0001.html>
On Aug 2, 2008, at 4:43 PM, Luis Lavena wrote:> On Sat, Aug 2, 2008 at 9:04 PM, Mark Wilden <mark.wilden at gmail.com> > 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.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 Sat, Aug 2, 2008 at 3:43 PM, Luis Lavena <luislavena at gmail.com> wrote:> On Sat, Aug 2, 2008 at 9:04 PM, Mark Wilden <mark.wilden at gmail.com> 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.Patches welcome!> > 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 ;-) > > Regards, > -- > Luis Lavena > 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 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Aug 6, 2008, at 12:04 AM, David Chelimsky wrote:> On Sat, Aug 2, 2008 at 3:43 PM, Luis Lavena <luislavena at gmail.com> > wrote: >> On Sat, Aug 2, 2008 at 9:04 PM, Mark Wilden <mark.wilden at gmail.com> >> 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. > > Patches welcome!http://www.patchesthecat.com/ I couldn''t resist.> > >> >> 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 ;-) >> >> Regards, >> -- >> Luis Lavena >> 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 >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On Wed, Aug 6, 2008 at 6:04 AM, David Chelimsky <dchelimsky at gmail.com> wrote:> On Sat, Aug 2, 2008 at 3:43 PM, Luis Lavena <luislavena at gmail.com> wrote: >> On Sat, Aug 2, 2008 at 9:04 PM, Mark Wilden <mark.wilden at gmail.com> 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. > > Patches welcome! >I will!! I''m not complaining, but giving a warning ;-) 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 Lavena 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