Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Fix specs that are broken in ruby 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Dec 28, 2018
1 parent 15ebada commit dcfc275
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
4 changes: 1 addition & 3 deletions bundler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
25 changes: 20 additions & 5 deletions lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -132,6 +127,26 @@ def what_required(spec)
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
Expand Down
4 changes: 3 additions & 1 deletion spec/runtime/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,9 @@ def clean_load_path(lp)
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
Expand Down

0 comments on commit dcfc275

Please sign in to comment.