summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-10-20 14:36:52 -0500
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-07-05 07:27:36 +0200
commit899aeeebb036a63a9b254f6bdd49819d6ae6717d (patch)
tree71881b9c24538927999c6bf24cd3305a85ef406c
parent723611f6ee1bea541c2a2dae53513fd474a84e4e (diff)
downloadbundler-899aeeebb036a63a9b254f6bdd49819d6ae6717d.tar.gz
[Package] Ensure uninstallable gems are _never_ installed
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--spec/commands/package_spec.rb14
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/commands/package_spec.rb b/spec/commands/package_spec.rb
index c22569171a..e051743fd0 100644
--- a/spec/commands/package_spec.rb
+++ b/spec/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