IMPORTANT: Rake not found after installing Rails (RubyInstaller 1.9.2-p0 or 1.9.2-p136)

Hello,

Ruby 1.9.2-p0 included some bundled gems (rake, rdoc and minitest). If
you happen to develop using Rails, will find that after installing
Rails, “rake” command might not work with the following output:

C:\Users\Luis>rake --version
C:/Ruby192/lib/ruby/1.9.1/rubygems.rb:340:in bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception) from C:/Ruby192/bin/rake:19:in

The issue was corrected in Ruby source code:

http://redmine.ruby-lang.org/issues/show/3805

But during the backports, there was a confusion and it is still
present in latest 1.9.2-p136:

http://redmine.ruby-lang.org/issues/show/4228

To solve this, you need to manually remove rake.gemspec,
minitest.gemspec and rdoc.gemspec files.

With the goal of making things simple, please copy the following into
“clean-gemspec.bat” file and place it in your Ruby 1.9.2 installation
directory:

@ECHO OFF
SETLOCAL
ECHO This batch file will correct the non-versioned gemspecs distributed
ECHO by RubyInstaller 1.9.2-p136
ECHO.
ECHO Please place this file in the root directory of your Ruby 1.9.2
install
ECHO (C:\Ruby192 by default)
ECHO.
PAUSE
SET ROOT=%CD%\lib\ruby\gems\1.9.1\specifications
ECHO Removing minitest.gemspec from %ROOT%
DEL %ROOT%\minitest.gemspec /Q/F
ECHO Removing rake.gemspec from %ROOT%
DEL %ROOT%\rake.gemspec /Q/F
ECHO Removing rdoc.gemspec from %ROOT%
DEL %ROOT%\rdoc.gemspec /Q/F
ECHO.
ECHO Done. Thank you, and apologies for the problem.
ECHO.

Now, from a command prompt, and inside your Ruby 1.9.2 folder (“CD
C:\Ruby192”), please invoke the batch file:

C:\Ruby192>clean-gemspec.bat

The following will be displayed in your console:

This batch file will correct the non-versioned gemspecs distributed
by RubyInstaller 1.9.2-p136

Please place this file in the root directory of your Ruby 1.9.2 install
(C:\Ruby192 by default)

Press any key to continue . . .
Removing minitest.gemspec from
C:\Ruby192\lib\ruby\gems\1.9.1\specifications
Removing rake.gemspec from C:\Ruby192\lib\ruby\gems\1.9.1\specifications
Removing rdoc.gemspec from C:\Ruby192\lib\ruby\gems\1.9.1\specifications

Done. Thank you, and apologies for the problem.

====

Once that is executed, rake should work again:

C:\Ruby192>rake --version
rake, version 0.8.7

Please apologize the problem this issue might have caused on your
development environment.

Thank you for your time.