Gemを作ってみた (2) Rakefile
gemspecファイルを作りたい
jewelerではrake
タスクでgemspecを自動生成してくれるらしい。
そこで一旦タスクリストを確認してみる
$ rake -T # (略) rake gemspec # Generate and validate gemspec rake gemspec:debug # Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem) rake gemspec:generate # Regenerate the gemspec on the filesystem rake gemspec:release # Regenerate and validate gemspec, and then commits and pushes to git rake gemspec:validate # Validates the gemspec on the filesystem rake git:release # Tag and push release to git rake install # Build and install gem using `gem install` rake rdoc # Build RDoc HTML files rake release # Release gem rake rerdoc # Rebuild RDoc HTML files rake simplecov # Code coverage detail rake spec # Run RSpec code examples rake version # Displays the current version rake version:bump:major # Bump the major version by 1 rake version:bump:minor # Bump the a minor version by 1 rake version:bump:patch # Bump the patch version by 1 rake version:write # Writes out an explicit version
gemspec生成だけでなく、versionの管理等もやってくれるようだ(゚∀゚) とりあえずgemspecだけでも作ってみよう
$ rake gemspec Expected VERSION or VERSION.yml to exist. Use 'rake version:write' to create an initial one.
、、、どうやらVERSION
が必要らしい(・_・;)
そのためのタスクもあったので実行
$ rake version:write Updated version: 0.0.0 $ cat VERSION 0.0.0
とりあえずバージョン0ができた(^_^;) これで待望のgemspecができる!
$ rake gemspec Generated: simplecov-lcov.gemspec simplecov-lcov.gemspec is valid.
gemspecの中身を確認
とりあえず、できたものの中身を見てみることすする
$ cat simplecov-lcov.gemspec # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "simplecov-lcov" s.version = "0.0.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["XXX XXX"] s.date = "2014-XX-XX" s.description = "TODO: longer description of your gem" s.email = "XXX.XXX@xxx.co.jp" # 中略 end
最初のコメントに書いてあるとおり、 gemspecは直接いじってはいけないらしい。
それよりも気になるのがauthors
とemail
!
最初に指定したGitHubのUserのものではない( ゚д゚)
改めてRakefile
も確認してみる
$ cat Rakefile # 中略 require 'jeweler' Jeweler::Tasks.new do |gem| # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options gem.name = "simplecov-lcov" gem.homepage = "http://github.com/fortissimo1997/simplecov-lcov" gem.license = "MIT" gem.summary = %Q{TODO: one-line summary of your gem} gem.description = %Q{TODO: longer description of your gem} gem.email = "XXX.XXX@xxx.co.jp" gem.authors = ["XXX XXX"] # dependencies defined in Gemfile end
homepage
は指定したものだが、email
、author
は~/.gitconfig
のものを取ってきているようだ、、、
~/.gitconfig
は社用のアカウントが設定してあったため、私用のものに書きなおさなければ、、、
書きなおしてgit commit --amend
でコミットしなおして一見落着。
と思ったが、一応git log
を確認
$ git log commit xxx Author: fortissimo1997 <mail-for-github@xxx.com> Date: someday Version bump to 0.0.0 commit yyy Author: XXX XXX <XXX.XXX@xxx.co.jp> Date: someday Initial commit to simplecov-lcov.
最初のコミットもコミッタが違いますね、、、
~/.gitconfig
を書き換えてから作りなおしたほうが早いかも(;_;)
結局、LICENSE.txt
とREADME.rdoc
にもあることが判明したため、
そちらも書き換えることに、、、
思わぬところに時間を取られたが、これで公開する準備が整った(・∀・)
次回はTravisCIの導入