c:\work> ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
c:\work> heroku login
Enter your Heroku credentials.
Email: (メールアドレス)
Password (typing will be hidden): (パスワード)
Authentication successful.
c:\work> gem install rails
.
.
.
Fetching: json-1.7.5.gem (100%)
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
c:\work> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
(展開場所は c:\devkit にした)
c:\work> cd \devkit
c:\devkit> ruby dk.rb init
[INFO] found RubyInstaller v1.9.2 at C:/Program Files (x86)/ruby-1.9.2
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
- あれ? 私は C:\ruby-1.9.2 にある rubyを使っていたはずだが。
c:\devkit> which ruby
ruby:
C:\ruby-1.9.2\bin\ruby.EXE
- ですよね。 ということで config.ymlを編集して、C:\ruby-1.9.2 に変更。
C:\devkit> vi config.yml
(C:/Program Files (x86)/ruby-1.9.2をC:\ruby-1.9.2に変更)
C:\devkit> ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.
C:/ruby-1.9.2
C:\devkit> ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/ruby-1.9.2'
[INFO] Installing 'C:/ruby-1.9.2/lib/ruby/site_ruby/devkit.rb'
C:\devkit> gem install rdiscount --platform=ruby
Fetching: rdiscount-1.6.8.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...
c:\devkit> cd \work
c:\work> gem install rails
Successfully installed json-1.7.5 ←さっきはこけたけど、今度は入ったよ。
...
Successfully installed rails-3.2.9
...
c:\work> rails -v
Rails 3.2.9
2. Webアプリをローカルに用意する。
c:\work> rails new myapp
c:\work> cd myapp
c:\work\myapp> vi Gemfile
(gem 'sqlite3' の行を gem 'pg' に書き換える)
c:\work\myapp> bundle install
c:\work\myapp> rails server
(ブラウザで http://localhost:3000 にアクセス。Welcome aboardのページが表示)