RubyGemsパッケージを作る

instal

% gem update -y newgem
Successfully installed newgem-0.11.0
Successfully installed hoe-1.2.1
Successfully installed rubyforge-0.4.2
Successfully installed RedCloth-3.0.4
Successfully installed syntax-1.0.0
Successfully installed hoe-1.2.1
% gem update -y rspec
Successfully installed rspec-1.0.5
% gem update -y win32console

RubyGemsパッケージ一覧取得方法

% gem list --remote > list

rubyforgeへ登録

Project full name
Cute p
Project Purpose And Summarization
"Cute p" provide more human readable "p" function.
License
Ruby license
Project Public Description
"Cute p" provide more human readable "p" function.
Project Unix Name
cutep
SCM
svn
  • submit
  • とりあえずメールが送られてくるのを待つ.一晩で登録されました.

現状のメールアドレス確認

get repositry

% cd ~/dev
% svn checkout svn+ssh://youraccount@rubyforge.org/var/svn/cutep
% ls -l cutep
  • cutepの中身が,.svn以外は空であることを確認する

newgem

% cd c:/temp
% newgem.cmd -s -t rspec cutep
creating: cutep
creating: cutep/trunk
creating: cutep/branches
creating: cutep/tags
creating: cutep/trunk/README.txt
creating: cutep/trunk/lib
creating: cutep/trunk/scripts
creating: cutep/trunk/website
creating: cutep/trunk/website/javascripts
creating: cutep/trunk/website/stylesheets
creating: cutep/trunk/lib/cutep
creating: cutep/trunk/lib/cutep.rb
creating: cutep/trunk/lib/cutep/version.rb
creating: cutep/trunk/bin
creating: cutep/trunk/spec
creating: cutep/trunk/spec/spec_helper.rb
creating: cutep/trunk/spec/cutep_spec.rb
creating: cutep/trunk/spec/spec.opts
creating: cutep/trunk/examples
creating: cutep/trunk/setup.rb
creating: cutep/trunk/Rakefile
creating: cutep/trunk/History.txt
creating: cutep/trunk/License.txt
creating: cutep/trunk/Manifest.txt
creating: cutep/trunk/scripts/txt2html
creating: cutep/trunk/website/index.txt
creating: cutep/trunk/website/index.html
creating: cutep/trunk/website/template.rhtml
copying: cutep/trunk/website/javascripts/rounded_corners_lite.inc.js
copying: cutep/trunk/website/stylesheets/screen.css
NOW - update cutep/Rakefile with gem description, etc
% cd cutep
% mv * ../../dev/cutep
% cd ../../dev/cutep/

commit to subversion

  • まず最初にcommitしておく
% svn add branches tags trunk
% scom
  • 最初にcommitしておけば,後で最初の状態を確認することができるので便利かなと.
  • 初期状態にtag打っといた方がいいのかなぁ….まぁいいか.

Chage Rakefile

AUTHOR = 'Kouichirou Eto'
EMAIL = "2007 atmark example.com"
DESCRIPTION = '"Cute p" provide more human readable "p" function.'
GEM_NAME = 'cutep'
  • こんな感じかなぁ.email書かせるのがいやだなぁ.

create Manifest.txt

% ruby scripts/makemanifest.rb

create a packate

% cd c:/dev/cutep/trunk
% rake package
 Successfully built RubyGem
 Name: qp
 Version: 0.0.1
 File: qp-0.0.1.gem
mv qp-0.0.1.gem pkg/qp-0.0.1.gem

upload gem package

Release Name
cutep
File Name
C:\dev\cutep\trunk\pkg\cutep-0.0.1.gem
File Type
.gem
Processor Type
Any
Release Notes
"Cute P" version 0.0.1 is released.
Change Log
Initial release.
  • 「Release File」をおす

確認

install gem

% sudo gem install cutep
  • お,使えるようになっている! すばらしい!

Create tag for version 0.0.1

  • installした状態にtagを打っておく.
% cd c:/dev/cutep
% svn copy trunk tags/REL-0.0.1

libを追加

rubyforge自動化の準備

% rubyforge.cmd setup
edit 'C:\cygwin\home\eto/.rubyforge/user-config.yml'
% cd ~/.rubyforge
% cat > user-config.yml
  uri        : http://rubyforge.org
  username   : eto
  password   : yourpassword
  cookie_jar : C:\cygwin\home\eto/.rubyforge/cookie.dat
  is_private : false
% rubyforge.cmd | more

自動的なuploadの準備

% rake		# rake specと同じ
% rake clean
% rake clobber
% ruby scripts/makemanifest.rb
Manifest.txt updated
% rake check_manifest
% rake package
 File: cutep-0.0.2.gem
% rubyforge.cmd config
% less ~/.rubyforge/auto-config.yml
  • これでgroup idなどの情報をもってくる

失敗

  • 最初rubyforge configをしないままrake releaseしようとしてしまった.
  • ~/.rubyforge/auto-config.yml がある状態にしてからでないとuploadできない.
  • ref: rubyforge rake "no group_id configured for"
  • http://rubyforge.org/forum/forum.php?thread_id=10218&forum_id=2 RubyForge: RubyForge Support: rubyforge-help

rake release

% rake release VERSION=0.0.2
Releasing cutep v. 0.0.2
% rake release VERSION=0.0.2
You have already released this version.
  • 同じversionで2回releaseはできない.

rake website

task :website_generate do
  sh %{ chmod -R go+rx website }
end
% rake website

失敗

Forbidden You don't have permission to access / on this server.

  • Cygwinだとpermissionが問題があるのでchmodする必要がある.

rake publish_docs

task :docs do
  sh %{ chmod -R go+rx doc }
end
% rake publish_docs

rake check_version

% rake check_version VERSION=0.0.2
% rake check_version VERSION=0.0.3
Please update your version.rb to match the release version, currently 0.0.2
% rake check_version VERSION=0.0.1
Please update your version.rb to match the release version, currently 0.0.2
  • 数字の上下関係は見ていない.
  • version.rbの更新は,手作業でやる必要がある.

rake local_deploy

  • website_generateとinstall_gemをやる
% rake install_gem
  • Cygwinではsudoが無いため,書き換える必要がある.Rakeを参照.

rake deploy

  • check_version, website, releaseの組である.
% rake deploy VERSION=0.0.3
Releasing cutep v. 0.0.3
  • tagをうっておく.
% svn copy svn+ssh://youraccount@rubyforge.org/var/svn/cutep/trunk svn+ssh://youraccount@rubyforge.org/var/svn/cutep/tags/REL-0.0.3
  • 下記でも同じことになる
% cd ..
% svn copy trunk tags/REL-0.0.3
  • viが立ち上がるので下記を入力.
Tagging release == 0.0.3 2007-06-16

* 0 major enhancement:
  * Just update documents.

できた!

  • 最初から,rake deployによる公開まで,一通りできたことになる.
Last modified: 2007-08-21