diff options
author | Homu <homu@barosl.com> | 2016-08-27 06:45:12 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-08-27 06:45:12 +0900 |
commit | f2d9d93b09a13aa812b16d27afb82a02995fc279 (patch) | |
tree | 890ae271738894bff9c5929ba622bea767a7b66e | |
parent | c5e161a2ea28feef7a1314dcfd03d0d54d1e4f1c (diff) | |
parent | 91d9637c33987868df1c02b59d394fe990ac9a80 (diff) | |
download | bundler-f2d9d93b09a13aa812b16d27afb82a02995fc279.tar.gz |
Auto merge of #4915 - bundler:seg-2-0-dev-fixes, r=indirect
Get 2-0-dev green again
Closes https://github.com/bundler/bundler/issues/4719
\c @indirect
-rw-r--r-- | .travis.yml | 13 | ||||
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | bundler.gemspec | 4 | ||||
-rwxr-xr-x | exe/bundle | 2 | ||||
-rw-r--r-- | lib/bundler.rb | 2 | ||||
-rw-r--r-- | lib/bundler/compatibility_guard.rb | 9 | ||||
-rw-r--r-- | lib/bundler/inline.rb | 2 | ||||
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 2 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 2 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 2 | ||||
-rw-r--r-- | spec/other/platform_spec.rb | 2 | ||||
-rw-r--r-- | spec/realworld/edgecases_spec.rb | 2 | ||||
-rw-r--r-- | spec/runtime/with_clean_env_spec.rb | 10 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb | 9 |
14 files changed, 47 insertions, 16 deletions
diff --git a/.travis.yml b/.travis.yml index 9f223dcb21..9c06a20336 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ env: # We need to know if changes to rubygems will break bundler on release - RGV=master # Test the latest rubygems release with all of our supported rubies - - RGV=v2.6.4 + - RGV=v2.6.6 matrix: include: @@ -45,8 +45,19 @@ matrix: # Ruby 2.2, Rubygems 2.4.5 and up - rvm: 2.2 env: RGV=v2.4.8 + # Ruby 2.1, Rubygems 2.2.2 and up + - rvm: 2.1 + env: RGV=v2.2.5 + # Ruby 2.0.0, Rubygems 2.0.0 and up + - rvm: 2.0.0 + env: RGV=v2.2.5 + - rvm: 2.0.0 + env: RGV=v2.1.11 + - rvm: 2.0.0 + env: RGV=v2.0.14 # ALLOWED FAILURES + # Ruby-head (we want to know how we're doing, but not fail the build) - rvm: ruby-head env: RGV=master @@ -122,7 +122,7 @@ begin rubyopt = ENV["RUBYOPT"] # When editing this list, also edit .travis.yml! branches = %w(master) - releases = %w(v2.4.8 v2.5.2 v2.6.4) + releases = %w(v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.6) (branches + releases).each do |rg| desc "Run specs with Rubygems #{rg}" RSpec::Core::RakeTask.new(rg) do |t| diff --git a/bundler.gemspec b/bundler.gemspec index 0df67402b2..ce8d729787 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |s| s.summary = "The best way to manage your application's dependencies" s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably" - s.required_ruby_version = ">= 1.8.7" - s.required_rubygems_version = ">= 1.3.6" + s.required_ruby_version = ">= 2.0.0" + s.required_rubygems_version = ">= 2.0.0" s.add_development_dependency "automatiek", "~> 0.1.0" s.add_development_dependency "mustache", "0.99.6" diff --git a/exe/bundle b/exe/bundle index b1e542e2e3..a5c2121eed 100755 --- a/exe/bundle +++ b/exe/bundle @@ -4,6 +4,8 @@ # Exit cleanly from an early interrupt Signal.trap("INT") { exit 1 } +require "bundler/compatibility_guard" + require "bundler/friendly_errors" Bundler.with_friendly_errors do require "bundler" diff --git a/lib/bundler.rb b/lib/bundler.rb index b92f440554..a32ab723db 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true +require "bundler/compatibility_guard" + require "fileutils" require "pathname" require "rbconfig" diff --git a/lib/bundler/compatibility_guard.rb b/lib/bundler/compatibility_guard.rb new file mode 100644 index 0000000000..c7369789c1 --- /dev/null +++ b/lib/bundler/compatibility_guard.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true +require "rubygems" + +if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0") + abort "Bundler 2 requires Ruby 2+. Either install bundler 1 or update to a supported Ruby version." +end +if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0.0") + abort "Bundler 2 requires RubyGems 2+. Either install bundler 1 or update to a supported RubyGems version." +end diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 9cb9956de6..88d1824e44 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true +require "bundler/compatibility_guard" + # Allows for declaring a gems.rb inline in a ruby script, optionally installing # any gems that aren't already installed on the user's system. # diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 94f502ad51..e5a9be70c9 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -123,7 +123,7 @@ module Gem end def to_yaml_properties - instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) } + instance_variables.reject {|p| ["@source", "@groups", "@all_sources"].include?(p.to_s) } end def to_lock diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 283ed040e3..a06f38e0a6 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true +require "bundler/compatibility_guard" + require "pathname" require "rubygems" diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index e08b818a34..c22d78a71f 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -15,7 +15,7 @@ describe Bundler::SharedHelpers do context "Gemfile is present" do it "returns the Gemfile path" do expected = Pathname.pwd.join("gems.rb") - expected.write("") + expected.open("w") {} expect(subject.default_gemfile).to eq(expected) end end diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 94c4435d41..299d91d55f 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -123,7 +123,7 @@ G source "file://#{gem_repo1}" gem "foo" G - bundled_app(".ruby-version").write("2.2.3\n") + create_file(".ruby-version", "2.2.3\n") bundle "platform --ruby" diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 68482f380d..740bb3f4fc 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -49,7 +49,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9 G bundle :lock - expect(lockfile).to include("rails (3.2.22.2)") + expect(lockfile).to include("rails (3.2.22.4)") expect(lockfile).to include("capybara (2.2.1)") end diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index e5584db2aa..546b184383 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -12,7 +12,7 @@ describe "Bundler.with_env helpers" do code = "print Bundler.original_env['PATH']" path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo" with_path_as(path) do - result = bundle("exec ruby -e #{code.dump}") + result = bundle("exec #{Gem.ruby.dump} -e #{code.dump}") expect(result).to eq(path) end end @@ -21,24 +21,24 @@ describe "Bundler.with_env helpers" do code = "print Bundler.original_env['GEM_PATH']" gem_path = ENV["GEM_PATH"] + ":/foo" with_gem_path_as(gem_path) do - result = bundle("exec ruby -e #{code.inspect}") + result = bundle("exec #{Gem.ruby.dump} -e #{code.inspect}") expect(result).to eq(gem_path) end end it "works with nested bundle exec invocations" do - create_file("exe.rb", <<-'RB') + create_file("exe.rb", format(<<-'RB', Gem.ruby.dump)) count = ARGV.first.to_i exit if count < 0 STDERR.puts "#{count} #{ENV["PATH"].end_with?(":/foo")}" if count == 2 ENV["PATH"] = "#{ENV["PATH"]}:/foo" end - exec("ruby", __FILE__, (count - 1).to_s) + exec(%s, __FILE__, (count - 1).to_s) RB path = `getconf PATH`.strip + File::PATH_SEPARATOR + File.dirname(Gem.ruby) with_path_as(path) do - bundle!("exec ruby #{bundled_app("exe.rb")} 2", :expect_err => true) + bundle!("exec #{Gem.ruby.dump} #{bundled_app("exe.rb")} 2", :expect_err => true) end expect(err).to eq <<-EOS.strip 2 false diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 64cc41443d..85ed1bdf0f 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -6,7 +6,10 @@ module Spec module Rubygems DEPS = begin deps = { - "fakeweb artifice rack compact_index" => nil, + # rack 2.x requires Ruby version >= 2.2.2. + # artifice doesn't support rack 2.x now. + "rack" => "< 2", + "fakeweb artifice compact_index" => nil, "sinatra" => "1.2.7", # Rake version has to be consistent for tests to pass "rake" => "10.0.2", @@ -32,7 +35,7 @@ module Spec FileUtils.rm_rf(Path.base_system_gems) FileUtils.mkdir_p(Path.base_system_gems) puts "installing gems for the tests to use..." - DEPS.each {|n, v| install_gem(n, v) } + DEPS.sort {|a, _| a[1].nil? ? 1 : -1 }.each {|n, v| install_gem(n, v) } File.open(manifest_path, "w") {|f| f << manifest.join } end @@ -43,7 +46,7 @@ module Spec def self.install_gem(name, version = nil) cmd = "gem install #{name} --no-rdoc --no-ri" - cmd += " --version #{version}" if version + cmd += " --version '#{version}'" if version system(cmd) || raise("Installing gem #{name} for the tests to use failed!") end |