From 1fd9d080a73fde2afed709b6a9a9fa4af57aeee7 Mon Sep 17 00:00:00 2001 From: Patrick Metcalfe Date: Wed, 1 Jul 2015 13:28:14 -0500 Subject: [PATCH 01/15] switch reject to select MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reject is clearly not the right method to use here, now I’m trying to figure out what state of mind I was in when I wrote something that is so obviously wrong. --- lib/bundler/installer/parallel_installer.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index 9c08c83b4cc..373700638f7 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -35,10 +35,9 @@ def ignorable_dependency?(dep) # Checks installed dependencies against spec's dependencies to make # sure needed dependencies have been installed. - def dependencies_installed?(remaining_specs) - installed_specs = remaining_specs.reject(&:installed?).map(&:name) - already_installed = lambda {|dep| installed_specs.include? dep.name } - dependencies.all? {|d| already_installed[d] } + def dependencies_installed?(all_specs) + installed_specs = all_specs.select(&:installed?).map(&:spec) + dependencies.all? {|d| installed_specs.include? d } end # Represents only the non-development dependencies and the ones that From 33f39f00b4479610f2108a75b81c4af75ae34859 Mon Sep 17 00:00:00 2001 From: Patrick Metcalfe Date: Wed, 1 Jul 2015 14:06:06 -0500 Subject: [PATCH 02/15] match by name Because its faster and okay since all specs with the same name were already filtered out. --- lib/bundler/installer/parallel_installer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index 373700638f7..6e05f73cb92 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -36,8 +36,8 @@ def ignorable_dependency?(dep) # Checks installed dependencies against spec's dependencies to make # sure needed dependencies have been installed. def dependencies_installed?(all_specs) - installed_specs = all_specs.select(&:installed?).map(&:spec) - dependencies.all? {|d| installed_specs.include? d } + installed_specs = all_specs.select(&:installed?).map(&:name) + dependencies.all? {|d| installed_specs.include? d.name } end # Represents only the non-development dependencies and the ones that From aa0386befccc6cd845c592de172efc2090a019bd Mon Sep 17 00:00:00 2001 From: Patrick Metcalfe Date: Wed, 1 Jul 2015 14:06:45 -0500 Subject: [PATCH 03/15] spec `#dependencies_installed?` --- .../parallel/spec_installation_spec.rb | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/spec/install/parallel/spec_installation_spec.rb b/spec/install/parallel/spec_installation_spec.rb index 97288fe02f3..4d59b8a6e82 100644 --- a/spec/install/parallel/spec_installation_spec.rb +++ b/spec/install/parallel/spec_installation_spec.rb @@ -2,16 +2,16 @@ require 'bundler/installer/parallel_installer' describe ParallelInstaller::SpecInstallation do - describe "#ready_to_enqueue?" do - let!(:dep) do - a_spec = Object.new - def a_spec.name - "I like tests" - end - a_spec + let!(:dep) do + a_spec = Object.new + def a_spec.name + "I like tests" end + a_spec + end + describe "#ready_to_enqueue?" do context "when in enqueued state" do it "is falsey" do spec = ParallelInstaller::SpecInstallation.new(dep) @@ -34,4 +34,30 @@ def a_spec.name end end + describe "#dependencies_installed?" do + context "when all dependencies are installed" do + it "returns true" do + dependencies = [] + dependencies << instance_double("SpecInstallation", spec: "alpha", name: "alpha", installed?: true, all_dependencies: [], type: :production) + dependencies << instance_double("SpecInstallation", spec: "beta", name: "beta", installed?: true, all_dependencies: [], type: :production) + all_specs = dependencies + [instance_double("SpecInstallation", spec: "gamma", name: "gamma", installed?: false, all_dependencies: [], type: :production)] + spec = ParallelInstaller::SpecInstallation.new(dep) + allow(spec).to receive(:all_dependencies).and_return(dependencies) + expect(spec.dependencies_installed?(all_specs)).to be_truthy + end + end + + context "when all dependencies are not installed" do + it "returns false" do + dependencies = [] + dependencies << instance_double("SpecInstallation", spec: "alpha", name: "alpha", installed?: false, all_dependencies: [], type: :production) + dependencies << instance_double("SpecInstallation", spec: "beta", name: "beta", installed?: true, all_dependencies: [], type: :production) + all_specs = dependencies + [instance_double("SpecInstallation", spec: "gamma", name: "gamma", installed?: false, all_dependencies: [], type: :production)] + spec = ParallelInstaller::SpecInstallation.new(dep) + allow(spec).to receive(:all_dependencies).and_return(dependencies) + expect(spec.dependencies_installed?(all_specs)).to be_falsey + end + end + end + end From 851b5c74cebaf113304b78bf9daec82aca47bdcf Mon Sep 17 00:00:00 2001 From: Patrick Metcalfe Date: Wed, 1 Jul 2015 15:14:49 -0500 Subject: [PATCH 04/15] add backwards compatibility The sad days when you have to write old-style hash syntax and want to cry. --- spec/install/parallel/spec_installation_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/install/parallel/spec_installation_spec.rb b/spec/install/parallel/spec_installation_spec.rb index 4d59b8a6e82..8cb6ea8a494 100644 --- a/spec/install/parallel/spec_installation_spec.rb +++ b/spec/install/parallel/spec_installation_spec.rb @@ -38,9 +38,9 @@ def a_spec.name context "when all dependencies are installed" do it "returns true" do dependencies = [] - dependencies << instance_double("SpecInstallation", spec: "alpha", name: "alpha", installed?: true, all_dependencies: [], type: :production) - dependencies << instance_double("SpecInstallation", spec: "beta", name: "beta", installed?: true, all_dependencies: [], type: :production) - all_specs = dependencies + [instance_double("SpecInstallation", spec: "gamma", name: "gamma", installed?: false, all_dependencies: [], type: :production)] + dependencies << instance_double("SpecInstallation", :spec => "alpha", :name => "alpha", :installed? => true, :all_dependencies => [], :type => :production) + dependencies << instance_double("SpecInstallation", :spec => "beta", :name => "beta", :installed? => true, :all_dependencies => [], :type => :production) + all_specs = dependencies + [instance_double("SpecInstallation", :spec => "gamma", :name => "gamma", :installed? => false, :all_dependencies => [], :type => :production)] spec = ParallelInstaller::SpecInstallation.new(dep) allow(spec).to receive(:all_dependencies).and_return(dependencies) expect(spec.dependencies_installed?(all_specs)).to be_truthy @@ -50,9 +50,9 @@ def a_spec.name context "when all dependencies are not installed" do it "returns false" do dependencies = [] - dependencies << instance_double("SpecInstallation", spec: "alpha", name: "alpha", installed?: false, all_dependencies: [], type: :production) - dependencies << instance_double("SpecInstallation", spec: "beta", name: "beta", installed?: true, all_dependencies: [], type: :production) - all_specs = dependencies + [instance_double("SpecInstallation", spec: "gamma", name: "gamma", installed?: false, all_dependencies: [], type: :production)] + dependencies << instance_double("SpecInstallation", :spec => "alpha", :name => "alpha", :installed? => false, :all_dependencies => [], :type => :production) + dependencies << instance_double("SpecInstallation", :spec => "beta", :name => "beta", :installed? => true, :all_dependencies => [], :type => :production) + all_specs = dependencies + [instance_double("SpecInstallation", :spec => "gamma", :name => "gamma", :installed? => false, :all_dependencies => [], :type => :production)] spec = ParallelInstaller::SpecInstallation.new(dep) allow(spec).to receive(:all_dependencies).and_return(dependencies) expect(spec.dependencies_installed?(all_specs)).to be_falsey From caac3575878a41391ad6ec903d751dd4b72fb813 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Sun, 5 Jul 2015 14:26:26 -0700 Subject: [PATCH 05/15] disable fast_finish Travis support says that the many duplicate build notifacations that we've been getting via email and Slack are because of the fast_finish setting misbehaving. We'll just turn it off for now to work around it. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 575e3e99968..749858952d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,6 @@ env: - RGV=v2.4.8 matrix: - fast_finish: true include: # Ruby 2.2, Rubygems 2.4.5 and up (RG 2.4 is included by the matrix above) # Ruby 2.1, Rubygems 2.2.2 and up From cb871004ed2b7fc774075b426045864b748487bc Mon Sep 17 00:00:00 2001 From: Tim Blair Date: Wed, 8 Jul 2015 21:18:43 +0100 Subject: [PATCH 06/15] Ensure two RemoteSpecifications are comparable The RemoteSpecification#sort_obj method was added in e5d936e7 (which was cherry-picked from #3767) to fix #3762, but it still fails when comparing two instances of RemoteSpecification. As #sort_obj is private, the check for other.respond_to?(:sort_obj) returns false, which means the <=> check falls back to the default (from Object) which returns nil if the objects being compared don't match. This then results in an ArgumentError when (e.g.) sorting an array containing multiple instances of RemoteSpecification. The fix is simple: make RemoteSpecification#sort_obj public. --- lib/bundler/remote_specification.rb | 4 +-- spec/bundler/remote_specification_spec.rb | 43 +++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb index 36f62af7e4a..5a32bd24355 100644 --- a/lib/bundler/remote_specification.rb +++ b/lib/bundler/remote_specification.rb @@ -52,8 +52,6 @@ def __swap__(spec) @_remote_specification = spec end - private - # Create a delegate used for sorting. This strategy is copied from # RubyGems 2.23 and ensures that Bundler's specifications can be # compared and sorted with RubyGems' own specifications. @@ -67,6 +65,8 @@ def sort_obj [@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1] end + private + def _remote_specification @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform]) end diff --git a/spec/bundler/remote_specification_spec.rb b/spec/bundler/remote_specification_spec.rb index c93d6f908bc..83b0cd794bb 100644 --- a/spec/bundler/remote_specification_spec.rb +++ b/spec/bundler/remote_specification_spec.rb @@ -16,6 +16,49 @@ Bundler::RemoteSpecification.new(name, version, platform, nil) end + context "given a Bundler::RemoteSpecification" do + let(:same_gem) do + Bundler::RemoteSpecification.new(name, version, platform, nil) + end + + let(:different_name) do + Bundler::RemoteSpecification.new("bar", version, platform, nil) + end + + let(:newer_gem) do + Bundler::RemoteSpecification.new(name, newer_version, platform, nil) + end + + let(:older_gem) do + Bundler::RemoteSpecification.new(name, older_version, platform, nil) + end + + let(:different_platform) do + plt = Gem::Platform.new "x86-mswin32" + Bundler::RemoteSpecification.new(name, version, plt, nil) + end + + it "compares based on name" do + expect(subject <=> different_name).not_to eq(0) + end + + it "compares based on the same version" do + expect(subject <=> same_gem).to eq(0) + end + + it "compares based on an older version" do + expect(subject).to be < newer_gem + end + + it "compares based on a newer version" do + expect(subject).to be > older_gem + end + + it "compares based on platform" do + expect(subject <=> different_platform).not_to eq(0) + end + end + context "given a Gem::Specification" do let(:same_gem) do Gem::Specification.new(name, version) From a400ae031f4895b6bd85671bd52de843ce16792a Mon Sep 17 00:00:00 2001 From: Tim Blair Date: Wed, 8 Jul 2015 21:57:07 +0100 Subject: [PATCH 07/15] Clean up duplicate specs for RemoteSpecification --- spec/bundler/remote_specification_spec.rb | 106 +++++++++------------- 1 file changed, 41 insertions(+), 65 deletions(-) diff --git a/spec/bundler/remote_specification_spec.rb b/spec/bundler/remote_specification_spec.rb index 83b0cd794bb..fa3534d8a2b 100644 --- a/spec/bundler/remote_specification_spec.rb +++ b/spec/bundler/remote_specification_spec.rb @@ -8,93 +8,69 @@ describe "#<=>" do let(:name) { "foo" } let(:version) { Gem::Version.new("1.0.0") } - let(:newer_version) { Gem::Version.new("1.1.0") } - let(:older_version) { Gem::Version.new("0.9.0") } let(:platform) { Gem::Platform::RUBY } + let(:other_name) { name } + let(:other_version) { version } + let(:other_platform) { platform } + subject do Bundler::RemoteSpecification.new(name, version, platform, nil) end - context "given a Bundler::RemoteSpecification" do - let(:same_gem) do - Bundler::RemoteSpecification.new(name, version, platform, nil) - end - - let(:different_name) do - Bundler::RemoteSpecification.new("bar", version, platform, nil) - end - - let(:newer_gem) do - Bundler::RemoteSpecification.new(name, newer_version, platform, nil) - end - - let(:older_gem) do - Bundler::RemoteSpecification.new(name, older_version, platform, nil) - end - - let(:different_platform) do - plt = Gem::Platform.new "x86-mswin32" - Bundler::RemoteSpecification.new(name, version, plt, nil) - end - - it "compares based on name" do - expect(subject <=> different_name).not_to eq(0) + shared_examples_for "a comparison" do + context "which exactly matches" do + it "returns 0" do + expect(subject <=> other).to eq(0) + end end - it "compares based on the same version" do - expect(subject <=> same_gem).to eq(0) + context "which is different by name" do + let(:other_name) { "a" } + it "doesn't return 0" do + expect(subject <=> other).not_to eq(0) + end end - it "compares based on an older version" do - expect(subject).to be < newer_gem + context "which has a lower version" do + let(:other_version) { Gem::Version.new("0.9.0") } + it "returns 1" do + expect(subject <=> other).to eq(1) + end end - it "compares based on a newer version" do - expect(subject).to be > older_gem + context "which has a higher version" do + let(:other_version) { Gem::Version.new("1.1.0") } + it "returns -1" do + expect(subject <=> other).to eq(-1) + end end - it "compares based on platform" do - expect(subject <=> different_platform).not_to eq(0) + context "which has a different platform" do + let(:other_platform) { Gem::Platform.new("x86-mswin32") } + it "doesn't return 0" do + expect(subject <=> other).not_to eq(0) + end end end - context "given a Gem::Specification" do - let(:same_gem) do - Gem::Specification.new(name, version) + context "comparing another Bundler::RemoteSpecification" do + let(:other) do + Bundler::RemoteSpecification.new(other_name, other_version, + other_platform, nil) end - let(:different_name) do - Gem::Specification.new("bar", version) - end - - let(:newer_gem) do - Gem::Specification.new(name, newer_version) - end - - let(:older_gem) do - Gem::Specification.new(name, older_version) - end - - let(:different_platform) do - s = Gem::Specification.new(name, version) - s.platform = Gem::Platform.new "x86-mswin32" - s - end - - it "compares based on name" do - expect(subject <=> different_name).not_to eq(0) - end + it_should_behave_like "a comparison" + end - it "compares based on version" do - expect(subject <=> same_gem).to eq(0) - expect(subject).to be < newer_gem - expect(subject).to be > older_gem + context "comparing a Gem::Specification" do + let(:other) do + Gem::Specification.new(other_name, other_version).tap do |s| + s.platform = other_platform + end end - it "compares based on platform" do - expect(subject <=> different_platform).not_to eq(0) - end + it_should_behave_like "a comparison" end end end From 856ef24897a4a5c18999f8231b2379b416242760 Mon Sep 17 00:00:00 2001 From: Tim Blair Date: Wed, 8 Jul 2015 22:28:35 +0100 Subject: [PATCH 08/15] Use explicit values in RemoteSpecification tests The original cases ("not zero") would still pass if the check resulted in a nil response. --- spec/bundler/remote_specification_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/bundler/remote_specification_spec.rb b/spec/bundler/remote_specification_spec.rb index fa3534d8a2b..ce1e4e0358a 100644 --- a/spec/bundler/remote_specification_spec.rb +++ b/spec/bundler/remote_specification_spec.rb @@ -27,8 +27,8 @@ context "which is different by name" do let(:other_name) { "a" } - it "doesn't return 0" do - expect(subject <=> other).not_to eq(0) + it "returns 1" do + expect(subject <=> other).to eq(1) end end @@ -48,8 +48,8 @@ context "which has a different platform" do let(:other_platform) { Gem::Platform.new("x86-mswin32") } - it "doesn't return 0" do - expect(subject <=> other).not_to eq(0) + it "returns -1" do + expect(subject <=> other).to eq(-1) end end end From 54ead324ce37f7ae5be7695ee4253d96e3542bb4 Mon Sep 17 00:00:00 2001 From: Daniel Teixeira Date: Thu, 9 Jul 2015 17:42:52 -0300 Subject: [PATCH 09/15] Fix install_if not clearing install conditions --- lib/bundler/dsl.rb | 2 +- spec/install/gems/install_if.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 9924faad156..e5432fa467e 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -186,7 +186,7 @@ def install_if(*args, &blk) @install_conditionals.concat args blk.call ensure - args.each { @groups.pop } + args.each { @install_conditionals.pop } end def platforms(*platforms) diff --git a/spec/install/gems/install_if.rb b/spec/install/gems/install_if.rb index 11c7a8a1cd8..32b04d1cc4b 100644 --- a/spec/install/gems/install_if.rb +++ b/spec/install/gems/install_if.rb @@ -4,21 +4,26 @@ it "follows the install_if DSL" do install_gemfile <<-G source "file://#{gem_repo1}" - gem "rack" install_if(lambda { true }) do gem "activesupport", "2.3.5" end gem "thin", :install_if => false + install_if(lambda { false }) do + gem "foo" + end + gem "rack" G should_be_installed("rack 1.0", "activesupport 2.3.5") should_not_be_installed("thin") + should_not_be_installed("foo") lockfile_should_be <<-L GEM remote: file:#{gem_repo1}/ specs: activesupport (2.3.5) + foo (1.0) rack (1.0.0) thin (1.0) rack @@ -28,6 +33,7 @@ DEPENDENCIES activesupport (= 2.3.5) + foo rack thin From f760c49473aad720ffdb9197837b78b48584e341 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 11 Jul 2015 17:12:48 -0700 Subject: [PATCH 10/15] Fix option description for `bundle gem` The `--bin` option incorrectly had the description "Set a default with `bundle config gem.mit true`." I've moved this text to the appropriate place in the `--mit` description. --- lib/bundler/cli.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index cda22aaca31..cedfd2b055c 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -345,13 +345,13 @@ def viz end desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem" - method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :desc => "Generate a binary for your library. Set a default with `bundle config gem.mit true`." + method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :desc => "Generate a binary for your library." method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", :lazy_default => [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }, :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code" - method_option :mit, :type => :boolean, :desc => "Generate an MIT license file" + method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config gem.mit true`." method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "rspec", :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`." def gem(name) From 917ce622c1b643df2e77af82917776eae0dfb062 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 15 Jul 2015 15:41:21 -0700 Subject: [PATCH 11/15] Apply the suggested fix from #3438 --- lib/bundler/source/git/git_proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 89c784e0faf..5f388e76e57 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -83,7 +83,7 @@ def copy_to(destination, submodules=false) FileUtils.mkdir_p(destination.dirname) FileUtils.rm_rf(destination) git_retry %|clone --no-checkout --quiet "#{path}" "#{destination}"| - File.chmod((0777 & ~File.umask), destination) + File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination) end SharedHelpers.chdir(destination) do From 693ddf51faabc2ae0089f8371fed38b7e47ceb9a Mon Sep 17 00:00:00 2001 From: ethanez713 Date: Thu, 16 Jul 2015 18:57:39 -0400 Subject: [PATCH 12/15] Update README.md.tt Under the "Development" header, the README was telling users to run "rake rspec" if the RSpec gem is being used. However, in lib/bundler/templates/newgem/Rakefile.tt, the rake task that runs RSpec is named 'spec', rather than 'rspec'. I changed the generated README text to read 'rake spec' instead of 'rake rspec'. Also: Should I write a test for this change? --- lib/bundler/templates/newgem/README.md.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/templates/newgem/README.md.tt b/lib/bundler/templates/newgem/README.md.tt index 064381e908d..8a767d5e45c 100644 --- a/lib/bundler/templates/newgem/README.md.tt +++ b/lib/bundler/templates/newgem/README.md.tt @@ -26,7 +26,7 @@ TODO: Write usage instructions here ## Development -After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %> +After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %> To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). From 3328f9207d3025a121d2ef60f7427193cfc00ca9 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Thu, 16 Jul 2015 17:53:30 -0700 Subject: [PATCH 13/15] downgrade invalid specs to a warning for now since invalid specs were allowed by 1.0-1.9, we allow them in all 1.x versions. we'll go back to throwing an exception on invalid gemspecs in Bundler 2.0. (cc @smlance) fixes #3688 --- lib/bundler.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bundler.rb b/lib/bundler.rb index 5970e2c1e46..95c86a73d23 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -367,11 +367,15 @@ def load_gemspec_uncached(file, validate = false) else spec = eval_gemspec(path, contents) end - Bundler.rubygems.validate(spec) if spec && validate + warn_on_invalid_specs(spec) if validate spec end + end + + def warn_on_invalid_specs(spec) + spec && Bundler.rubygems.validate(spec) rescue Gem::InvalidSpecificationException => e - raise InvalidOption, "The gemspec at #{file} is not valid. " \ + Bundler.ui.warn "The gemspec at #{file} is not valid. " \ "The validation error was '#{e.message}'" end From b7b6d967079e040ad1fc070bf4ebca398ae4f117 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Sat, 18 Jul 2015 13:37:04 -0600 Subject: [PATCH 14/15] Update spec to fail, then fix it --- lib/bundler.rb | 7 ++----- spec/install/gemfile/path_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/bundler.rb b/lib/bundler.rb index 95c86a73d23..7059830a46b 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -367,16 +367,13 @@ def load_gemspec_uncached(file, validate = false) else spec = eval_gemspec(path, contents) end - warn_on_invalid_specs(spec) if validate + Bundler.rubygems.validate(spec) if spec && validate spec end - end - - def warn_on_invalid_specs(spec) - spec && Bundler.rubygems.validate(spec) rescue Gem::InvalidSpecificationException => e Bundler.ui.warn "The gemspec at #{file} is not valid. " \ "The validation error was '#{e.message}'" + nil end def clear_gemspec_cache diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index b07038136f5..a38981150b4 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -141,7 +141,7 @@ should_be_installed "premailer 1.0.0" end - it "errors on invalid specs", :rubygems => "1.7" do + it "warns on invalid specs", :rubygems => "1.7" do build_lib "foo" gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s @@ -158,7 +158,7 @@ G expect(out).to match(/missing value for attribute version/) - should_not_be_installed("foo 1.0") + expect(out).to_not include("ERROR REPORT") end it "supports gemspec syntax" do From a85578ca41922c74f3789c755ee5105014cd9d7c Mon Sep 17 00:00:00 2001 From: "Samuel E. Giddins" Date: Wed, 22 Jul 2015 14:33:13 -0700 Subject: [PATCH 15/15] Update changelog for 1.10.6 --- CHANGELOG.md | 12 ++++++++++++ lib/bundler/version.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa83fcc6d9a..cc8ed1bd487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 1.10.6 (2015-07-22) + +Workarounds: + + - only warn on invalid gemspecs (@indirect) + +Bugfixes: + + - fix installing dependencies in the correct order (#3799, @pducks32) + - fix sorting of mixed DependencyLists (#3762, @tony-spataro-rs) + - fix `install_if` conditionals when using the block form (@danieltdt) + ## 1.10.5 (2015-06-24) Workarounds: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 9873d538f3b..984293e95e9 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -2,5 +2,5 @@ module Bundler # We're doing this because we might write tests that deal # with other versions of bundler and we are unsure how to # handle this better. - VERSION = "1.10.5" unless defined?(::Bundler::VERSION) + VERSION = "1.10.6" unless defined?(::Bundler::VERSION) end