fortissimo1997's diary

備忘録的な使い方をする予定

Gemを作ってみた (1) jeweler

改めて、、、

jeweler2は動かなかったので、改めてjewelerをインストール

$ gem install jeweler
$ jeweler
Usage: jeweler [options] reponame
e.g. jeweler the-perfect-gem
        --directory [DIRECTORY]      specify the directory to generate into (deprecated)

        --rspec                      generate rspec code examples
        --shoulda                    generate shoulda tests
        --testunit                   generate test/unit tests
        --bacon                      generate bacon specifications
        --testspec                   generate test/spec tests
        --minitest                   generate minitest tests
        --micronaut                  generate micronaut examples
        --riot                       generate riot tests
        --shindo                     generate shindo tests

        --[no-]bundler               use bundler for managing dependencies
        --cucumber                   generate cucumber stories in addition to the other tests

        --reek                       generate rake task for reek
        --roodi                      generate rake task for roodi

        --summary [SUMMARY]          specify the summary of the project
        --description [DESCRIPTION]  specify a description of the project

        --user-name [USER_NAME]      the user's name, ie that is credited in the LICENSE
        --user-email [USER_EMAIL]    the user's email, ie that is credited in the Gem specification

        --github-username [GITHUB_USERNAME]
                                     name of the user on GitHub to set the project up under
        --git-remote [GIT_REMOTE]    URI to set the git origin remote to
        --homepage [HOMEPAGE]        the homepage for your project (defaults to the GitHub repo)
        --create-repo                create the repository on GitHub

        --yard                       use yard for documentation
        --rdoc                       use rdoc for documentation
    -v, --version                    show version
    -h, --help                       display this help and exit

オプションはテストにRSpecを入れるだけのはずなので、jeweler --rspec simplecov-lcovでいけそう

$ jeweler --rspec simplecov-lcov
Please specify --github-username or set github.user in ~/.gitconfig (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt

どうやら--github-usernameは追加する必要がありそう、、、

$ jeweler --rspec --github-username fortissimo1997 simplecov-lcov
The directory simplecov-lcov already exists. Maybe move it out of the way before continuing?

先ほどGitHubリポジトリを作った時にgit cloneしていたのが仇に、、、 ディレクトリを消して再実行

$ rm -rf simplecov-lcov
$ jeweler --rspec --github-username fortissimo1997 simplecov-lcov
        create  .gitignore
        create  Rakefile
        create  Gemfile
        create  LICENSE.txt
        create  README.rdoc
        create  .document
        create  lib
        create  lib/simplecov-lcov.rb
        create  spec
        create  spec/spec_helper.rb
        create  spec/simplecov-ldov_spec.rb
        create  .rspec
Jeweler has prepared your gem in ./simplecov-lcov

ようやくリポジトリ作成成功! これで実装が始められる(・∀・)

この時は自動生成されたファイルをあまり確認せずに実装に入ってしまいました が、このことを後悔することになるとは思ってもいませんでした、、、

次回へ続く