diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-10-16 11:34:40 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-10-20 19:59:02 +0900 |
commit | 94f664fc4c55441736aa173b57b1bad6d7ef761d (patch) | |
tree | 14456155f6b45db485ef86c513693568a16c240f | |
parent | 74f142be8c322e035ae52894d4ea4166ffb93fbf (diff) | |
download | bundler-94f664fc4c55441736aa173b57b1bad6d7ef761d.tar.gz |
Support file structure of ruby core repository.
-rw-r--r-- | bundler.gemspec | 8 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 16 |
2 files changed, 19 insertions, 5 deletions
diff --git a/bundler.gemspec b/bundler.gemspec index d04bf34e7c..c004de0965 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -1,7 +1,13 @@ # coding: utf-8 # frozen_string_literal: true -require File.expand_path("../lib/bundler/version", __FILE__) +begin + require File.expand_path("../lib/bundler/version", __FILE__) +rescue LoadError + # for Ruby core repository + require File.expand_path("../bundler/version", __FILE__) +end + require "shellwords" Gem::Specification.new do |s| diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index dca17885dd..c4dce8c38f 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -274,8 +274,14 @@ module Bundler until !File.directory?(current) || current == previous if ENV["BUNDLE_SPEC_RUN"] + if File.file?(File.join(current, "bundler.gemspec")) + gemspec = "bundler.gemspec" + else + # for Ruby Core + gemspec = "lib/bundler.gemspec" + end # avoid stepping above the tmp directory when testing - return nil if File.file?(File.join(current, "bundler.gemspec")) + return nil if File.file?(File.join(current, gemspec)) end names.each do |name| @@ -304,10 +310,12 @@ module Bundler unless File.exist?(exe_file) exe_file = File.expand_path("../../../exe/bundle", __FILE__) end - - Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file rescue Gem::GemNotFoundException - Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", File.expand_path("../../../exe/bundle", __FILE__) + exe_file = File.expand_path("../../../exe/bundle", __FILE__) + # for Ruby core repository + exe_file = File.expand_path("../../../../bin/bundle", __FILE__) unless File.exist?(exe_file) + ensure + Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file end # Set BUNDLE_GEMFILE |