$ gem install versionate
Run the following command in a directory that has a Gemfile, and it will automatically lock it to the latest version of that gem.
$ versionate
If, for some odd reason, your Gemfile is called something other than “Gemfile”,
you can specify the name as an argument to the sub-command process
, like this:
$ versionate process file_with_gems.rb
You can tweak the output of versionate by passing in some options to the
command. First off, it's simple to strip off the patch versions in the resulting
versions by passing in the --no-patch
flag:
$ versionate --no-patch
Prepending a version specifier to the version is simple as well, just pass it in
to the --specifier
option:
$ versionate --specifier="~>"
Of course, this also works when using the more verbose syntax:
$ versionate process --no-patch --specifier="~>" Gemfile
If you find yourself forgetting commands and/or options the help
sub-command
is always available for you:
$ versionate help
Commands:
versionate help [COMMAND] # Describe available commands or one specific command
versionate process [FILENAME] # Processes a given file (default: Gemfile)
You can also ask for help on specific sub-command:
$ versionate help process
Usage:
versionate process [FILENAME]
Options:
[--patch], [--no-patch] # Whether or not to keep patch version (default: true)
[--specifier=SPECIFIER] # Specifier to be prepended to version
Processes a given file (default: Gemfile)