Sha256: 0dbcda3ef0c660d77c4ef2e905d4b1460798af98ebc3a76c24adc30eb61d0065

Contents?: true

Size: 1.34 KB

Versions: 23

Compression:

Stored size: 1.34 KB

Contents

# this is a temporary workaround until rubygems Does the Right thing here
require 'rubygems'
module Gem
  class SourceIndex

    # This is resolved in 1.1
    if Version.new(RubyGemsVersion) < Version.new("1.1")

      # Overwrite this so that a gem of the same name and version won't push one
      # from the gems directory out entirely.
      #
      # @param gem_spec<Gem::Specification> The specification of the gem to add.
      def add_spec(gem_spec)
        unless gem_spec.instance_variable_get("@loaded_from") &&
          @gems[gem_spec.full_name].is_a?(Gem::Specification) &&
          @gems[gem_spec.full_name].installation_path ==
            File.join(defined?(Merb) && Merb.respond_to?(:root) ? Merb.root : Dir.pwd,"gems")

          @gems[gem_spec.full_name] = gem_spec
        end
      end

    end

  end

  class Specification

    # Overwrite this so that gems in the gems directory get preferred over gems
    # from any other location. If there are two gems of different versions in
    # the gems directory, the later one will load as usual.
    #
    # @return <Array[Array]> The object used for sorting gem specs.
    def sort_obj
      [@name, installation_path == File.join(defined?(Merb) && Merb.respond_to?(:root) ? Merb.root : Dir.pwd,"gems") ? 1 : -1, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1]
    end
  end
end

Version data entries

23 entries across 23 versions & 6 rubygems

Version Path
quickbooks-1.0.2 lib/quickbooks/extlib/rubygems.rb
quickbooks-0.9.9 lib/quickbooks/extlib/rubygems.rb
ginst-2009.12.8 vendor/gems/extlib-0.9.13/lib/extlib/rubygems.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
ginst-2009.11.24 vendor/gems/extlib-0.9.13/lib/extlib/rubygems.rb
ginst-2009.11.23 vendor/gems/extlib-0.9.13/lib/extlib/rubygems.rb
rango-0.0.6 vendor/extlib/lib/extlib/rubygems.rb
rango-0.1.pre vendor/extlib/lib/extlib/rubygems.rb
middleman-0.10.17 vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
middleman-0.10.16 vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
middleman-0.10.15 vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
middleman-0.10.14 vendor/gems/gems/extlib-0.9.13/lib/extlib/rubygems.rb
ginst-2.0.1 vendor/gems/extlib-0.9.13/lib/extlib/rubygems.rb
ginst-2.0.0 vendor/gems/extlib-0.9.13/lib/extlib/rubygems.rb
extlib-0.9.13 lib/extlib/rubygems.rb
extlib-0.9.12 lib/extlib/rubygems.rb
extlib-0.9.10 lib/extlib/rubygems.rb
extlib-0.9.11 lib/extlib/rubygems.rb