method

load_specs

Importance_0
v2_1_10 - Show latest stable - 0 notes - Class: Local
load_specs(type) public

No documentation

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

Hide source
# File lib/rubygems/source/local.rb, line 35
  def load_specs type # :nodoc:
    names = []

    @specs = {}

    Dir["*.gem"].each do |file|
      begin
        pkg = Gem::Package.new(file)
      rescue SystemCallError, Gem::Package::FormatError
        # ignore
      else
        tup = pkg.spec.name_tuple
        @specs[tup] = [File.expand_path(file), pkg]

        case type
        when :released
          unless pkg.spec.version.prerelease?
            names << pkg.spec.name_tuple
          end
        when :prerelease
          if pkg.spec.version.prerelease?
            names << pkg.spec.name_tuple
          end
        when :latest
          tup = pkg.spec.name_tuple

          cur = names.find { |x| x.name == tup.name }
          if !cur
            names << tup
          elsif cur.version < tup.version
            names.delete cur
            names << tup
          end
        else
          names << pkg.spec.name_tuple
        end
      end
    end

    names
  end
Register or log in to add new notes.