記事の引越しから漏れていたのでサルベージ。

RubyGems パッケージの作り方 - rubyforge 登録まで

僕はまだRubyForgeにGemを登録した事がないので、secondlifeさんの記事はとても参考になりました。蛇足感もありますが、多様性は善という事で、HoeというGemを使ったもう一つのRubyGemsパッケージの作り方を紹介します。

Hoeは、Seattle.rb Projects による一連のプロジェクトの中の一つで、やはりnewgemと同じようにRubyGemsの作成を簡単にしてくれるGemです。

Hoeを使ってGemを作る流れは、

  1. sowコマンドでGemの雛形を生成
  2. 雛形を元にGemを作成

という感じで、非常に簡単です。具体的に簡単なGemを作る方法を紹介します。

まずはHoeをインストールしましょう。

# gem install hoe --include-dependencies

そしてGemの雛形を生成します。

   1  $ sow sample
   2  creating project sample
   3  ... done, now go fix all occurances of 'FIX'
   4  
   5    sample/Rakefile:9:  # p.summary = 'FIX'
   6    sample/README.txt:2:    by FIX
   7    sample/README.txt:3:    FIX
   8    sample/README.txt:7:FIX
   9    sample/README.txt:11:* FIX
  10    sample/README.txt:15:    FIX
  11    sample/README.txt:19:+ FIX
  12    sample/README.txt:23:+ FIX
  13    sample/README.txt:29:Copyright (c) 2006 FIX

とりあえずこのFIXというところをカスタマイズすればOKという親切ぶりです。 そしてさらに、次のようなRakeタスクが生成されます。

   1  $ rake -T
   2  (in /home/takiuchi/sample)
   3  rake announce         # Generate email announcement file and post to rubyforge.
   4  rake audit            # Run ZenTest against the package
   5  rake check_manifest   # Verify the manifest
   6  rake clean            # Clean up all the extras
   7  rake clobber_docs     # Remove rdoc products
   8  rake clobber_package  # Remove package products
   9  rake debug_gem        # Show information about the gem.
  10  rake default          # Run the default tasks
  11  rake docs             # Build the docs HTML Files
  12  rake email            # Generate email announcement file.
  13  rake install          # Install the package. Uses PREFIX and RUBYLIB
  14  rake install_gem      # Install the package as a gem
  15  rake multi            # Run the test suite using multiruby
  16  rake package          # Build all the packages
  17  rake post_news        # Post announcement to rubyforge.
  18  rake publish_docs     # Publish RDoc to RubyForge
  19  rake redocs           # Force a rebuild of the RDOC files
  20  rake release          # Package and upload the release to rubyforge.
  21  rake repackage        # Force a rebuild of the package files
  22  rake ridocs           # Generate ri locally for testing
  23  rake test             # Run the test suite. Use FILTER to add to the command line.
  24  rake uninstall        # Uninstall the package.

なんとも魅力的な名前のタスク達ではないでしょうか。 rakeコマンドを打つだけでRubyForge上でのいろんな作業が出来てしまいそうです。

そのほか細かいところは同じなので、secondlifeさんの記事をご参照ください。

posted by Png genki on Wed 21 Nov 2007 at 12:14

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry211
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