diff options
author | Homu <homu@barosl.com> | 2016-05-29 14:10:12 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-05-29 14:10:12 +0900 |
commit | 074ec03ab135e834f6f4ef0a7c27baf1e49dd2df (patch) | |
tree | 9ea09c0c8dcdf7a77b82407caea16d6bd6f13052 | |
parent | 7374a01a74bf7ee85619248db48504bc5ce3849e (diff) | |
parent | b77095499c99a99ac1e7fa42b2f06f23b80f4b22 (diff) | |
download | bundler-074ec03ab135e834f6f4ef0a7c27baf1e49dd2df.tar.gz |
Auto merge of #4610 - b-ggs:binstub-standalone, r=RochesterinNYC
Add standalone flag to binstubs
Add `--standalone` flag to `binstubs`
Fix #4594
@RochesterinNYC @segiddins
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/binstubs.rb | 2 | ||||
-rw-r--r-- | spec/commands/binstubs_spec.rb | 16 |
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index f2af5d71f7..fe510d1734 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -229,6 +229,8 @@ module Bundler "Overwrite existing binstubs if they exist" method_option "path", :type => :string, :lazy_default => "bin", :banner => "Binstub destination directory (default bin)" + method_option "standalone", :type => :array, :lazy_default => [], :banner => + "Make binstubs that can work without the Bundler runtime" def binstubs(*gems) require "bundler/cli/binstubs" Binstubs.new(options, gems).run diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb index 8452ca3bfe..e8982e90b4 100644 --- a/lib/bundler/cli/binstubs.rb +++ b/lib/bundler/cli/binstubs.rb @@ -29,6 +29,8 @@ module Bundler if spec.name == "bundler" Bundler.ui.warn "Sorry, Bundler can only be run via Rubygems." + elsif options[:standalone] + installer.generate_standalone_bundler_executable_stubs(spec) 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 ee319e016c..338f07100a 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -145,6 +145,22 @@ describe "bundle binstubs <gem>" do end end + context "after installing with --standalone" do + before do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G + bundle "install --standalone" + end + + it "includes the standalone path" do + bundle "binstubs rack --standalone" + 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', __FILE__" + end + end + context "when the bin already exists" do it "doesn't overwrite and warns" do FileUtils.mkdir_p(bundled_app("bin")) |