summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Lowell <cowboyd@thefrontside.net>2011-12-12 22:36:33 -0600
committerCharles Lowell <cowboyd@thefrontside.net>2011-12-12 22:36:33 -0600
commit7a4337971f805bc10c0a60015d358f613d56b220 (patch)
tree98253109b4a4728d2cd33bbf663ba85ca8fa95ad
parentda6d698afc6fbe4c4585831e372ac9437f986162 (diff)
downloadbundler-7a4337971f805bc10c0a60015d358f613d56b220.tar.gz
make executable stub runnable from anywhere not just its parent directory.
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--lib/bundler/templates/Executable.standalone2
-rw-r--r--spec/install/gems/standalone_spec.rb8
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index b00dfa6dab..f8a7e767af 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -116,7 +116,7 @@ module Bundler
spec.executables.each do |executable|
next if executable == "bundle"
standalone_path = Pathname(Bundler.settings[:path]).expand_path.relative_path_from(bin_path)
- executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(Bundler.root)
+ executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
File.open "#{bin_path}/#{executable}", 'w', 0755 do |f|
f.puts ERB.new(template, nil, '-').result(binding)
end
diff --git a/lib/bundler/templates/Executable.standalone b/lib/bundler/templates/Executable.standalone
index d9378d253f..c4f2703495 100644
--- a/lib/bundler/templates/Executable.standalone
+++ b/lib/bundler/templates/Executable.standalone
@@ -9,4 +9,4 @@
$:.unshift File.expand_path '../<%= standalone_path %>', __FILE__
require 'bundler/setup'
-load '<%= executable_path %>'
+load File.expand_path '../<%= executable_path %>', __FILE__
diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb
index 9a47f6108a..9e3ad402f9 100644
--- a/spec/install/gems/standalone_spec.rb
+++ b/spec/install/gems/standalone_spec.rb
@@ -245,10 +245,16 @@ describe "bundle install --standalone" do
end
it "creates stubs that use the standalone load path" do
- should_be_installed "actionpack 2.3.2", "rails 2.3.2"
Dir.chdir(bundled_app) do
`bin/rails -v`.chomp.should eql "2.3.2"
end
end
+
+ it "creates stubs that can be executed from anywhere" do
+ require 'tmpdir'
+ Dir.chdir(Dir.tmpdir) do
+ `#{bundled_app}/bin/rails -v`.chomp.should eql "2.3.2"
+ end
+ end
end
end