diff options
author | Terence Lee <hone02@gmail.com> | 2012-12-27 22:05:12 -0500 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2012-12-27 22:05:12 -0500 |
commit | dd11095592351c6c8b6f0f7866f4f1d80ebda60f (patch) | |
tree | 99aed92174081b8958a5491b9af42cca9bf1026c | |
parent | 17561867460054a6dabf112b14387c2f8313a086 (diff) | |
download | bundler-dd11095592351c6c8b6f0f7866f4f1d80ebda60f.tar.gz |
bundle binstubs --binstubs
-rw-r--r-- | lib/bundler/cli.rb | 8 | ||||
-rw-r--r-- | spec/other/binstubs_spec.rb | 26 |
2 files changed, 32 insertions, 2 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 364faa1f..c26fe1f2 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -336,10 +336,14 @@ module Bundler This command will install bundler generated binstubs of the [GEM] specified in the bin directory specified by --binstubs or the default location. D + method_option "binstubs", :type => :string, :lazy_default => "bin", :banner => + "Generate bin stubs for bundled gems to ./bin" def binstubs(gem_name) Bundler.definition.validate_ruby! - installer = Installer.new(Bundler.root, Bundler.definition) - spec = installer.specs.find{|s| s.name == gem_name } + Bundler.settings[:bin] = options["binstubs"] if options["binstubs"] + Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty? + installer = Installer.new(Bundler.root, Bundler.definition) + spec = installer.specs.find{|s| s.name == gem_name } raise GemNotFound, not_found_message(name, Bundler.load.specs) unless spec installer.generate_bundler_executable_stubs(spec) diff --git a/spec/other/binstubs_spec.rb b/spec/other/binstubs_spec.rb index 4faabaf2..faab6c0a 100644 --- a/spec/other/binstubs_spec.rb +++ b/spec/other/binstubs_spec.rb @@ -66,4 +66,30 @@ describe "bundle binstubs <gem>" do expect(bundled_app("bin/foo")).to exist end end + + context "--binstubs" do + it "sets the binstubs dir" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G + + bundle "binstubs rack --binstubs exec" + + expect(bundled_app("exec/rackup")).to exist + end + + it "setting is saved for bundle install" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + gem "rails" + G + + bundle "binstubs rack --binstubs exec" + bundle :install + + expect(bundled_app("exec/rails")).to exist + end + end end |