ページ

2010年12月15日水曜日

Ruby on Rails 3 ことはじめ その1

Ruby 1.9.2のインストール
Windows用インストーラをダウンロード。ここをクリック

ダウンロードしたexeファイルを実行すると、
インストールウィザードが立ち上がる。
ウィザードの途中で、
・Add Ruby executables to your PATH
・Associate .rb and .rbw files with this Ruby installation
この2つにチェックを入れる。
Installをクリックして、インストール実行。

インストール完了後、コマンドプロンプトにて、インストールされているかどうか確認。
>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

RubyGems1.3.7のインストール
RubyGemsをダウンロード。ここをクリック
ダウンロードしたzipを解凍。
コマンドプロンプトで、回答したディレクトリに移動して、次の通り実行。
>ruby setup.rb

D:/Downloads/rubygems-1.3.7/lib/rubygems/source_index.rb:68:in `installed_spec_d
irectories': undefined method `path' for Gem:Module (NoMethodError)
        from D:/Downloads/rubygems-1.3.7/lib/rubygems/source_index.rb:58:in `fro
m_installed_gems'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:883:in `source_index'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems/gem_path_searcher.rb:81:in
 `init_gemspecs'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems/gem_path_searcher.rb:13:in
 `initialize'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:841:in `new'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:841:in `block in search
er'
        from <internal:prelude>:10:in `synchronize'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:840:in `searcher'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:479:in `find_files'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:983:in `load_plugins'
        from D:/Downloads/rubygems-1.3.7/lib/rubygems.rb:1139:in `<top (required
)>'
        from <internal:lib/rubygems/custom_require>:29:in `require'
        from <internal:lib/rubygems/custom_require>:29:in `require'
        from D:/Downloads/rubygems-1.3.7/setup.rb:24:in `<main>'

なんかエラーが出た・・・。

Google先生に助けを求めたところ、どうやら、これでgemsはインストールされているらしい。
念のため確認してみる。

>gem
RubyGems is a sophisticated package manager for Ruby.  This is a
basic help message containing pointers to more information.

おお、インストールされてるっぽい。

Railsをインストール
コマンドプロンプトにて下記の通り入力。
>gem install rails
しばし待つ。プロンプトに色々と出力されるが、気にせずに待つ。

Railsアプリケーション作成
コマンドプロンプトにて下記の通り入力。
>rails new hellorails
なんか色々出力される
>cd hellorails
>rails server

Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gem sources list
ed in your Gemfile.
Try running `bundle install`.
ふむ、sqliteが見つからないらしい。

今日はここまで。続きはまた明日にしよう。

2011/02/14 追記
コマンドプロンプトにて bundle install を実行したところ、解決した。
つーか、思いっきり「Try running `bundle install`.」って書いてあるじゃんねぇ・・・

0 件のコメント:

コメントを投稿