When using --standalone, place the setup.rb file relative to the gem install path, rather than the working directory #1645

Closed
wants to merge 1 commit into
from
@@ -124,8 +124,9 @@ def generate_standalone_bundler_executable_stubs(spec)
end
def generate_standalone(groups)
- standalone_path = Bundler.settings[:path]
- bundler_path = File.join(standalone_path, "bundler")
+ bundler_path = File.expand_path(File.join(Bundler.rubygems.gem_path, "..", "..", "bundler"))
+ bundler_setup_file = File.join(bundler_path, "setup.rb")
+ Bundler.ui.debug "Generating standlone include file #{bundler_setup_file}"
FileUtils.mkdir_p(bundler_path)
paths = []
@@ -145,8 +146,7 @@ def generate_standalone(groups)
end
end
-
- File.open File.join(bundler_path, "setup.rb"), "w" do |file|
+ File.open bundler_setup_file, "w" do |file|
file.puts "path = File.expand_path('..', __FILE__)"
paths.each do |path|
file.puts %{$:.unshift File.expand_path("\#{path}/#{path}")}