lib/bundler/cli.rb in bundler-1.3.0.pre.3 vs lib/bundler/cli.rb in bundler-1.3.0.pre.4
- old
+ new
@@ -214,11 +214,12 @@
# Can't use Bundler.settings for this because settings needs gemfile.dirname
Bundler.settings[:path] = nil if opts[:system]
Bundler.settings[:path] = "vendor/bundle" if opts[:deployment]
Bundler.settings[:path] = opts[:path] if opts[:path]
Bundler.settings[:path] ||= "bundle" if opts[:standalone]
- Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
+ Bundler.settings[:bin] = opts["binstubs"] if opts["binstubs"]
+ Bundler.settings[:bin] = nil if opts["binstubs"] && opts["binstubs"].empty?
Bundler.settings[:shebang] = opts["shebang"] if opts[:shebang]
Bundler.settings[:no_prune] = true if opts["no-prune"]
Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
Bundler.settings.without = opts[:without]
Bundler.ui.be_quiet! if opts[:quiet]
@@ -327,9 +328,33 @@
Bundler.ui.info " * #{s.name} (#{s.version}#{s.git_version})"
end
end
end
map %w(list) => "show"
+
+ desc "binstubs [GEM]", "install the binstubs of the listed gem"
+ long_desc <<-D
+ 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 "path", :type => :string, :lazy_default => "bin", :banner =>
+ "the directory to put the binstubs, defaults to ./bin"
+ method_option "force", :type => :boolean, :default => false, :banner =>
+ "forces the writing of a binstub, even if it already exists"
+ def binstubs(gem_name)
+ Bundler.definition.validate_ruby!
+ Bundler.settings[:bin] = options["path"] if options["path"]
+ Bundler.settings[:bin] = nil if options["path"] && options["path"].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
+
+ if spec.name == "bundler"
+ Bundler.ui.warn "Skipping bundler since can't bundle bundler."
+ else
+ installer.generate_bundler_executable_stubs(spec, :force => options[:force])
+ end
+ end
desc "outdated [GEM]", "list installed gems with newer versions available"
long_desc <<-D
Outdated lists the names and versions of gems that have a newer version available
in the given source. Calling outdated with [GEM [GEM]] will only check for newer