読者です 読者をやめる 読者になる 読者になる

It's raining cats and dogs.

無駄なことなんてないはず

プラグインの作り方が良くわからないので勉強する

script/plugin のヘルプ

とりあえず、script/plugin のヘルプを書いとく。
(まぁコマンドで見ればいいんだけど。。。)

Usage: plugin [OPTIONS] command
Rails plugin manager.

GENERAL OPTIONS
  -r, --root=DIR                   Set an explicit rails app directory.
                                   Default: D:/dev/eclipse/runtime/workspace/test
  -s, --source=URL1,URL2           Use the specified plugin repositories instead of the defaults.
  -v, --verbose                    Turn on verbose output.
  -h, --help                       Show this help message.

COMMANDS
  discover   Discover plugin repositories.
  list       List available plugins.
  install    Install plugin(s) from known repositories or URLs.
  update     Update installed plugins.
  remove     Uninstall plugins.
  source     Add a plugin source repository.
  unsource   Remove a plugin repository.
  sources    List currently configured plugin repositories.

EXAMPLES
  Install a plugin:
    plugin install continuous_builder

  Install a plugin from a subversion URL:
    plugin install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder

  Install a plugin and add a svn:externals entry to vendor/plugins
    plugin install -x continuous_builder

  List all available plugins:
    plugin list

  List plugins in the specified repository:
    plugin list --source=http://dev.rubyonrails.com/svn/rails/plugins/

  Discover and prompt to add new repositories:
    plugin discover

  Discover new repositories but just list them, don't add anything:
    plugin discover -l

  Add a new repository to the source list:
    plugin source http://dev.rubyonrails.com/svn/rails/plugins/

  Remove a repository from the source list:
    plugin unsource http://dev.rubyonrails.com/svn/rails/plugins/

  Show currently configured repositories:
    plugin sources

ついでにplugin.rbのヘッダコメント

script/pluginで実行されるplugin.rbのヘッダコメントも書いておこう。
RAILS_INSTALL_DIR/lib/commands/plugin.rb

# Rails Plugin Manager.
# 
# Listing available plugins:
#
#   $ ./script/plugin list
#   continuous_builder            http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder
#   asset_timestamping            http://svn.aviditybytes.com/rails/plugins/asset_timestamping
#   enumerations_mixin            http://svn.protocool.com/rails/plugins/enumerations_mixin/trunk
#   calculations                  http://techno-weenie.net/svn/projects/calculations/
#   ...
#
# Installing plugins:
#
#   $ ./script/plugin install continuous_builder asset_timestamping
#
# Finding Repositories:
#
#   $ ./script/plugin discover
# 
# Adding Repositories:
#
#   $ ./script/plugin source http://svn.protocool.com/rails/plugins/
#
# How it works:
# 
#   * Maintains a list of subversion repositories that are assumed to have
#     a plugin directory structure. Manage them with the (source, unsource,
#     and sources commands)
#     
#   * The discover command scrapes the following page for things that
#     look like subversion repositories with plugins:
#     http://wiki.rubyonrails.org/rails/pages/Plugins
# 
#   * Unless you specify that you want to use svn, script/plugin uses plain old
#     HTTP for downloads.  The following bullets are true if you specify
#     that you want to use svn.
#
#   * If `vendor/plugins` is under subversion control, the script will
#     modify the svn:externals property and perform an update. You can
#     use normal subversion commands to keep the plugins up to date.
# 
#   * Or, if `vendor/plugins` is not under subversion control, the
#     plugin is pulled via `svn checkout` or `svn export` but looks
#     exactly the same.
# 
# This is Free Software, copyright 2005 by Ryan Tomayko (rtomayko@gmail.com) 
# and is licensed MIT: (http://www.opensource.org/licenses/mit-license.php)