summaryrefslogtreecommitdiff
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
parent7332185811d77a51cc228d7e18ccbe4f5e553f3a (diff)
downloadbundler-13bd2b43f33abda2762e7e668e1fc9248e4fb928.tar.gz
Change Rakefile to work as a submodule
-rw-r--r--Rakefile27
-rw-r--r--spec/runtime/setup_spec.rb1
2 files changed, 19 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
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 14377ed17e..aa74d83ba4 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}/, "") }