diff options
author | Homu <homu@barosl.com> | 2016-06-22 04:47:36 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-06-22 04:47:36 +0900 |
commit | 958d78f9caceb9aeb152bd0c52b1df2ed86eefc5 (patch) | |
tree | aba4189e52b13905a38917674649b2ed3299fe7b | |
parent | 7332185811d77a51cc228d7e18ccbe4f5e553f3a (diff) | |
parent | d492047839c3714613a32f9be32ab3b3817539e7 (diff) | |
download | bundler-958d78f9caceb9aeb152bd0c52b1df2ed86eefc5.tar.gz |
Auto merge of #4694 - bundler:seg-rubygems-merger, r=indirect
Change Rakefile to work as a RubyGems submodule
-rw-r--r-- | Rakefile | 27 | ||||
-rw-r--r-- | lib/bundler/postit_trampoline.rb | 7 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 1 |
3 files changed, 24 insertions, 11 deletions
@@ -4,7 +4,12 @@ $:.unshift File.expand_path("../lib", __FILE__) require "shellwords" require "benchmark" -RUBYGEMS_REPO = File.expand_path("tmp/rubygems") +RUBYGEMS_REPO = if `cd .. && git remote --verbose` =~ /rubygems/i + File.expand_path("..") +else + File.expand_path("tmp/rubygems") +end + BUNDLER_SPEC = Gem::Specification.load("bundler.gemspec") def safe_task(&block) @@ -142,18 +147,22 @@ begin end hash = nil - Dir.chdir(RUBYGEMS_REPO) do - system("git remote update") - if rg == "master" - system("git checkout origin/master") - else - system("git checkout #{rg}") || raise("Unknown Rubygems ref #{rg}") + if RUBYGEMS_REPO.start_with?(Dir.pwd) + Dir.chdir(RUBYGEMS_REPO) do + system("git remote update") + if rg == "master" + system("git checkout origin/master") + else + system("git checkout #{rg}") || raise("Unknown Rubygems ref #{rg}") + end + hash = `git rev-parse HEAD`.chomp end - hash = `git rev-parse HEAD`.chomp + elsif rg != "master" + raise "need to be running against master with bundler as a submodule" end puts "Checked out rubygems '#{rg}' at #{hash}" - ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}" + ENV["RUBYOPT"] = "-I#{File.join(RUBYGEMS_REPO, "lib")} #{rubyopt}" puts "RUBYOPT=#{ENV["RUBYOPT"]}" end diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb index 7406612e..50bfee66 100644 --- a/lib/bundler/postit_trampoline.rb +++ b/lib/bundler/postit_trampoline.rb @@ -29,9 +29,12 @@ The error was: #{e} EOS end - Gem.loaded_specs.delete("bundler") unless defined?(Bundler) + if deleted_spec = Gem.loaded_specs.delete("bundler") + deleted_spec.full_require_paths.each {|path| $:.delete(path) } + else + $:.delete(File.expand_path("../..", __FILE__)) + end gem "bundler", version - $:.delete(File.expand_path("../..", __FILE__)) else begin gem "bundler", version diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 14377ed1..aa74d83b 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -151,6 +151,7 @@ describe "Bundler.setup" do bundler_path.to_s, bundler_path.join("gems/bundler-#{Bundler::VERSION}/lib").to_s, tmp("rubygems/lib").to_s, + root.join("../lib").expand_path.to_s, ] load_path.map! {|lp| lp.sub(/^#{system_gem_path}/, "") } |