method

find_spec_for_exe

v2_6_3 - Show latest stable - Class: Gem
find_spec_for_exe(name, exec_name, requirements)
private

No documentation available.

# File lib/rubygems.rb, line 265
  def self.find_spec_for_exe(name, exec_name, requirements)
    dep = Gem::Dependency.new name, requirements

    loaded = Gem.loaded_specs[name]

    return loaded if loaded && dep.matches_spec?(loaded)

    specs = dep.matching_specs(true)

    specs = specs.find_all { |spec|
      spec.executables.include? exec_name
    } if exec_name

    unless spec = specs.first
      msg = "can't find gem #{dep} with executable #{exec_name}"
      if name == "bundler" && bundler_message = Gem::BundlerVersionFinder.missing_version_message
        msg = bundler_message
      end
      raise Gem::GemNotFoundException, msg
    end

    spec
  end