macでrails 3.1を動かした2011/11/16 19:55

install は brew環境

しかし ruby railsなどはrvmで管理

rubyのversinは 1.9.2 よって gemもruby1.9.2を使ってます

historyで必要な所だけ
444 brew install sqlite
445 brew upgrade sqlite
446 brew update
448 rvm use 1.9.2
451 gem install rails
453 rvm --default 1.9.2
456 gem install bundler
457 gem update rake
458 gem install sqlite3-ruby
459 gem install sqlite
460 gem install sqlite3

rails new heiheiho <-へいへいほを作成
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
create test/functional
create test/functional/.gitkeep
create test/integration
create test/integration/.gitkeep
create test/unit
create test/unit/.gitkeep
create test/performance/browsing_test.rb
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using multi_json (1.0.3)
Using activesupport (3.1.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.1)
Using erubis (2.7.0)
Using rack (1.3.5)
Using rack-cache (1.1)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.3)
Using actionpack (3.1.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.1)
Using arel (2.2.1)
Using tzinfo (0.3.31)
Using activerecord (3.1.1)
Using activeresource (3.1.1)
Installing ansi (1.4.1)
Using bundler (1.0.21)
Installing coffee-script-source (1.1.3)
Installing execjs (1.2.9)
Installing coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.1)
Using rdoc (3.11)
Using thor (0.14.6)
Using railties (3.1.1)
Installing coffee-rails (3.1.1)
Installing jquery-rails (1.0.17)
Using rails (3.1.1)
Installing sass (3.1.10)
Installing sass-rails (3.1.4)
Using sqlite3 (1.3.4)
Installing turn (0.8.3)
Installing uglifier (1.1.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

$ cd heiheiho  <−作成したへいへいホーへ移動
$ ls <−作成ファイル、ディレクトリーを確認
Gemfile app doc script
Gemfile.lock config lib test
README config.ru log tmp
Rakefile db public vendor

試しに ユーザ名とメールアドレス登録画面を動かす
$ rails g scaffold user name:string email:string
invoke active_record
create db/migrate/20111116104400_create_users.rb
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
route resources :users
invoke scaffold_controller
create app/controllers/users_controller.rb
invoke erb
create app/views/users
create app/views/users/index.html.erb
create app/views/users/edit.html.erb
create app/views/users/show.html.erb
create app/views/users/new.html.erb
create app/views/users/_form.html.erb
invoke test_unit
create test/functional/users_controller_test.rb
invoke helper
create app/helpers/users_helper.rb
invoke test_unit
create test/unit/helpers/users_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/users.js.coffee
invoke scss
create app/assets/stylesheets/users.css.scss
invoke scss
create app/assets/stylesheets/scaffolds.css.scss
$ rake db:migrate <-DB作成
== CreateUsers: migrating ====================================================
-- create_table(:users)
-> 0.0011s
== CreateUsers: migrated (0.0012s) ===========================================

$ rails s <−ディレクトリー内のスクリプト起動
=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-16 19:45:29] INFO WEBrick 1.3.1
[2011-11-16 19:45:29] INFO ruby 1.9.2 (2011-07-09) [x86_64-darwin11.0.0]
[2011-11-16 19:45:29] INFO WEBrick::HTTPServer#start: pid=2694 port=3000


