しばらく使う羽目になりそうだったので、学生の頃に生半可に教わったRailsに再挑戦しようと思う。
Ruby on Railsとは(勉強的な意味で)
Railsは、一言で言えばWebアプリケーションのフレームワーク、だと考えている。(Wikipediaにまんま書いてあったw)
MVC(Model-View-Controller)アーキテクチャの考えを軸として設計されている。それぞれ、意味は以下のとおり。
- データや手続きを表現する要素
- モデルのデータを取り出し、ユーザに最適な形で表現する要素
- ユーザの入力に対して応答(処理)する要素
…調べだしたら色々書きたくなったけど、まとめるのが大変そうだから、勉強系は次回に持ち越しw
今日はインストールとセットアップまで!
Railsのインストール
まずはインストールとセットアップなんだけど、Snow LeopardにはRailsがインストール済みな状態みたい。
$ rails -vRails 2.3.5
念のため、Railsのアップデート。
(root権限で実行するように。ここだけに限らないけど。)
と、早速エラーがw
$ sudo gem update railsPassword:Updating installed gemsUpdating railsSuccessfully installed rack-1.2.1Successfully installed rack-test-0.5.6Successfully installed rack-mount-0.6.13Successfully installed tzinfo-0.3.23Successfully installed abstract-1.0.0Successfully installed erubis-2.6.6Successfully installed actionpack-3.0.0Successfully installed arel-1.0.1Successfully installed activerecord-3.0.0Successfully installed activeresource-3.0.0Successfully installed mime-types-1.16Successfully installed polyglot-0.3.1Successfully installed treetop-1.4.8Successfully installed mail-2.2.7Successfully installed actionmailer-3.0.0Successfully installed rake-0.8.7Successfully installed thor-0.14.3Successfully installed railties-3.0.0Successfully installed bundler-1.0.2Successfully installed rails-3.0.0Gems updated: rack, rack-test, rack-mount, tzinfo, abstract, erubis, actionpack, arel, activerecord, activeresource, mime-types, polyglot, treetop, mail, actionmailer, rake, thor, railties, bundler, railsInstalling ri documentation for rack-1.2.1...Installing ri documentation for rack-test-0.5.6...Installing ri documentation for rack-mount-0.6.13...Installing ri documentation for tzinfo-0.3.23...Installing ri documentation for abstract-1.0.0...Installing ri documentation for erubis-2.6.6...Installing ri documentation for actionpack-3.0.0...Installing ri documentation for arel-1.0.1...Installing ri documentation for activerecord-3.0.0...Installing ri documentation for activeresource-3.0.0...Installing ri documentation for mime-types-1.16...Installing ri documentation for polyglot-0.3.1...Installing ri documentation for treetop-1.4.8...Installing ri documentation for mail-2.2.7...Installing ri documentation for actionmailer-3.0.0...Installing ri documentation for rake-0.8.7...Installing ri documentation for thor-0.14.3...Installing ri documentation for railties-3.0.0...Installing ri documentation for bundler-1.0.2...Installing ri documentation for rails-3.0.0...File not found: lib
(途中でSuccessfully installed rails-3.0.0って出てるから、エラーじゃないのかも…)
しかし、libが無いって何だろう…?
もしかしてRailsのインストールが怪しい?と思って、再インストールをしようとしたら、
$ sudo gem install railsPassword:Successfully installed rails-3.0.01 gem installedInstalling ri documentation for rails-3.0.0...File not found: lib
同じかよ!
ちょいと調べたら、Rubyのバージョン(今が1.8.7)が最新じゃないからかも…
アップデートしてみた。
$ sudo gem update rubyUpdating installed gemsUpdating libxml-rubyBuilding native extensions. This could take a while...Successfully installed libxml-ruby-1.1.4Updating ruby-openidSuccessfully installed ruby-openid-2.1.8Updating sqlite3-rubyBuilding native extensions. This could take a while...Successfully installed sqlite3-ruby-1.3.1Gems updated: libxml-ruby, ruby-openid, sqlite3-rubyInstalling ri documentation for libxml-ruby-1.1.4...Enclosing class/module 'mLibXML' for module XML not knownEnclosing class/module 'mXML' for class Attr not knownEnclosing class/module 'mXML' for class AttrDecl not knownEnclosing class/module 'mXML' for class Attributes not knownEnclosing class/module 'mXML' for class Document not knownEnclosing class/module 'mXML' for class Dtd not knownEnclosing class/module 'mXML' for module Encoding not knownEnclosing class/module 'mXML' for class Error not knownEnclosing class/module 'mXML' for class HTMLParser not knownEnclosing class/module 'cXMLHtmlParser' for class Context not knownEnclosing class/module 'cXMLHtmlParser' for module Options not knownEnclosing class/module 'mXML' for class InputCallbacks not knownEnclosing class/module 'mXML' for class Namespace not knownEnclosing class/module 'mXML' for class Namespaces not knownEnclosing class/module 'mXML' for class Node not knownEnclosing class/module 'mXML' for class Parser not knownEnclosing class/module 'cXMLParser' for class Context not knownEnclosing class/module 'cXMLParser' for module Options not knownEnclosing class/module 'mXML' for class Reader not knownEnclosing class/module 'mXML' for class RelaxNG not knownEnclosing class/module 'mXML' for class SaxParser not knownEnclosing class/module 'mXML' for class Schema not knownEnclosing class/module 'mXML' for class XInclude not knownEnclosing class/module 'mXML' for module XPath not knownEnclosing class/module 'mXPath' for class Context not knownEnclosing class/module 'mXPath' for class Expression not knownEnclosing class/module 'mXPath' for class Object not knownEnclosing class/module 'mXML' for class XPointer not knownInstalling ri documentation for ruby-openid-2.1.8...Installing ri documentation for sqlite3-ruby-1.3.1...Enclosing class/module 'mSqlite3' for class Statement not knownNo definition for libversionInstalling RDoc documentation for libxml-ruby-1.1.4...Enclosing class/module 'mLibXML' for module XML not knownEnclosing class/module 'mXML' for class Attr not knownEnclosing class/module 'mXML' for class AttrDecl not knownEnclosing class/module 'mXML' for class Attributes not knownEnclosing class/module 'mXML' for class Document not knownEnclosing class/module 'mXML' for class Dtd not knownEnclosing class/module 'mXML' for module Encoding not knownEnclosing class/module 'mXML' for class Error not knownEnclosing class/module 'mXML' for class HTMLParser not knownEnclosing class/module 'cXMLHtmlParser' for class Context not knownEnclosing class/module 'cXMLHtmlParser' for module Options not knownEnclosing class/module 'mXML' for class InputCallbacks not knownEnclosing class/module 'mXML' for class Namespace not knownEnclosing class/module 'mXML' for class Namespaces not knownEnclosing class/module 'mXML' for class Node not knownEnclosing class/module 'mXML' for class Parser not knownEnclosing class/module 'cXMLParser' for class Context not knownEnclosing class/module 'cXMLParser' for module Options not knownEnclosing class/module 'mXML' for class Reader not knownEnclosing class/module 'mXML' for class RelaxNG not knownEnclosing class/module 'mXML' for class SaxParser not knownEnclosing class/module 'mXML' for class Schema not knownEnclosing class/module 'mXML' for class XInclude not knownEnclosing class/module 'mXML' for module XPath not knownEnclosing class/module 'mXPath' for class Context not knownEnclosing class/module 'mXPath' for class Expression not knownEnclosing class/module 'mXPath' for class Object not knownEnclosing class/module 'mXML' for class XPointer not knownInstalling RDoc documentation for ruby-openid-2.1.8...Installing RDoc documentation for sqlite3-ruby-1.3.1...Enclosing class/module 'mSqlite3' for class Statement not knownNo definition for libversion
libversionが定義されてないとか、怪しいエラーっぽいけど、これでもう一回トライ。
…変わりませんでした…。明日、再調査します。
こーやってハマることが何だか懐かしいw
ちなみに、このgemsってのがよく分かってなかったので調査(メモ程度だけど)。
(RubyGemsはRubyの標準パッケージ管理システムで、Railsをはじめとした色々なパッケージの管理を行うことが可能。)
Railsのセットアップ
じゃあ、実際にセットアップへ。
…といきたかったけど、セットアップする前に何を作るか決めないと。
ブログやら色々他の人がやってるけど。
せっかくなので、最近マイブームのお小遣い帳のネタで。
お小遣い帳管理サイトをつくろうと思います。
次回から頑張ろう。
(ちゃんと続けられるように…)
0 件のコメント:
コメントを投稿