Flowdock
method

run

Importance_0
v2_6_3 - Show latest stable - 0 notes - Class: Binstubs
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
run() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/bundler/cli/binstubs.rb, line 11
    def run
      Bundler.definition.validate_runtime!
      path_option = options["path"]
      path_option = nil if path_option && path_option.empty?
      Bundler.settings.set_command_option :bin, path_option if options["path"]
      Bundler.settings.set_command_option_if_given :shebang, options["shebang"]
      installer = Installer.new(Bundler.root, Bundler.definition)

      installer_opts = { :force => options[:force], :binstubs_cmd => true }

      if options[:all]
        raise InvalidOption, "Cannot specify --all with specific gems" unless gems.empty?
        @gems = Bundler.definition.specs.map(&:name)
        installer_opts.delete(:binstubs_cmd)
      elsif gems.empty?
        Bundler.ui.error "`bundle binstubs` needs at least one gem to run."
        exit 1
      end

      gems.each do |gem_name|
        spec = Bundler.definition.specs.find {|s| s.name == gem_name }
        unless spec
          raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(
            gem_name, Bundler.definition.specs
          )
        end

        if options[:standalone]
          next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
          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, installer_opts)
        end
      end
    end
Register or log in to add new notes.