Topic: Question re Ruby syntax checking command

I'd like to learn more about the Ruby syntax checking command from the command line.

If I understand it correctly, then after invoking irb from the command line (I'm running on Windows), then I can check the syntax without running the program by entering:

$ ruby -cw c2f.rb (with c2f.rb being the filename)

The problem is I have not been able to get the "Syntax OK" response, even though I know that the file runs OK.

What am I doing wrong?

Thanks!

Re: Question re Ruby syntax checking command

ruby -c filename

should check the syntax, but dont do that from irb do it from the command line

Last edited by BasicMind (2007-03-19 07:32:03)

--

Re: Question re Ruby syntax checking command

FWIW, ruby's syntax checking won't do very much.  Pretty much any error that ruby syntax checking can catch, an IDE like RadRails/Eclipse can already catch on the fly while typing.  And it won't find most variable name typos, undefined method errors, etc.  I'm for 100% test coverage.  It's the best syntax checker around!  Check out rcov.

BrewControl.com - Brewery and Brewpub management powered by RoR

Re: Question re Ruby syntax checking command

Now I'm running those commands from the DOS prompt instead of irb, and everything works fine.

I'll keep in mind that the syntax checkers are weak, and will focus on using the tests in RoR. I'm reading the book Ruby for Rails, and find it very helpful. It gives me a logical framework to work with.

Thank you.