summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Kataria <ankitkataria28@gmail.com>2019-01-24 22:09:59 +0530
committerAnkit Kataria <ankitkataria28@gmail.com>2019-01-24 22:09:59 +0530
commit4992124240503249e1a28e17c9f9129a11e7f82a (patch)
tree6453ea8366cf4b82027ecfeb9a4e3e00a26fa5cb
parent4557124b5ea30821895eb2686874cb4219f404e2 (diff)
downloadbundler-4992124240503249e1a28e17c9f9129a11e7f82a.tar.gz
add patch option in bundle config
-rw-r--r--lib/bundler/cli/common.rb2
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--spec/commands/update_spec.rb9
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 09a1753337..085fbe6a57 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -80,7 +80,9 @@ module Bundler
def self.configure_gem_version_promoter(definition, options)
patch_level = patch_level_options(options)
+ patch_level.append(:patch) if patch_level.empty? && Bundler.settings[:patch]
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 = options[:strict] || options["update-strict"] || options["filter-strict"]
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index fe68d510ff..f9e7599127 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -9,6 +9,7 @@ module Bundler
autoload :Validator, "bundler/settings/validator"
BOOL_KEYS = %w[
+ patch
allow_bundler_dependency_conflicts
allow_deployment_source_credential_changes
allow_offline_install
@@ -79,6 +80,7 @@ module Bundler
:redirect => 5,
:retry => 3,
:timeout => 10,
+ :patch => false,
}.freeze
def initialize(root = nil)
diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb
index 6f29032dd2..d0552a9507 100644
--- a/spec/commands/update_spec.rb
+++ b/spec/commands/update_spec.rb
@@ -809,6 +809,15 @@ RSpec.describe "bundle update conservative" do
G
end
+ context "with patch set as default update level in config" do
+ it "should do a patch level update" do
+ bundle! "config --local patch true"
+ bundle! "update --patch foo"
+
+ expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.0"
+ end
+ end
+
context "patch preferred" do
it "single gem updates dependent gem to minor" do
bundle! "update --patch foo"