Enforce a strict versioning policy in your Gemfile
StrongVersions enforces a strict policy on your Gemfile
requirements:
~>
operator must be used for all gem requirement definitions.major.minor
, e.g. '~> 2.5
'major.minor.patch
, e.g. '~> 0.8.9'
'~> 8.4', '< 8.6.7'
path
or git
source are ignored, e.g. path: '/path/to/gem'
, git: 'https://github.com/bobf/strong_versions'
Any gems that do not satisfy these rules will be included in the StrongVersions output with details on why they did not meet the standard.
When all gems in a Gemfile
follow this convention it SHOULD always be safe to run bundle update
(assuming all gems adhere to Semantic Versioning).
Add the gem to your Gemfile
gem 'strong_versions', '~> 0.4.5'
And rebuild your bundle:
$ bundle install
StrongVersions is invoked with a provided executable:
$ bundle exec strong_versions
The executable will output all non-passing gems and will return an exit code of 1
on failure, 0
on success (i.e. all gems passing). This makes StrongVersions suitable for use in a continuous integration pipeline:
Auto-correct is available with the -a/--auto-correct
option:
$ bundle exec strong_versions -a
You can tell StrongVersions to ignore any of your gems (e.g. those that don't follow semantic versioning) by adding them to the ignore
section of .strong_versions.yml
in your project root, e.g.:
# .strong_versions.yml
ignore:
- rails
Gems in the ignore list will not be updated when using the -a/--auto-correct
option.
Fork and create a pull request.
Run tests with RSpec:
$ bin/rspec
Check code with Rubocop:
$ bin/rubocop