summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2018-12-28 01:29:01 -0500
committerSamuel Giddins <segiddins@segiddins.me>2018-12-28 01:29:01 -0500
commitdcfc2750a09534d82494e0451cefe6382d2cbc98 (patch)
tree4317f3eec0b6ea2316064db01f689cf9f2d45f06
parent15ebada13e8c9feeba784d16e4186616eb68747f (diff)
downloadbundler-dcfc2750a09534d82494e0451cefe6382d2cbc98.tar.gz
Fix specs that are broken in ruby 2.6
-rw-r--r--bundler.gemspec4
-rw-r--r--lib/bundler/spec_set.rb25
-rw-r--r--spec/runtime/setup_spec.rb4
3 files changed, 24 insertions, 9 deletions
diff --git a/bundler.gemspec b/bundler.gemspec
index c004de0965..be87e4003f 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -8,8 +8,6 @@ rescue LoadError
require File.expand_path("../bundler/version", __FILE__)
end
-require "shellwords"
-
Gem::Specification.new do |s|
s.name = "bundler"
s.version = Bundler::VERSION
@@ -49,7 +47,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "ronn", "~> 0.7.3"
s.add_development_dependency "rspec", "~> 3.6"
- s.files = `git -C #{Shellwords.escape File.dirname(__FILE__)} ls-files -z`.split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
+ s.files = IO.popen(["git", "-C", File.dirname(__FILE__), "ls-files", "-z"], &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
# we don't check in man pages, but we need to ship them because
# we use them to generate the long-form help for each command.
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index e6c30603f0..2c5d9e6580 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -1,18 +1,13 @@
# frozen_string_literal: true
require "tsort"
-require "forwardable"
require "set"
module Bundler
class SpecSet
- extend Forwardable
include Enumerable
include TSort
- def_delegators :@specs, :<<, :length, :add, :remove, :size, :empty?
- def_delegators :sorted, :each
-
def initialize(specs)
@specs = specs
end
@@ -132,6 +127,26 @@ module Bundler
what_required(req) << spec
end
+ def <<(spec)
+ @specs << spec
+ end
+
+ def length
+ @specs.length
+ end
+
+ def size
+ @specs.size
+ end
+
+ def empty?
+ @specs.empty?
+ end
+
+ def each(&b)
+ sorted.each(&b)
+ end
+
private
def sorted
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 7ea7d5ea0b..941c3d34e7 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -882,7 +882,9 @@ end
end
end
- it "should successfully require 'bundler/setup'", :ruby_repo do
+ # Can't make this pass on 2.6 since the ruby standard library has the same $LOAD_PATH
+ # entry as bundler (since it's a default gem)
+ it "should successfully require 'bundler/setup'", :ruby_repo, :ruby => "< 2.6" do
install_gemfile ""
ruby <<-'R', :env => { "GEM_PATH" => symlinked_gem_home }, :no_lib => true