vendor/bundler_gem/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb
def replace_bin_path(specs)
      gem_class = (class << Gem ; self ; end)
      gem_class.send(:remove_method, :bin_path)
      gem_class.send(:define_method, :bin_path) do |name, *args|
        exec_name = args.first

        if exec_name == 'bundle'
          return ENV['BUNDLE_BIN_PATH']
        end

        spec = nil

        if exec_name
          spec = specs.find { |s| s.executables.include?(exec_name) }
          spec or raise Gem::Exception, "can't find executable #{exec_name}"
        else
          spec = specs.find  { |s| s.name == name }
          exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
        end

        gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
        gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
        File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
      end
    end
# Used to make bin stubs that are not created by bundler work
# under bundler. The new Gem.bin_path only considers gems in
# +specs+
Used to make bin stubs that are not created by bundler work
under bundler. The new Gem.bin_path only considers gems in
Used to make bin stubs that are not created by bundler work under bundler . The new Gem . bin_path only considers gems in
def replace_bin_path(specs)
      gem_class = (class << Gem ; self ; end)
      gem_class.send(:remove_method, :bin_path)
      gem_class.send(:define_method, :bin_path) do |name, *args|
        exec_name = args.first
        if exec_name == 'bundle'
          return ENV['BUNDLE_BIN_PATH']
        end
        spec = nil
        if exec_name
          spec = specs.find { |s| s.executables.include?(exec_name) }
          spec or raise Gem::Exception, "can't find executable #{exec_name}"
        else
          spec = specs.find  { |s| s.name == name }
          exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
        end
        gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
        gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
        File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
      end
    end
def replace_bin_path ( specs ) gem_class = ( class << Gem ; self ; end ) gem_class . send ( :remove_method , :bin_path ) gem_class . send ( :define_method , :bin_path ) do | name , * args | exec_name = args . first if exec_name == 'bundle' return ENV [ 'BUNDLE_BIN_PATH' ] end spec = nil if exec_name spec = specs . find { | s | s . executables . include? ( exec_name ) } spec or raise Gem :: Exception , "can't find executable #{exec_name}" else spec = specs . find { | s | s . name == name } exec_name = spec . default_executable or raise Gem :: Exception , "no default executable for #{spec.full_name}" end gem_bin = File . join ( spec . full_gem_path , spec . bindir , exec_name ) gem_from_path_bin = File . join ( File . dirname ( spec . loaded_from ) , spec . bindir , exec_name ) File . exist? ( gem_bin ) ? gem_bin : gem_from_path_bin end end
Used to make bin stubs that are not created by bundler work
under bundler.
Used to make bin stubs that are not created by bundler work under bundler .
specs