- Add this gem to your
:development
and:test
groups in your projectsGemfile
, e.g.
group :development, :test do
gem 'rubocop', require: false
gem 'rubocop-config-oharagroup', require: false
end
- Install the bundle (
bundle install
) - Create a
.rubocop.yml
file in the root of your project as follows:
inherit_gem:
rubocop-config-oharagroup:
- default.yml
- rails.yml # optional, only include for rails projects
# ------------------------------------------------------------
# Cops that rubocop disables by default, but we want to enable
# ------------------------------------------------------------
# ------------------------------------------------------------
# END disabled by default cops
# ------------------------------------------------------------
# Cops that rubocop enables by default, but we want to disable
# ------------------------------------------------------------
# ------------------------------------------------------------
# END enabled by default cops
# ------------------------------------------------------------
# Cops that we want to reconfigure
# ------------------------------------------------------------
# ------------------------------------------------------------
# END reconfigured cops
# ------------------------------------------------------------
- Update the
spec.version
inrubocop-config-oharagroup.gemspec
- Test the new gem version in a sibling Ruby project by appending
, path: '../rubocop-config-oharagroup'
to the entry in the projects'Gemfile
cd <sibling Ruby project>
bundle exec rubocop
- For any new offenses, decide whether to correct the code, reconfigure the cop, or disable the cop
- Rebuild the gem (
gem build rubocop-config-oharagroup.gemspec
) - Tag the repo (
git tag -am "Version ${spec.version}" v${spec.version}
) - Push the changes & tag to origin (
git push && git push --tags
) - Publish the new version (
gem push rubocop-config-oharagroup-${spec.version}.gem
)
Publishing requires a ~/.gem/credentials
file. To setup a new computer:
curl -u ${rubygems.org username} https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
chmod 0600 ~/.gem/credentials