summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-08-26 23:47:09 +1000
committerColby Swandale <colby@taplaboratories.com>2017-08-26 23:47:09 +1000
commit3861a04f1f7fd45be5d992b1432eba9e5bcfaf58 (patch)
treec2c0dc28b07619ea1e418884ffe49824f9726137
parent1354254cd19fc63e6ec49e98ed72b4bcad31ea4b (diff)
downloadbundler-colby/bundler-binstubs-standalone.tar.gz
fix breaking binstubs standalone flagcolby/bundler-binstubs-standalone
Also move the bundler-install standalone flag tests into the the bundle install tests
-rw-r--r--lib/bundler/cli/binstubs.rb4
-rw-r--r--spec/commands/binstubs_spec.rb25
-rw-r--r--spec/commands/install_spec.rb17
3 files changed, 37 insertions, 9 deletions
diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb
index acec5741b7..1869eee628 100644
--- a/lib/bundler/cli/binstubs.rb
+++ b/lib/bundler/cli/binstubs.rb
@@ -33,7 +33,9 @@ module Bundler
if options[:standalone]
next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
- installer.generate_standalone_bundler_executable_stubs(spec)
+ Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
+ installer.generate_standalone_bundler_executable_stubs(spec)
+ end
else
installer.generate_bundler_executable_stubs(spec, :force => options[:force], :binstubs_cmd => true)
end
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index fa44928625..3655730a43 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -263,20 +263,29 @@ RSpec.describe "bundle binstubs <gem>" do
end
end
- context "after installing with --standalone" do
+ context "with --standalone option" do
before do
- install_gemfile! <<-G
+ install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
- forgotten_command_line_options(:path => "bundle")
- bundle! "install", :standalone => true
end
- it "includes the standalone path" do
- bundle! "binstubs rack", :standalone => true
- standalone_line = File.read(bundled_app("bin/rackup")).each_line.find {|line| line.include? "$:.unshift" }.strip
- expect(standalone_line).to eq %($:.unshift File.expand_path "../../bundle", path.realpath)
+ it "generates a standalone binstub" do
+ bundle! "binstubs rack --standalone"
+ expect(bundled_app("bin/rackup")).to exist
+ end
+
+ it "generates a binstub that does not depend on rubygems or bundler" do
+ bundle! "binstubs rack --standalone"
+ expect(File.read(bundled_app("bin/rackup"))).to_not include("Gem.bin_path")
+ end
+
+ context "when specified --path option" do
+ it "generates a standalone binstub at the given path" do
+ bundle! "binstubs rack --standalone --path foo"
+ expect(bundled_app("foo/rackup")).to exist
+ end
end
end
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb
index 7370c27c25..4cb8584633 100644
--- a/spec/commands/install_spec.rb
+++ b/spec/commands/install_spec.rb
@@ -502,6 +502,23 @@ RSpec.describe "bundle install with gem sources" do
end
end
+ context "after installing with --standalone" do
+ before do
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ forgotten_command_line_options(:path => "bundle")
+ bundle! "install", :standalone => true
+ end
+
+ it "includes the standalone path" do
+ bundle! "binstubs rack", :standalone => true
+ standalone_line = File.read(bundled_app("bin/rackup")).each_line.find {|line| line.include? "$:.unshift" }.strip
+ expect(standalone_line).to eq %($:.unshift File.expand_path "../../bundle", path.realpath)
+ end
+ end
+
describe "when bundle install is executed with unencoded authentication" do
before do
gemfile <<-G