diff options
author | chrismo <chrismo@clabs.org> | 2016-10-06 09:39:07 -0500 |
---|---|---|
committer | chrismo <chrismo@clabs.org> | 2016-10-12 17:49:00 -0500 |
commit | b8c23f39399d8a6296ea268e7fcd57d3ac712467 (patch) | |
tree | 35ca18e4d7f9ad936bff9c60d66d041d79620f6f /lib/bundler/cli/common.rb | |
parent | c0f7f128a55ef3165da52b44f1b82fca80de3238 (diff) | |
download | bundler-b8c23f39399d8a6296ea268e7fcd57d3ac712467.tar.gz |
Enable cons updates in outdated and other fixes.
Fixes #4772 - Changes previous `--patch` / `--minor` / `--major` options
to `--filter-patch` / `--filter-minor` / `--filter-major` and adds back
`--patch` / `--minor` / `--major` as conservative the patch level update
options to match the behavior of these options in `bundle update` in
1.13.
This is a breaking change for the previous filtering options added in
1.12, but we're allowing it because there was some confusion as to what
those options did in 1.12, some thinking that it would perform the
resolution constraints that these options _now_ actually do.
A problem with merging in conservative bundle update options was the
pre-existing `--strict` `outdated` option, which has been in `outdated`
since 1.5. `--strict` for `outdated` means to only report on newer gem
versions that still satisfy declared requirements in the Gemfile.
Without `--strict`, `outdated` reports the most recent available
regardless of declared requirements in the Gemfile.
`--strict` in `update` in 1.13 means to not allow _any_ dependency to
update past the patch level option.
Rather than break the longer standing `--strict` option, the new
`--update-strict` option has been added which maps to the conservative
bundle update `--strict` option. We can revisit this in 2.0.
This also fixes #5065, where the new filtering options were ignored if
the `--strict` option was used.
Diffstat (limited to 'lib/bundler/cli/common.rb')
-rw-r--r-- | lib/bundler/cli/common.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 6f45322d..40a429ba 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -53,13 +53,17 @@ module Bundler message end - def self.config_gem_version_promoter(definition, opts) - patch_level = [:major, :minor, :patch].select {|v| opts.keys.include?(v.to_s) } + def self.configure_gem_version_promoter(definition, options) + patch_level = patch_level_options(options) raise InvalidOption, "Provide only one of the following options: #{patch_level.join(", ")}" unless patch_level.length <= 1 definition.gem_version_promoter.tap do |gvp| gvp.level = patch_level.first || :major - gvp.strict = opts[:strict] + gvp.strict = options[:strict] || options["update-strict"] end end + + def self.patch_level_options(options) + [:major, :minor, :patch].select {|v| options.keys.include?(v.to_s) } + end end end |