Started GET "/users" for 127.0.0.1 at 2011-11-16 19:46:02 +0900
Processing by UsersController#index as HTML
User Load (0.1ms) SELECT "users".* FROM "users"
Rendered users/index.html.erb within layouts/application (10.0ms)
Compiled application.css (1ms) (pid 2694)
Compiled scaffolds.css (17ms) (pid 2694)
Compiled users.css (1ms) (pid 2694)
Compiled application.js (3ms) (pid 2694)
Compiled jquery.js (3ms) (pid 2694)
Compiled jquery_ujs.js (0ms) (pid 2694)
Compiled users.js (108ms) (pid 2694)
Completed 200 OK in 306ms (Views: 305.3ms | ActiveRecord: 0.1ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /application.css - 200 OK (0ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /scaffolds.css - 200 OK (8ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /users.css - 200 OK (4ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /jquery.js - 200 OK (22ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /jquery_ujs.js - 200 OK (6ms)


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /users.js - 200 OK (4ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:03 +0900
Served asset /application.js - 200 OK (0ms)


Started GET "/users/new" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Processing by UsersController#new as HTML
Rendered users/_form.html.erb (6.8ms)
Rendered users/new.html.erb within layouts/application (17.2ms)
Completed 200 OK in 23ms (Views: 22.1ms | ActiveRecord: 0.2ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /scaffolds.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /users.js - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /users.css - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:26 +0900
Served asset /application.js - 304 Not Modified (0ms)


Started POST "/users" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Processing by UsersController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"G1+T1tqD/ZwWaN7AleCLqqxC5pf32w+2GDstk4J2Z8I=", "user"=>{"name"=>"Shigenori Suzuki", "email"=>"butcher@******.jp"}, "commit"=>"Create User"}
SQL (15.5ms) INSERT INTO "users" ("created_at", "email", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Wed, 16 Nov 2011 10:46:45 UTC +00:00], ["email", "butcher@******.jp"], ["name", "Shigenori Suzuki"], ["updated_at", Wed, 16 Nov 2011 10:46:45 UTC +00:00]]
Redirected to http://localhost:3000/users/1
Completed 302 Found in 23ms


Started GET "/users/1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Processing by UsersController#show as HTML
Parameters: {"id"=>"1"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
Rendered users/show.html.erb within layouts/application (24.3ms)
Completed 200 OK in 33ms (Views: 30.8ms | ActiveRecord: 0.5ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /scaffolds.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /users.css - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /users.js - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:45 +0900
Served asset /application.js - 304 Not Modified (0ms)


Started GET "/users/1/edit" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Processing by UsersController#edit as HTML
Parameters: {"id"=>"1"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
Rendered users/_form.html.erb (5.2ms)
Rendered users/edit.html.erb within layouts/application (6.8ms)
Completed 200 OK in 13ms (Views: 11.5ms | ActiveRecord: 0.3ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /users.css - 304 Not Modified (0ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /scaffolds.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /users.js - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:50 +0900
Served asset /application.js - 304 Not Modified (0ms)


Started PUT "/users/1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Processing by UsersController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"G1+T1tqD/ZwWaN7AleCLqqxC5pf32w+2GDstk4J2Z8I=", "user"=>{"name"=>"Shigenori Suzuki", "email"=>"butcher@******.jp"}, "commit"=>"Update User", "id"=>"1"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
Redirected to http://localhost:3000/users/1
Completed 302 Found in 6ms


Started GET "/users/1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Processing by UsersController#show as HTML
Parameters: {"id"=>"1"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
Rendered users/show.html.erb within layouts/application (22.3ms)
Completed 200 OK in 28ms (Views: 27.2ms | ActiveRecord: 0.3ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /scaffolds.css - 304 Not Modified (0ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /users.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /users.js - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:53 +0900
Served asset /application.js - 304 Not Modified (0ms)


Started GET "/users" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Processing by UsersController#index as HTML
User Load (0.1ms) SELECT "users".* FROM "users"
Rendered users/index.html.erb within layouts/application (5.1ms)
Completed 200 OK in 11ms (Views: 10.2ms | ActiveRecord: 0.3ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /scaffolds.css - 304 Not Modified (0ms)


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /application.css - 304 Not Modified (0ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /users.css - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /jquery_ujs.js - 304 Not Modified (0ms)


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /users.js - 304 Not Modified (0ms)


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 19:46:54 +0900
Served asset /application.js - 304 Not Modified (0ms)
^C[2011-11-16 19:48:17] INFO going to shutdown ...
[2011-11-16 19:48:17] INFO WEBrick::HTTPServer#start done.
Exiting