Rails3.0を試す

RoRは覚えようと思いつつ途中で放り出す筆頭のフレームワークなんだが、3.0が出ていい機会なので復習してみた。

プロジェクトの生成からいきなり違う。 rails newコマンドを使う。

% rails new `pwd`/hello

WEBrickの起動もこれまでと異なる。

% cd hello
% ./script/rails server
/Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:132: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-09-24 20:11:26] INFO  WEBrick 1.3.1
[2010-09-24 20:11:26] INFO  ruby 1.8.7 (2009-06-12) [universal-darwin10.0]
[2010-09-24 20:11:26] INFO  WEBrick::HTTPServer#start: pid=2670 port=3000

最初に作られるファイル。Gemfileとか config.ruとか新しいファイルがある。ここらへんから調べてみるか。

% tree -F
.
|-- Gemfile
|-- README
|-- Rakefile
|-- app/
|   |-- controllers/
|   |   `-- application_controller.rb
|   |-- helpers/
|   |   `-- application_helper.rb
|   |-- mailers/
|   |-- models/
|   `-- views/
|       `-- layouts/
|           `-- application.html.erb
|-- config/
|   |-- application.rb
|   |-- boot.rb
|   |-- database.yml
|   |-- environment.rb
|   |-- environments/
|   |   |-- development.rb
|   |   |-- production.rb
|   |   `-- test.rb
|   |-- initializers/
|   |   |-- backtrace_silencers.rb
|   |   |-- inflections.rb
|   |   |-- mime_types.rb
|   |   |-- secret_token.rb
|   |   `-- session_store.rb
|   |-- locales/
|   |   `-- en.yml
|   `-- routes.rb
|-- config.ru
|-- db/
|   `-- seeds.rb
|-- doc/
|   `-- README_FOR_APP
|-- lib/
|   `-- tasks/
|-- log/
|   |-- development.log
|   |-- production.log
|   |-- server.log
|   `-- test.log
|-- public/
|   |-- 404.html
|   |-- 422.html
|   |-- 500.html
|   |-- favicon.ico
|   |-- images/
|   |   `-- rails.png
|   |-- index.html
|   |-- javascripts/
|   |   |-- application.js
|   |   |-- controls.js
|   |   |-- dragdrop.js
|   |   |-- effects.js
|   |   |-- prototype.js
|   |   `-- rails.js
|   |-- robots.txt
|   `-- stylesheets/
|-- script/
|   `-- rails*
|-- test/
|   |-- fixtures/
|   |-- functional/
|   |-- integration/
|   |-- performance/
|   |   `-- browsing_test.rb
|   |-- test_helper.rb
|   `-- unit/
|-- tmp/
|   |-- cache/
|   |-- pids/
|   |-- sessions/
|   `-- sockets/
`-- vendor/
    `-- plugins/

34 directories, 43 files