summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-06-14 16:32:56 -0700
committerSamuel Giddins <segiddins@segiddins.me>2016-06-21 09:10:06 -0500
commit13bd2b43f33abda2762e7e668e1fc9248e4fb928 (patch)
tree4670437915136437fa555f2df3da74e02d23fa67 /Rakefile
parent7332185811d77a51cc228d7e18ccbe4f5e553f3a (diff)
downloadbundler-13bd2b43f33abda2762e7e668e1fc9248e4fb928.tar.gz
Change Rakefile to work as a submodule
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile27
1 files changed, 18 insertions, 9 deletions
diff --git a/Rakefile b/Rakefile
index 9bc34e4177..09c27f9979 100644
--- a/Rakefile
+++ b/Rakefile
@@ -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