I installed ruby on windows using the one-click installer. Later on, I installed cygwin as my git shell (in my experience, cygwin is the best git shell there is for windows). As most people who work with cygwin know, you can't run gem or rspec from cygwin without further configurations. It returns an error if you attempt to do that. I had to run rspec using the cmd.exe windows shell, and then commit the work using git via the cygwin shell. Not a terrible burden, but cumbersome.
I knew that I could download a cygwin copy of ruby, but I didn't want to do it because I already had my ruby gems the way I liked them. And I also noticed that running ruby -v in cygwin would give me the version of ruby found in C:\ruby192. After examining the error message that I got when I tried to run gem or rspec in cygwin, I saw that I could run gem.bat or rspect.bat successfully in the cygwin shell. So there had to be an easy way to use windows ruby and cygwin.
Well, there is.
After looking around on the net, I found this answer by Robert Wahler in stack overflow.
You go to .bashrc in your cygwin installation (found in C:\cygwin\home\
alias gem='gem.bat' alias rake='rake.bat' alias erb='erb.bat' alias irb='irb.bat' alias rdoc='rdoc.bat' alias ri='ri.bat' alias rspec='rspec.bat' alias cucumber='cucumber.bat' alias bundle='bundle.bat'
Start the cygwin shell again, and now you will be able to use gem and rspec without having to use the .bat extensions.
http://stackoverflow.com/questions/3831131/rubygems-cygwin-posix-path-no...
I need to have cygwin on my taskbar so that I can use it. This was not a big deal in windows XP, but for some reason windows 7 doesn't like adding it. Without having it on the taskbar, it makes it harder to use it, and then I stop using git as often as I used to use it.
But I found an easy way around to add it to the taskbar.
1. Make a shortcut of cmd.exe, found at C:\Windows\System32. It will tell you you can't make a shortcut on the folder, but if you want one on the desktop. Say yes.
2. Drag this shortcut into the taskbar. It will stick.
3. Right click on the new cmd.exe icon on the taskbar. A menu will pop up. Then right click on the cmd.exe shortcut, and click Properties.
4. Now find where Cygwin.bat is located. Get the path, and replace the contents of the Target field with it.
And you are done. Now when you click on the icon, the cygwin shell will run.
So my nice little bash script wasn't woking on cygwin. What could be wrong? I was getting a weird error saying that my file was not ending correctly.
What was the problem?
Answer: working on Windows.
No, it is not what it sounds! No OS zealotry here! The problem was that my beloved Vim adapts to its environs very well, so it was adding a CrLF at the end of my script file. Cygwin couldn't deal with that, ergo the error. http://stackoverflow.com/questions/630650/errors-on-beginner-bash-script
The solution on vim is easy:
:set fileformat=unix
:w
I found the solution here: