Wednesday, December 19, 2007

More Rails2.0.2 : C-Ruby Win32

In my never-ending quest to figure out what's the deal with Rails2.0 and JRuby, I'm trying the new rails out in Win32 C-Ruby with a clean install.

Ruby-186-25 One-Click Windows Installer, installed to c:\rubytest


echo %PATH%
c:\rubytest\bin;...

gemwhich rake
c:/rubytest/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb


So far, so good. Now, let's update rubygems and get rails.


gem update --system (gem update DASH_DASHsystem)

gem --version
0.9.5

gem install rails
Successfully installed rake-0.7.3
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Successfully installed rails-2.0.2
7 gems installed

rails testapp
cd testapp
ruby script/generate scaffold blah name:string
gem install sqlite3-ruby


(download and install sqlite3.dll to c:\rubytest\bin)

rake db:migrate
(in C:/rubytest/testapp)
== 1 CreateBlahs: migrating ===============
-- create_table(:blahs)
- 0.0620s
== 1 CreateBlahs: migrated (0.0620s) ======

ruby script/server

(in another console)

irb
require 'active_resource'
class Blah < ActiveResource::Base
self.site='http://localhost:3000/'
end
b=Blah.create :name => 'Bob'

=> #<Blah:0x335287c @prefix_options={}, @attributes={"name"=>"Bob", "updated_at"=>Wed Dec 19 14:58:45 UTC 2007, "id"=>1, "created_at"=>Wed Dec 19 14:58:45 UTC 2007}>


So that sets up a WEBrick server with a resource scaffold, routed as /blahs, and accesses it remotely using ActiveResource to post to /blahs.xml and return the new Blah object. You can also fire up the web browser and go to http://localhost:3000/blahs to see the effect.

So on a whim, I figured I'd retry installing rails with JRuby 1.0.3, but I forgot that I still had Rubygems 0.9.4 on that install, and never successfully got it upgraded, so that'll be the focus of my next post.

0 Comments:

Post a Comment

<< Home