テストでは test-unit
と simplecov
を使用。
手順を記録していなかったので、思い出しながらまとめ直し。
ひな形作成
$ bundle gem newgem
Creating gem 'newgem'...
Do you want to generate tests with your gem?
Type 'rspec' or 'minitest' to generate those test files now and in the future. rspec/minitest/(none): minitest
Do you want to license your code permissively under the MIT license?
This means that any other developer or company will be legally allowed to use your code for free as long as they admit you created it. You can read more about the MIT license at https://choosealicense.com/licenses/mit. y/(n): n
Do you want to include a code of conduct in gems you generate?
Codes of conduct can increase contributions to your project by contributors who prefer collaborative, safe spaces. You can read more about the code of conduct at contributor-covenant.org. Having a code of conduct means agreeing to the responsibility of enforcing it, so be sure that you are prepared to do that. Be sure that your email address is specified as a contact in the generated code of conduct so that people know who to contact in case of a violation. For suggestions about how to enforce codes of conduct, see https://bit.ly/coc-enforcement. y/(n): n
create newgem/Gemfile
create newgem/lib/newgem.rb
create newgem/lib/newgem/version.rb
create newgem/newgem.gemspec
create newgem/Rakefile
create newgem/README.md
create newgem/bin/console
create newgem/bin/setup
create newgem/.gitignore
create newgem/.travis.yml
create newgem/test/test_helper.rb
create newgem/test/newgem_test.rb
Initializing git repo in /work/newgem
Gem 'newgem' was successfully created. For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html
基本情報更新
newgem/newgem.gemspec
を更新spec.author
spec.email
spec.summary
spec.description
spec.homepage
spec.metadata["source_code_uri"]
spec.metadata["changelog_uri"]
spec.metadata["allowed_push_host" = "TODO: Set to 'http://mygemserver.com'"
を削除rubygems.org
に push できるようにするため
test-unit and simplecov を使うための設定
newgem/Gemfile
からminitest
の行を削除newgem/newgem.gemspec
に依存関係定義を追加spec.add_development_dependency 'test-unit'
spec.add_development_dependency 'simplecov'
newgem/test/test_helper.rb
の更新よくわからないけどこんな感じになった
newgem/test/newgem_test.rb
の更新更新というか、テストに合わせて新規作成する感じ。ひな形は以下のような感じ。
開発手順
依存パッケージ取得
テスト
ビルド
リリース
多分こんな感じ…。 以上。
0 件のコメント:
コメントを投稿