This is what I did.
I have Rails 2.3.2 installed.
rails demo
ruby script/generate scaffold User name:string
rake db:create
rake db:migrate
ruby script/console
Loading development environment (Rails 2.3.2)User.first
User Load (0.3ms) SELECT * FROM “users” LIMIT 1
=> nil
So far so good.
Now I will freeze rails.
rake rails:freeze:gems
Try script/console againUser.first
User Load (0.3ms) SELECT * FROM “users” LIMIT 1
=> nil
Now I will get rid of frozen rails.
rake rails:unfreeze
(in /Users/nkumar/dev/scratch/demo)
rm -rf vendor/rails
Now I will install rails from github so that later I could apply the
patch.
git clone git://github.com/rails/rails.git
Now I will try script/console and I get error.
Loading development environment (Rails 2.3.2)
/Library/Ruby/Site/1.8/rubygems/requirement.rb:150:in
parse':ArgumentError: Illformed requirement ["~> 1.1.pre"] /Library/Ruby/Site/1.8/rubygems/requirement.rb:150:in
parse’:ArgumentError: Illformed requirement ["~> 1.1.pre"]
/Users/nkumar/dev/scratch/demo/vendor/rails/railties/lib/console_with_helpers.rb:5:NameError:
uninitialized constant ApplicationController
User.first
NameError: uninitialized constant User
from (irb):1
Notice that I have not even applied the patch I want to test. I am just
getting ready to apply the patch.
If I look at vendor/rails I see following directories.
-rw-r–r-- 1 nkumar staff 3019 May 11 09:07 Rakefile
drwxr-xr-x 9 nkumar staff 306 May 11 09:07 actionmailer
drwxr-xr-x 10 nkumar staff 340 May 11 09:07 actionpack
drwxr-xr-x 7 nkumar staff 238 May 11 09:07 activemodel
drwxr-xr-x 11 nkumar staff 374 May 11 09:07 activerecord
drwxr-xr-x 8 nkumar staff 272 May 11 09:07 activeresource
drwxr-xr-x 10 nkumar staff 340 May 11 09:07 activesupport
drwxr-xr-x 8 nkumar staff 272 May 11 09:07 ci
drwxr-xr-x 3 nkumar staff 102 May 11 09:07 doc
-rwxr-xr-x 1 nkumar staff 416 May 11 09:07 pushgems.rb
drwxr-xr-x 18 nkumar staff 612 May 11 09:07 railties
-rwxr-xr-x 1 nkumar staff 723 May 11 09:07 release.rb
drwxr-xr-x 3 nkumar staff 102 May 11 09:07 tools
When I had done rake:rails:freeze then I had following directories.
drwxr-xr-x 9 nkumar staff 306 May 11 09:09 actionmailer
drwxr-xr-x 10 nkumar staff 340 May 11 09:09 actionpack
drwxr-xr-x 10 nkumar staff 340 May 11 09:09 activerecord
drwxr-xr-x 7 nkumar staff 238 May 11 09:09 activeresource
drwxr-xr-x 5 nkumar staff 170 May 11 09:09 activesupport
drwxr-xr-x 16 nkumar staff 544 May 11 09:09 railties
Can someone tell me what is the right way to test a patch.
I know Rails contribution guide has information on how to test a patch.
However the document tells you to checkout rails from github and then
apply a patch. I did. However how do I tell my demo app to use the newly
patch applied rails version. The only way I know of is to do
vendor/rails and ,as I illustrated above, that did not work for me.