「用語解説」の編集履歴(バックアップ)一覧に戻る
用語解説 - (2009/10/25 (日) 12:02:17) の編集履歴(バックアップ)
用語解説
RubyGems
Rubyのパッケージ管理システム。
>gem search
*** LOCAL GEMS ***
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
fxri (0.3.6)
fxruby (1.6.16)
hpricot (0.6.164)
log4r (1.0.5)
ptools (1.1.6)
rack (1.0.1)
rails (2.3.4)
rake (0.8.7, 0.8.1)
ruby-opengl (0.60.0)
sqlite3-ruby (1.2.5)
test-unit (2.0.1)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)
>gem -h
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
Further information:
http://rubygems.rubyforge.org
gem コマンド一覧
>gem help commands
GEM commands are:
build Build a gem from a gemspec
cert Manage RubyGems certificates and signing settings
check Check installed gems
cleanup Clean up old versions of installed gems in the local
repository
contents Display the contents of the installed gems
dependency Show the dependencies of an installed gem
environment Display information about the RubyGems environment
fetch Download a gem and place it in the current directory
generate_index Generates the index files for a gem server directory
help Provide help on the 'gem' command
install Install a gem into the local repository
list Display gems whose name starts with STRING
lock Generate a lockdown list of gems
mirror Mirror a gem repository
outdated Display all gems that need updates
pristine Restores installed gems to pristine condition from files
located in the gem cache
query Query gem information in local or remote repositories
rdoc Generates RDoc for pre-installed gems
search Display all gems whose name contains STRING
server Documentation and gem repository HTTP server
sources Manage the sources and cache file RubyGems uses to search
for gems
specification Display gem specification (in yaml)
stale List gems along with access times
uninstall Uninstall gems from the local repository
unpack Unpack an installed gem to the current directory
update Update the named gems (or all installed gems) in the local
repository
which Find the location of a library file you can require
For help on a particular command, use 'gem help COMMAND'.
Commands may be abbreviated, so long as they are unambiguous.
e.g. 'gem i rake' is short for 'gem install rake'.
scaffold
「scaffold」(スキャフォゥド:「足場」という意味)
scaffoldを使うと、一連の操作を行うための画面やその裏側の処理を行うプログラムを自動生成できます。
- 一覧表示(ページング機能付き)
- 単票形式のデータ表示
- 新規登録
- 編集
- 削除
以下のコマンドでscaffoldの利用方法が確認できます
>ruby script/generate scaffold -h
rake
Rubyのビルドツール(AntやMake等)
>rake -T
オプション一覧が見られます(注意:-T 小文字じゃだめ)
マイグレーション
DBのバージョン管理システム。
具体的には次のような仕組みです。
- db/migrateディレクトリ配下にdb/migrate/20080728204433_create_categories.rbのように、DBに対する変更内容が記述されたファイルを配置
- このとき、各ファイル名の先頭には「20080728204433」の部分のように、タイムスタンプに基づくバージョン情報が付く
- マイグレーションは現在のDBのバージョン情報を保持する。これにより、db/migration内のファイルのうち、どれがDBに反映されて、どれが反映されていないかが分かる
- 「db:migrate」というrakeタスク(「make install」のようなバッチ処理をイメージすると分かりやすい)を実行して、未反映の変更をDBに反映させることができる(=最新状態までバージョンアップ)
- バージョン情報を指定してrakeタスクを実行し、バージョンを任意のバージョンにバージョンアップ、バージョンダウンさせることもできる