From 82bf064375361f3d662389a634ef0541a0a1fc3b Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 20 Oct 2017 14:36:52 -0500 Subject: [PATCH] [bundler/bundler] [Package] Ensure uninstallable gems are _never_ installed https://github.com/bundler/bundler/commit/899aeeebb0 --- lib/bundler/definition.rb | 2 +- spec/bundler/commands/package_spec.rb | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 339c38ab72..98fa2c1ef7 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -167,7 +167,7 @@ module Bundler def specs @specs ||= begin begin - specs = resolve.materialize(Bundler.settings[:cache_all_platforms] ? dependencies : requested_dependencies) + specs = resolve.materialize(requested_dependencies) rescue GemNotFound => e # Handle yanked gem gem_name, gem_version = extract_gem_info(e) locked_gem = @locked_specs[gem_name].last diff --git a/spec/bundler/commands/package_spec.rb b/spec/bundler/commands/package_spec.rb index c22569171a..e051743fd0 100644 --- a/spec/bundler/commands/package_spec.rb +++ b/spec/bundler/commands/package_spec.rb @@ -205,22 +205,32 @@ RSpec.describe "bundle package" do end it "does not attempt to install gems in without groups" do + build_repo4 do + build_gem "uninstallable", "2.0" do |s| + s.add_development_dependency "rake" + s.extensions << "Rakefile" + s.write "Rakefile", "task(:default) { raise 'CANNOT INSTALL' }" + end + end + install_gemfile! <<-G, forgotten_command_line_options(:without => "wo") source "file:#{gem_repo1}" gem "rack" group :wo do gem "weakling" + gem "uninstallable", :source => "file:#{gem_repo4}" end G bundle! :package, "all-platforms" => true expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist + expect(bundled_app("vendor/cache/uninstallable-2.0.gem")).to exist expect(the_bundle).to include_gem "rack 1.0" - expect(the_bundle).not_to include_gem "weakling" + expect(the_bundle).not_to include_gems "weakling", "uninstallable" bundle! :install, forgotten_command_line_options(:without => "wo") expect(the_bundle).to include_gem "rack 1.0" - expect(the_bundle).not_to include_gem "weakling" + expect(the_bundle).not_to include_gems "weakling", "uninstallable" end end