summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-03-01 11:20:47 +0000
committerThe Bundler Bot <bot@bundler.io>2018-03-01 11:20:47 +0000
commit23dfadcd8d561d48e89c7287cbbdd816e0a10ab8 (patch)
tree1c7e42b76c122465bda89e6a30663262331c43a1 /lib
parentba63d2eab7d321091cbe3482521c8da021e10c70 (diff)
parent5e73a89511f07a83eccf26afba52a20509534ad5 (diff)
downloadbundler-23dfadcd8d561d48e89c7287cbbdd816e0a10ab8.tar.gz
Auto merge of #6309 - agrim123:disable_platform_warnings, r=colby-swandale
Add config variable and check for platform warnings Thanks so much for the contribution! To make reviewing this PR a bit easier, please fill out answers to the following questions. ### What was the end-user problem that led to this PR? The user needed a way to turn off platform warnings. ### What was your diagnosis of the problem? Creating a config variable to solve the above problem. ### What is your fix for the problem, implemented in this PR? Added a key `disable_platform_warnings` in settings and placed check at the relevant place to disable warnings. ### Why did you choose this fix out of the possible options? We will by default show warnings but the user might want to disable them, so using a config variable looked a good option. Fixes #6124
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--lib/bundler/settings.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 0349af39f2..6b42fe0fb5 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -878,7 +878,7 @@ module Bundler
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
next if !remote && !dep.current_platform?
platforms = dep.gem_platforms(sorted_platforms)
- if platforms.empty?
+ if platforms.empty? && !Bundler.settings[:disable_platform_warnings]
mapped_platforms = dep.platforms.map {|p| Dependency::PLATFORM_MAP[p] }
Bundler.ui.warn \
"The dependency #{dep} will be unused by any of the platforms Bundler is installing for. " \
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 75e2d4dff2..83c119a562 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -26,6 +26,7 @@ module Bundler
disable_exec_load
disable_local_branch_check
disable_multisource
+ disable_platform_warnings
disable_shared_gems
disable_version_check
error_on_stderr