Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Add documentation and tests for disable_platform_warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
agrim123 committed Feb 25, 2018
1 parent 6d563b0 commit 94d399d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
2 changes: 2 additions & 0 deletions man/bundle-config.ronn
Expand Up @@ -166,6 +166,8 @@ learn more about their operation in [bundle install(1)][bundle-install(1)].
When set, Gemfiles containing multiple sources will produce errors
instead of warnings.
Use `bundle config --delete disable_multisource` to unset.
* `disable_platform_warnings` (`BUNDLE_DISABLE_PLATFORM_WARNINGS`):
Whether Bundler should show platform warnings.
* `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`):
Stop Bundler from accessing gems installed to RubyGems' normal location.
* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
Expand Down
47 changes: 36 additions & 11 deletions spec/install/gemfile/platform_spec.rb
Expand Up @@ -230,21 +230,46 @@
expect(out).not_to match(/Could not find gem 'some_gem/)
end

it "prints a helpful warning when a dependency is unused on any platform" do
simulate_platform "ruby"
simulate_ruby_engine "ruby"
context "when disable_platform_warnings is false (by default)" do
before { bundle! "config disable_platform_warnings false" }

gemfile <<-G
source "file://#{gem_repo1}"
it "prints a helpful warning when a dependency is unused on any platform" do
simulate_platform "ruby"
simulate_ruby_engine "ruby"

gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby]
G
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby]
G

bundle! "install"
bundle! "install"

expect(out).to include <<-O.strip
The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
O
expect(out).to include <<-O.strip
The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
O
end
end

context "when disable_platform_warnings is true" do
before { bundle! "config disable_platform_warnings true" }

it "doesnot print the warning when a dependency is unused on any platform" do
simulate_platform "ruby"
simulate_ruby_engine "ruby"

gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby]
G

bundle! "install"

expect(out).not_to include <<-O.strip
The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
O
end
end
end

Expand Down

0 comments on commit 94d399d

Please sign in to comment.