Mr. Kennedy Mr. Kennedy - 3 months ago 15
PowerShell Question

How to use ri with Ruby in powershell?

When I enter "ri" the powershell thinks it is "Remove-Item" - how do I use the ri command to invoke the "R"uby "I"ndex?

After poking around SO: ruby 1.9 ri on Windows knows nothing about any classes I tried cd'ing to the C:\Ruby22 and entering:

rdoc --all --ri


This successfully installed gems and such, but ri remained 'remove item'. I searched the web and the Ruby docs. Having found this: http://samuelmullen.com/2012/01/up-and-running-with-ruby-interactive-ri/ I entered these into the powershell command line:

gem install rdoc rdoc-data
rdoc-data --install


but when I enter "ri" the powershell still thinks it is "Remove-Item"

How can I use the ruby documentation tool?

I duplicated these files:

C:\Ruby22\bin\ri

C:\Ruby22\bin\ri.bat

And renamed them to:

C:\Ruby22\bin\rr

C:\Ruby22\bin\rr.bat

Now I can enter "rr" in Powershell and get the functionality of the Ruby "r"uby "i"ndex.

How would I change the existing "ri" command in Powershell?

Answer

I entered this in Powershell's command line prompt:

rm -Force alias:ri

to get rid of the (ri = Remove-Item) association.

Now I can delete the duplicate files I named C:\Ruby22\bin\rr & rr.bat and having set-up the Ruby Index with the above commands, Powershell recognizes "ri" as the command for Ruby Index. Yay.

Pardon my ignorance of shell conventions, but I found this resource useful: http://powershell.com/cs/blogs/tips/archive/2009/04/16/deleting-aliases.aspx

...and lastly, the other "remove" commands still work just fine: Remove-Item, remove-item, rm, rmdir, rd...

Comments