とよぶ

歌いながらコード書いてます

Windows×eclipseでRuby on Rails

環境

Windows7 Professional
ruby1.9.3
rails3.2.13
eclipse juno

Ruby install

以下よりインストール
http://rubyinstaller.org/
f:id:takasing:20130415184007p:plain
パス通す
f:id:takasing:20130415184008p:plain
f:id:takasing:20130415184005p:plain

コマンドプロンプトで確認

>ruby --version
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]

>gem update --system
Updating rubygems-update
Fetching: rubygems-update-2.0.3.gem (100%)
Successfully installed rubygems-update-2.0.3
Installing RubyGems 2.0.3
RubyGems 2.0.3 installed
Installing ri documentation for rubygems-2.0.3

ERROR:  While executing gem ... (ArgumentError)
    invalid byte sequence in Windows-31J

# 以下をやるとはかなくなるらしい。。。検証不可でした。
>set LANG=ja_JP.UTF-8
>gem update --system
Latest version currently installed. Aborting.
>gem update rake
Updating installed gems
Updating rake
Fetching: rake-10.0.4.gem (100%)
rake's executable "rake" conflicts with C:/Ruby193/bin/rake
Overwrite the executable? [yN]  y
Successfully installed rake-10.0.4
Installing ri documentation for rake-10.0.4
Installing darkfish documentation for rake-10.0.4
Gems updated: rake

DEVELOPMENT KIT

http://rubyinstaller.org/downloads/
画像
実行する。ディレクトリの指定はC:直下とかで。
そのまま展開されるので、ruby-devkitとかで空ディレクトリ作って展開すると吉。
展開後、コマンドプロンプトで以下コマンドを実行

>C:\ruby-devkit\devkitvars

DEVELOPMENT KITの動作確認的な

>gem install json --no-ri --no-rdoc
Fetching: json-1.7.7.gem (100%)
Building native extensions.  This could take a while...
Successfully installed json-1.7.7
1 gem installed

※ダメな場合は以下URLを参考に。
http://www.oiax.jp/rails/zakkan/rails_3_1_installation_on_windows.html
僕は大丈夫だったので、なんとも言えません。。。←

railsのインストール

>gem install rails --version=3.2.13
Fetching: i18n-0.6.1.gem (100%)
Successfully installed i18n-0.6.1
Fetching: multi_json-1.7.2.gem (100%)
Successfully installed multi_json-1.7.2
Fetching: activesupport-3.2.13.gem (100%)
Successfully installed activesupport-3.2.13
Fetching: builder-3.0.4.gem (100%)
Successfully installed builder-3.0.4
Fetching: activemodel-3.2.13.gem (100%)
Successfully installed activemodel-3.2.13
Fetching: rack-1.4.5.gem (100%)
Successfully installed rack-1.4.5
Fetching: rack-cache-1.2.gem (100%)
Successfully installed rack-cache-1.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: journey-1.0.4.gem (100%)
Successfully installed journey-1.0.4
Fetching: hike-1.2.2.gem (100%)
Successfully installed hike-1.2.2
Fetching: tilt-1.3.7.gem (100%)
Successfully installed tilt-1.3.7
Fetching: sprockets-2.2.2.gem (100%)
Successfully installed sprockets-2.2.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: actionpack-3.2.13.gem (100%)
Successfully installed actionpack-3.2.13
Fetching: arel-3.0.2.gem (100%)
Successfully installed arel-3.0.2
Fetching: tzinfo-0.3.37.gem (100%)
Successfully installed tzinfo-0.3.37
Fetching: activerecord-3.2.13.gem (100%)
Successfully installed activerecord-3.2.13
Fetching: activeresource-3.2.13.gem (100%)
Successfully installed activeresource-3.2.13
Fetching: mime-types-1.22.gem (100%)
Successfully installed mime-types-1.22
Fetching: polyglot-0.3.3.gem (100%)
Successfully installed polyglot-0.3.3
Fetching: treetop-1.4.12.gem (100%)
Successfully installed treetop-1.4.12
Fetching: mail-2.5.3.gem (100%)
Successfully installed mail-2.5.3
Fetching: actionmailer-3.2.13.gem (100%)
Successfully installed actionmailer-3.2.13
Fetching: rack-ssl-1.3.3.gem (100%)
Successfully installed rack-ssl-1.3.3
Fetching: thor-0.18.1.gem (100%)
Successfully installed thor-0.18.1
Fetching: railties-3.2.13.gem (100%)
Successfully installed railties-3.2.13
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
Fetching: rails-3.2.13.gem (100%)
Successfully installed rails-3.2.13
Installing ri documentation for i18n-0.6.1
Installing ri documentation for multi_json-1.7.2
Installing ri documentation for activesupport-3.2.13
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for test/performance.rb, skipping
Installing ri documentation for builder-3.0.4
Installing ri documentation for activemodel-3.2.13
unable to convert "\x89" from ASCII-8BIT to UTF-8 for test/multipart/binary, skipping
Installing ri documentation for rack-1.4.5
Installing ri documentation for rack-cache-1.2
Installing ri documentation for rack-test-0.6.2
Installing ri documentation for journey-1.0.4
Installing ri documentation for hike-1.2.2
Installing ri documentation for tilt-1.3.7
Installing ri documentation for sprockets-2.2.2
Installing ri documentation for erubis-2.7.0
Installing ri documentation for actionpack-3.2.13
Installing ri documentation for arel-3.0.2
Installing ri documentation for tzinfo-0.3.37
Installing ri documentation for activerecord-3.2.13
Installing ri documentation for activeresource-3.2.13
Installing ri documentation for mime-types-1.22
Installing ri documentation for polyglot-0.3.3
Installing ri documentation for treetop-1.4.12
Installing ri documentation for mail-2.5.3
Installing ri documentation for actionmailer-3.2.13
Installing ri documentation for rack-ssl-1.3.3
Installing ri documentation for thor-0.18.1
Installing ri documentation for railties-3.2.13
Installing ri documentation for bundler-1.3.5
Installing ri documentation for rails-3.2.13
28 gems installed

skippingしたやつらなんだろうな。。。そのうち調べます←

railsの動作確認

>rails new hoge
      create
      create  README.rdoc
      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/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/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.4)
Using i18n (0.6.1)
Using multi_json (1.7.2)
Using activesupport (3.2.13)
Using builder (3.0.4)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.2)
Using tilt (1.3.7)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.22)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.5.3)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using bundler (1.3.5)
Installing coffee-script-source (1.6.2)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Installing rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.13)
Installing coffee-rails (3.2.2)
Installing jquery-rails (2.2.1)
Using rails (3.2.13)
Installing sass (3.2.7)
Installing sass-rails (3.2.6)
Installing sqlite3 (1.3.7)
Installing uglifier (2.0.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

できてる\(^o^)/

eclipse pluginのRadRailsインストール

以下URLにアクセス
http://www.aptana.com/products/studio3/download
入力項目は名前だけ入れてもいいみたいです(ごめんなさい。。。)
Eclipse Plug-in Version」をダウンロード。
表示されるURLを元にeclipseにインストール(詳しくは他のサイトでw)

railsプロジェクトを作成

New→Other...→Rails Project
プロジェクト名を入力してFinishを押すとひな形ができる。

だいたいこんな感じ。
後はプラグインによってUnixライクにお仕事ができます(まあイケてるかどうかは。。。w)\(^o^)/

広告を非表示にする