Ruby on WinXP (was Debugging wxruby programs.)

B

Bill Guindon

Without a DOS/Command window, firstly, I've no idea if it's a syntax
error, secondly, even if it does start, I can't use 'print' to print
out debugging statements to help me find out where I got to and what
went wrong (OK, I can open an auxilliary window and write to that, but
I could lose that window if the app dies). How do you experts debug
wxruby apps? Any help would be appreciated.

Yes, it's the old magic disappearing dos box... I went through that
years ago when I first picked up perl, and recently repeated it when I
decided to learn Ruby.

In the hopes of making it easier for other windows users to get up to
speed, I've posted some suggestions for setting up WinXP as a Ruby
friendly environment.

For now, it covers:
Customizing a command prompt for testing
Fixing the file text search on WinXP
Adding Ruby to your path
Making ruby scripts executable by name

The write ups are written at a beginner level, but some may be useful
for more advanced users. You can read them here:
http://www.rubygarden.org/ruby?RubyOnWinXP

Please let me know if you see any errors, and feel free to add your tips.
 
C

Cristi BALAN

Yes, it's the old magic disappearing dos box... I went through that
years ago when I first picked up perl, and recently repeated it when I
decided to learn Ruby.

In the hopes of making it easier for other windows users to get up to
speed, I've posted some suggestions for setting up WinXP as a Ruby
friendly environment.

For now, it covers:
Customizing a command prompt for testing
Fixing the file text search on WinXP
Adding Ruby to your path
Making ruby scripts executable by name

The write ups are written at a beginner level, but some may be useful
for more advanced users. You can read them here:
http://www.rubygarden.org/ruby?RubyOnWinXP

Please let me know if you see any errors, and feel free to add your tips.

I'm using the oneclick installer and it already sets .rb files to be
automatically ran. I also noticed it sets another thing beside what
you mention.
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW


Also, from the cmd /? output, there is another (probably more cleaner)
way of setting startup options for every shell. Since if you start a
shell from some other app that doesn' use your shortcut you won't get
the environment you are used to, this probably covers more cases.
...
If /D was NOT specified on the command line, then when CMD.EXE starts, it
looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
either or both are present, they are executed first.

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
...

But, I actually hate the cmd.exe and I use the unxutils package from:
http://unxutils.sourceforge.net/

and instead of the sh that comes with it i use the one from:
http://winbash.tigris.org/servlets/ProjectDocumentList
Besides being bash, this also has the advantge that it works if
started on a UNC path, where cmd refuses to start unless you map the
path to a drive.

If you're feeling adventurous you can set the %COMSPEC% env var to
point to bash.exe instead of cmd.exe, but be prepared for some(a lot)
of applications crashing or not working as expected because of shell
escaping/spawning differences.

Also, as a speed enhancer, I use the wonderful total commander from
http://www.ghisler.com/ . If you are stuck with explorer.exe, there
are registry settings or apps that allow starting a shell from the
current directory or add a split with a shell in it below the files.
 
B

Bill Guindon

I'm using the oneclick installer and it already sets .rb files to be
automatically ran. I also noticed it sets another thing beside what
you mention.
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW

Hadn't spotted that one, or at least hadn't tied it to the installer.
The instructions could still come in handy for other install methods,
or if you mistakenly break the association.
Also, from the cmd /? output, there is another (probably more cleaner)
way of setting startup options for every shell. Since if you start a
shell from some other app that doesn' use your shortcut you won't get
the environment you are used to, this probably covers more cases.
...
If /D was NOT specified on the command line, then when CMD.EXE starts, it
looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
either or both are present, they are executed first.

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

and/or

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

Nice touch! atm, I like the fact that I have one main ruby shell, and
my standard shell is normal, but the more I use it, and tweak it, I'm
more likely to want them all to behave the same.
But, I actually hate the cmd.exe and I use the unxutils package from:
http://unxutils.sourceforge.net/

May give it a shot. One problem is the msvcrt.dll requirement. Know
of an "easy" place to get that?
and instead of the sh that comes with it i use the one from:
http://winbash.tigris.org/servlets/ProjectDocumentList
Besides being bash, this also has the advantge that it works if
started on a UNC path, where cmd refuses to start unless you map the
path to a drive.

If you're feeling adventurous you can set the %COMSPEC% env var to
point to bash.exe instead of cmd.exe, but be prepared for some(a lot)
of applications crashing or not working as expected because of shell
escaping/spawning differences.

a brave soul indeed!
Also, as a speed enhancer, I use the wonderful total commander from
http://www.ghisler.com/ . If you are stuck with explorer.exe, there
are registry settings or apps that allow starting a shell from the
current directory or add a split with a shell in it below the files.

Thx for the links, and the info. I've added them to the
CustomCmdPrompt page, and now I have some new toys to look at :)
 
J

James Britt

I've turned off some of these associations as I tend not to want just
any script executing by default. Ruby scripts still run this way, but
no VBS or JS. This as more of an issue when I used MS Outlook, as a way
to help prevent automatic launching of scripts hidden in E-mail.

If the one-click installer is doing *anything* other than installing
Ruby, and setting file associations for Ruby scripts and Ruby file
extensions, it shouldn't.

(I've also set the default application association for most script types
to be gvim rather than any interpreter.)


James
 
C

Curt Hibbs

James said:
Bill said:
I've turned off some of these associations as I tend not to want just
any script executing by default. Ruby scripts still run this way, but
no VBS or JS. This as more of an issue when I used MS Outlook, as a way
to help prevent automatic launching of scripts hidden in E-mail.

If the one-click installer is doing *anything* other than installing
Ruby, and setting file associations for Ruby scripts and Ruby file
extensions, it shouldn't.

The One-Click Ruby Installer only adds the associations for the ruby file
extensions.

Curt
 
J

James Britt

Curt said:
The One-Click Ruby Installer only adds the associations for the ruby file
extensions.

Excellent. I figured that was the case (I didn't ever do a "before" and
"after" when installing with the 1-click).


Thanks,


James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top