aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/support')
-rw-r--r--spec/bundler/support/artifice/compact_index.rb6
-rw-r--r--spec/bundler/support/artifice/endpoint.rb39
-rw-r--r--spec/bundler/support/artifice/endpoint_500.rb1
-rw-r--r--spec/bundler/support/artifice/windows.rb1
-rw-r--r--spec/bundler/support/builders.rb4
-rw-r--r--spec/bundler/support/hax.rb26
-rw-r--r--spec/bundler/support/helpers.rb146
-rw-r--r--spec/bundler/support/matchers.rb7
-rw-r--r--spec/bundler/support/path.rb99
-rw-r--r--spec/bundler/support/rubygems_ext.rb14
-rw-r--r--spec/bundler/support/rubygems_version_manager.rb4
-rw-r--r--spec/bundler/support/switch_rubygems.rb10
12 files changed, 214 insertions, 143 deletions
diff --git a/spec/bundler/support/artifice/compact_index.rb b/spec/bundler/support/artifice/compact_index.rb
index 67fd05f9a2..5cf3a79f29 100644
--- a/spec/bundler/support/artifice/compact_index.rb
+++ b/spec/bundler/support/artifice/compact_index.rb
@@ -2,11 +2,13 @@
require_relative "endpoint"
-$LOAD_PATH.unshift Dir[base_system_gems.join("gems/compact_index*/lib")].first.to_s
+$LOAD_PATH.unshift Dir[Spec::Path.base_system_gems.join("gems/compact_index*/lib")].first.to_s
require "compact_index"
class CompactIndexAPI < Endpoint
helpers do
+ include Spec::Path
+
def load_spec(name, version, platform, gem_repo)
full_name = "#{name}-#{version}"
full_name += "-#{platform}" if platform != "ruby"
@@ -83,7 +85,7 @@ class CompactIndexAPI < Endpoint
nil
end
CompactIndex::GemVersion.new(spec.version.version, spec.platform.to_s, checksum, nil,
- deps, spec.required_ruby_version, spec.required_rubygems_version)
+ deps, spec.required_ruby_version.to_s, spec.required_rubygems_version.to_s)
end
CompactIndex::Gem.new(name, gem_versions)
end
diff --git a/spec/bundler/support/artifice/endpoint.rb b/spec/bundler/support/artifice/endpoint.rb
index 3ed9a3f0f7..1dc7101389 100644
--- a/spec/bundler/support/artifice/endpoint.rb
+++ b/spec/bundler/support/artifice/endpoint.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
require_relative "../path"
-require Spec::Path.lib_dir.join("bundler/deprecate")
-include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
@@ -41,28 +39,27 @@ class Endpoint < Sinatra::Base
end
helpers do
+ include Spec::Path
+
def dependencies_for(gem_names, gem_repo = GEM_REPO)
return [] if gem_names.nil? || gem_names.empty?
- require "#{Spec::Path.lib_dir}/bundler"
- Bundler::Deprecate.skip_during do
- all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename|
- Marshal.load(File.open(gem_repo.join(filename)).read)
- end.inject(:+)
-
- all_specs.map do |name, version, platform|
- spec = load_spec(name, version, platform, gem_repo)
- next unless gem_names.include?(spec.name)
- {
- :name => spec.name,
- :number => spec.version.version,
- :platform => spec.platform.to_s,
- :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
- [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
- end,
- }
- end.compact
- end
+ all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename|
+ Marshal.load(File.open(gem_repo.join(filename)).read)
+ end.inject(:+)
+
+ all_specs.map do |name, version, platform|
+ spec = load_spec(name, version, platform, gem_repo)
+ next unless gem_names.include?(spec.name)
+ {
+ :name => spec.name,
+ :number => spec.version.version,
+ :platform => spec.platform.to_s,
+ :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
+ [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
+ end,
+ }
+ end.compact
end
def load_spec(name, version, platform, gem_repo)
diff --git a/spec/bundler/support/artifice/endpoint_500.rb b/spec/bundler/support/artifice/endpoint_500.rb
index 7c1c4365bb..0ce8dfeaad 100644
--- a/spec/bundler/support/artifice/endpoint_500.rb
+++ b/spec/bundler/support/artifice/endpoint_500.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
require_relative "../path"
-include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
diff --git a/spec/bundler/support/artifice/windows.rb b/spec/bundler/support/artifice/windows.rb
index c31c6fff79..f5b4baae30 100644
--- a/spec/bundler/support/artifice/windows.rb
+++ b/spec/bundler/support/artifice/windows.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
require_relative "../path"
-include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 5ce6e01da3..de71c64b56 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -758,9 +758,9 @@ module Spec
gem_path = File.expand_path("#{@spec.full_name}.gem", lib_path)
if opts[:to_system]
- @context.system_gems gem_path, :keep_path => true
+ @context.system_gems gem_path
elsif opts[:to_bundle]
- @context.system_gems gem_path, :path => @context.default_bundle_path, :keep_path => true
+ @context.system_gems gem_path, :path => @context.default_bundle_path
else
FileUtils.mv(gem_path, destination)
end
diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb
index 4b5c5dd94c..7529dc460a 100644
--- a/spec/bundler/support/hax.rb
+++ b/spec/bundler/support/hax.rb
@@ -9,13 +9,25 @@ module Gem
Gem.ruby = ENV["RUBY"]
end
- class Platform
- @local = new(ENV["BUNDLER_SPEC_PLATFORM"]) if ENV["BUNDLER_SPEC_PLATFORM"]
+ if ENV["BUNDLER_SPEC_PLATFORM"]
+ class Platform
+ @local = new(ENV["BUNDLER_SPEC_PLATFORM"])
+ end
+ @platforms = [Gem::Platform::RUBY, Gem::Platform.local]
+
+ if ENV["BUNDLER_SPEC_PLATFORM"] == "ruby"
+ class << self
+ remove_method :finish_resolve
+
+ def finish_resolve
+ []
+ end
+ end
+ end
end
- @platforms = [Gem::Platform::RUBY, Gem::Platform.local]
# We only need this hack for rubygems versions without the BundlerVersionFinder
- if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") || ENV["BUNDLER_SPEC_DISABLE_DEFAULT_BUNDLER_GEM"]
+ if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
@path_to_default_spec_map.delete_if do |_path, spec|
spec.name == "bundler"
end
@@ -24,7 +36,7 @@ end
if ENV["BUNDLER_SPEC_WINDOWS"] == "true"
require_relative "path"
- require "#{Spec::Path.lib_dir}/bundler/constants"
+ require "bundler/constants"
module Bundler
remove_const :WINDOWS if defined?(WINDOWS)
@@ -34,8 +46,8 @@ end
if ENV["BUNDLER_SPEC_API_REQUEST_LIMIT"]
require_relative "path"
- require "#{Spec::Path.lib_dir}/bundler/source"
- require "#{Spec::Path.lib_dir}/bundler/source/rubygems"
+ require "bundler/source"
+ require "bundler/source/rubygems"
module Bundler
class Source
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 50cf4438d9..731a2d9664 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -2,17 +2,25 @@
require_relative "command_execution"
require_relative "the_bundle"
+require_relative "path"
module Spec
module Helpers
+ include Spec::Path
+
def reset!
Dir.glob("#{tmp}/{gems/*,*}", File::FNM_DOTMATCH).each do |dir|
- next if %w[base remote1 gems rubygems . ..].include?(File.basename(dir))
+ next if %w[base base_system remote1 gems rubygems . ..].include?(File.basename(dir))
FileUtils.rm_rf(dir)
end
FileUtils.mkdir_p(home)
FileUtils.mkdir_p(tmpdir)
+ reset_paths!
+ end
+
+ def reset_paths!
Bundler.reset!
+ Gem.clear_paths
end
def self.bang(method)
@@ -80,14 +88,10 @@ module Spec
with_sudo = options.delete(:sudo)
sudo = with_sudo == :preserve_env ? "sudo -E --preserve-env=RUBYOPT" : "sudo" if with_sudo
- bundle_bin = options.delete("bundle_bin") || bindir.join("bundle")
-
- if system_bundler = options.delete(:system_bundler)
- bundle_bin = system_gem_path.join("bin/bundler")
- end
+ bundle_bin = options.delete(:bundle_bin)
+ bundle_bin ||= installed_bindir.join("bundle")
env = options.delete(:env) || {}
- env["PATH"].gsub!("#{Path.root}/exe", "") if env["PATH"] && system_bundler
requires = options.delete(:requires) || []
@@ -103,7 +107,6 @@ module Spec
end
load_path = []
- load_path << lib_dir unless system_bundler
load_path << spec_dir
dir = options.delete(:dir) || bundled_app
@@ -145,12 +148,12 @@ module Spec
end
def bundler(cmd, options = {})
- options["bundle_bin"] = bindir.join("bundler")
+ options[:bundle_bin] = system_gem_path.join("bin/bundler")
bundle(cmd, options)
end
def ruby(ruby, options = {})
- ruby_cmd = build_ruby_cmd({ :load_path => options[:no_lib] ? [] : [lib_dir] })
+ ruby_cmd = build_ruby_cmd
escaped_ruby = RUBY_PLATFORM == "java" ? ruby.shellescape.dump : ruby.shellescape
sys_exec(%(#{ruby_cmd} -w -e #{escaped_ruby}), options)
end
@@ -169,8 +172,8 @@ module Spec
def build_ruby_cmd(options = {})
sudo = options.delete(:sudo)
- libs = options.delete(:load_path) || []
- lib_option = "-I#{libs.join(File::PATH_SEPARATOR)}"
+ libs = options.delete(:load_path)
+ lib_option = libs ? "-I#{libs.join(File::PATH_SEPARATOR)}" : []
requires = options.delete(:requires) || []
requires << "#{Path.spec_dir}/support/hax.rb"
@@ -180,12 +183,8 @@ module Spec
end
def gembin(cmd, options = {})
- old = ENV["RUBYOPT"]
- ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{lib_dir}"
cmd = bundled_app("bin/#{cmd}") unless cmd.to_s.include?("/")
sys_exec(cmd.to_s, options)
- ensure
- ENV["RUBYOPT"] = old
end
def gem_command(command, options = {})
@@ -328,14 +327,16 @@ module Spec
FileUtils.cp shipped_file, target_shipped_file, :preserve => true
end
- # for Ruby core repository
- if File.exist? File.join(build_path, "lib/bundler/bundler.gemspec")
- FileUtils.mv File.join(build_path, "lib/bundler/bundler.gemspec"), build_path
- end
-
replace_version_file(version, dir: build_path) # rubocop:disable Style/HashSyntax
- gem_command! "build bundler.gemspec", :dir => build_path
+ build_metadata = {
+ :built_at => loaded_gemspec.date.utc.strftime("%Y-%m-%d"),
+ :git_commit_sha => sys_exec("git rev-parse --short HEAD", :dir => source_root).strip,
+ }
+
+ replace_build_metadata(build_metadata, dir: build_path) # rubocop:disable Style/HashSyntax
+
+ gem_command! "build #{relative_gemspec}", :dir => build_path
yield(bundler_path)
ensure
@@ -344,19 +345,24 @@ module Spec
end
def with_gem_path_as(path)
- backup = ENV.to_hash
- ENV["GEM_HOME"] = path.to_s
- ENV["GEM_PATH"] = path.to_s
- ENV["BUNDLER_ORIG_GEM_PATH"] = nil
- yield
- ensure
- ENV.replace(backup)
+ without_env_side_effects do
+ ENV["GEM_HOME"] = path.to_s
+ ENV["GEM_PATH"] = path.to_s
+ ENV["BUNDLER_ORIG_GEM_PATH"] = nil
+ yield
+ end
end
def with_path_as(path)
+ without_env_side_effects do
+ ENV["PATH"] = path.to_s
+ ENV["BUNDLER_ORIG_PATH"] = nil
+ yield
+ end
+ end
+
+ def without_env_side_effects
backup = ENV.to_hash
- ENV["PATH"] = path.to_s
- ENV["BUNDLER_ORIG_PATH"] = nil
yield
ensure
ENV.replace(backup)
@@ -397,56 +403,29 @@ module Spec
with_path_added(tmp("fake_man")) { yield }
end
+ def pristine_system_gems(*gems)
+ FileUtils.rm_rf(system_gem_path)
+
+ system_gems(*gems)
+ end
+
def system_gems(*gems)
opts = gems.last.is_a?(Hash) ? gems.last : {}
path = opts.fetch(:path, system_gem_path)
gems = gems.flatten
- unless opts[:keep_path]
- FileUtils.rm_rf(path)
- FileUtils.mkdir_p(path)
- end
-
- Gem.clear_paths
-
- env_backup = ENV.to_hash
- ENV["GEM_HOME"] = path.to_s
- ENV["GEM_PATH"] = path.to_s
- ENV["BUNDLER_ORIG_GEM_PATH"] = nil
-
- install_gems(*gems)
- return unless block_given?
- begin
- yield
- ensure
- ENV.replace(env_backup)
+ with_gem_path_as(path) do
+ install_gems(*gems)
end
end
def realworld_system_gems(*gems)
gems = gems.flatten
- FileUtils.rm_rf(system_gem_path)
- FileUtils.mkdir_p(system_gem_path)
-
- Gem.clear_paths
-
- gem_home = ENV["GEM_HOME"]
- gem_path = ENV["GEM_PATH"]
- path = ENV["PATH"]
- ENV["GEM_HOME"] = system_gem_path.to_s
- ENV["GEM_PATH"] = system_gem_path.to_s
-
- gems.each do |gem|
- gem_command! "install --no-document #{gem}"
- end
- return unless block_given?
- begin
- yield
- ensure
- ENV["GEM_HOME"] = gem_home
- ENV["GEM_PATH"] = gem_path
- ENV["PATH"] = path
+ with_gem_path_as(system_gem_path) do
+ gems.each do |gem|
+ gem_command! "install --no-document #{gem}"
+ end
end
end
@@ -464,9 +443,8 @@ module Spec
end
def simulate_new_machine
- system_gems []
- FileUtils.rm_rf system_gem_path
FileUtils.rm_rf bundled_app(".bundle")
+ pristine_system_gems :bundler
end
def simulate_platform(platform)
@@ -490,12 +468,34 @@ module Spec
old = ENV["BUNDLER_SPEC_WINDOWS"]
ENV["BUNDLER_SPEC_WINDOWS"] = "true"
simulate_platform platform do
- yield
+ simulate_bundler_version_when_missing_prerelease_default_gem_activation do
+ yield
+ end
end
ensure
ENV["BUNDLER_SPEC_WINDOWS"] = old
end
+ # workaround for missing https://github.com/rubygems/rubygems/commit/929e92d752baad3a08f3ac92eaec162cb96aedd1
+ def simulate_bundler_version_when_missing_prerelease_default_gem_activation
+ return yield unless Gem.rubygems_version < Gem::Version.new("3.1.0.pre.1")
+
+ old = ENV["BUNDLER_VERSION"]
+ ENV["BUNDLER_VERSION"] = Bundler::VERSION
+ yield
+ ensure
+ ENV["BUNDLER_VERSION"] = old
+ end
+
+ # workaround for missing https://github.com/rubygems/rubygems/commit/929e92d752baad3a08f3ac92eaec162cb96aedd1
+ def env_for_missing_prerelease_default_gem_activation
+ if Gem.rubygems_version < Gem::Version.new("3.1.0.pre.1")
+ { "BUNDLER_VERSION" => Bundler::VERSION }
+ else
+ {}
+ end
+ end
+
def revision_for(path)
sys_exec("git rev-parse HEAD", :dir => path).strip
end
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index e6275064a8..a5e546d333 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -115,13 +115,18 @@ module Spec
opts = names.last.is_a?(Hash) ? names.pop : {}
source = opts.delete(:source)
groups = Array(opts[:groups])
+ exclude_from_load_path = opts.delete(:exclude_from_load_path)
groups << opts
@errors = names.map do |name|
name, version, platform = name.split(/\s+/)
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/")
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
begin
- run! "require '#{require_path}.rb'; puts #{version_const}", *groups
+ code = []
+ code << "$LOAD_PATH.delete '#{exclude_from_load_path}'" if exclude_from_load_path
+ code << "require '#{require_path}.rb'"
+ code << "puts #{version_const}"
+ run! code.join("; "), *groups
rescue StandardError => e
next "#{name} is not installed:\n#{indent(e)}"
end
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 3fb13a0283..600f3e3b6f 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -5,56 +5,82 @@ require "rbconfig"
module Spec
module Path
+ def source_root
+ @source_root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__)
+ end
+
def root
- @root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__)
+ @root ||= system_gem_path("gems/bundler-#{Bundler::VERSION}")
end
def gemspec
- @gemspec ||= root.join(ruby_core? ? "lib/bundler/bundler.gemspec" : "bundler.gemspec")
+ @gemspec ||= source_root.join(relative_gemspec)
+ end
+
+ def relative_gemspec
+ @relative_gemspec ||= ruby_core? ? "lib/bundler/bundler.gemspec" : "bundler.gemspec"
end
def gemspec_dir
@gemspec_dir ||= gemspec.parent
end
+ def loaded_gemspec
+ @loaded_gemspec ||= Gem::Specification.load(gemspec.to_s)
+ end
+
+ def test_gemfile
+ @test_gemfile ||= source_root.join(ruby_core? ? "tool/bundler/test_gems.rb" : "test_gems.rb")
+ end
+
+ def dev_gemfile
+ @dev_gemfile ||= source_root.join("dev_gems.rb")
+ end
+
def bindir
- @bindir ||= root.join(ruby_core? ? "libexec" : "exe")
+ @bindir ||= source_root.join(ruby_core? ? "libexec" : "exe")
+ end
+
+ def installed_bindir
+ @installed_bindir ||= system_gem_path("bin")
end
def gem_cmd
- @gem_cmd ||= ruby_core? ? root.join("bin/gem") : "gem"
+ @gem_cmd ||= ruby_core? ? source_root.join("bin/gem") : "gem"
end
def gem_bin
@gem_bin ||= ruby_core? ? ENV["GEM_COMMAND"] : "gem"
end
+ def path
+ env_path = ENV["PATH"]
+ env_path = env_path.split(File::PATH_SEPARATOR).reject {|path| path == bindir.to_s }.join(File::PATH_SEPARATOR) if ruby_core?
+ env_path
+ end
+
def spec_dir
- @spec_dir ||= root.join(ruby_core? ? "spec/bundler" : "spec")
+ @spec_dir ||= source_root.join(ruby_core? ? "spec/bundler" : "spec")
end
def tracked_files
- skip "not in git working directory" unless git_root_dir?
- @tracked_files ||= sys_exec(ruby_core? ? "git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler man/bundler*" : "git ls-files -z", :dir => root).split("\x0")
+ @tracked_files ||= git_ls_files(tracked_files_glob)
end
def shipped_files
- skip "not in git working directory" unless git_root_dir?
- @shipped_files ||= sys_exec(ruby_core? ? "git ls-files -z -- lib/bundler lib/bundler.rb man/bundler* libexec/bundle*" : "git ls-files -z -- lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec", :dir => root).split("\x0")
+ @shipped_files ||= git_ls_files(shipped_files_glob)
end
def lib_tracked_files
- skip "not in git working directory" unless git_root_dir?
- @lib_tracked_files ||= sys_exec(ruby_core? ? "git ls-files -z -- lib/bundler lib/bundler.rb" : "git ls-files -z -- lib", :dir => root).split("\x0")
+ @lib_tracked_files ||= git_ls_files(lib_tracked_files_glob)
end
def man_tracked_files
- skip "not in git working directory" unless git_root_dir?
- @man_tracked_files ||= sys_exec(ruby_core? ? "git ls-files -z -- man/bundler*" : "git ls-files -z -- man", :dir => root).split("\x0")
+ @man_tracked_files ||= git_ls_files(man_tracked_files_glob)
end
def tmp(*path)
- root.join("tmp", scope, *path)
+ source_root.join("tmp", scope, *path)
end
def scope
@@ -143,6 +169,10 @@ module Spec
tmp("gems/system", *path)
end
+ def pristine_system_gem_path
+ tmp("gems/base_system")
+ end
+
def local_gem_path(*path, base: bundled_app)
base.join(*[".bundle", Gem.ruby_engine, RbConfig::CONFIG["ruby_version"], *path].compact)
end
@@ -151,6 +181,10 @@ module Spec
tmp("libs", *args)
end
+ def source_lib_dir
+ source_root.join("lib")
+ end
+
def lib_dir
root.join("lib")
end
@@ -167,13 +201,25 @@ module Spec
tmp "tmpdir", *args
end
- def replace_version_file(version, dir: root)
+ def replace_version_file(version, dir: source_root)
version_file = File.expand_path("lib/bundler/version.rb", dir)
contents = File.read(version_file)
contents.sub!(/(^\s+VERSION\s*=\s*)"#{Gem::Version::VERSION_PATTERN}"/, %(\\1"#{version}"))
File.open(version_file, "w") {|f| f << contents }
end
+ def replace_build_metadata(build_metadata, dir: source_root)
+ build_metadata_file = File.expand_path("lib/bundler/build_metadata.rb", dir)
+
+ ivars = build_metadata.sort.map do |k, v|
+ " @#{k} = #{loaded_gemspec.send(:ruby_code, v)}"
+ end.join("\n")
+
+ contents = File.read(build_metadata_file)
+ contents.sub!(/^(\s+# begin ivars).+(^\s+# end ivars)/m, "\\1\n#{ivars}\n\\2")
+ File.open(build_metadata_file, "w") {|f| f << contents }
+ end
+
def ruby_core?
# avoid to warnings
@ruby_core ||= nil
@@ -185,6 +231,29 @@ module Spec
end
end
+ private
+
+ def git_ls_files(glob)
+ skip "not in git working directory" unless git_root_dir?
+ sys_exec("git ls-files -z -- #{glob}", :dir => source_root).split("\x0")
+ end
+
+ def tracked_files_glob
+ ruby_core? ? "lib/bundler lib/bundler.rb spec/bundler man/bundle*" : ""
+ end
+
+ def shipped_files_glob
+ ruby_core? ? "lib/bundler lib/bundler.rb man/bundle* man/gemfile* libexec/bundle*" : "lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec"
+ end
+
+ def lib_tracked_files_glob
+ ruby_core? ? "lib/bundler lib/bundler.rb" : "lib"
+ end
+
+ def man_tracked_files_glob
+ ruby_core? ? "man/bundle* man/gemfile*" : "man"
+ end
+
extend self
end
end
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index 2aaf072715..d13567d7af 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -2,7 +2,7 @@
require_relative "path"
-$LOAD_PATH.unshift(Spec::Path.lib_dir.to_s)
+$LOAD_PATH.unshift(Spec::Path.source_lib_dir.to_s)
module Spec
module Rubygems
@@ -59,7 +59,8 @@ module Spec
ENV["BUNDLE_PATH"] = nil
ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
- ENV["PATH"] = [Path.bindir, Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
+ ENV["PATH"] = [Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
+ ENV["PATH"] = [Path.bindir, ENV["PATH"]].join(File::PATH_SEPARATOR) if Path.ruby_core?
end
def install_test_deps
@@ -103,16 +104,13 @@ module Spec
require "bundler"
definition = Bundler::Definition.build(gemfile, lockfile, nil)
definition.validate_runtime!
- Bundler::Installer.install(Path.root, definition, :path => ENV["GEM_HOME"])
+ Bundler::Installer.install(Path.source_root, definition, :path => ENV["GEM_HOME"])
ensure
ENV["BUNDLE_GEMFILE"] = old_gemfile
end
def test_gemfile
- gemfile = Path.root.join("test_gems.rb")
- # for Ruby core repository
- gemfile = Path.root.join("tool/bundler/test_gems.rb") unless File.exist?(gemfile)
- gemfile
+ Path.test_gemfile
end
def test_lockfile
@@ -120,7 +118,7 @@ module Spec
end
def dev_gemfile
- Path.root.join("dev_gems.rb")
+ Path.dev_gemfile
end
def dev_lockfile
diff --git a/spec/bundler/support/rubygems_version_manager.rb b/spec/bundler/support/rubygems_version_manager.rb
index aa4cfc460b..a74cb64337 100644
--- a/spec/bundler/support/rubygems_version_manager.rb
+++ b/spec/bundler/support/rubygems_version_manager.rb
@@ -96,7 +96,7 @@ private
def resolve_local_copy_path
return expanded_source if source_is_path?
- rubygems_path = root.join("tmp/rubygems")
+ rubygems_path = source_root.join("tmp/rubygems")
unless rubygems_path.directory?
rubygems_path.parent.mkpath
@@ -111,7 +111,7 @@ private
end
def expanded_source
- @expanded_source ||= Pathname.new(@source).expand_path(root)
+ @expanded_source ||= Pathname.new(@source).expand_path(source_root)
end
def resolve_target_tag
diff --git a/spec/bundler/support/switch_rubygems.rb b/spec/bundler/support/switch_rubygems.rb
index d3dd685d31..a138d22333 100644
--- a/spec/bundler/support/switch_rubygems.rb
+++ b/spec/bundler/support/switch_rubygems.rb
@@ -2,13 +2,3 @@
require_relative "rubygems_version_manager"
RubygemsVersionManager.new(ENV["RGV"]).switch
-
-if ENV["BUNDLER_SPEC_IGNORE_DEFAULT_BUNDLER_GEM"]
- module NoBundlerStubs
- def default_stubs(pattern = "*.gemspec")
- super(pattern).reject {|s| s.name == "bundler" }
- end
- end
-
- Gem::Specification.singleton_class.prepend(NoBundlerStubs)
-end