Sha256: 2132ead905b2aaf6aaee1b91569f1872fe5e77d951ce123f819048d089596b1a

Contents?: true

Size: 1.37 KB

Versions: 17

Compression:

Stored size: 1.37 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

17 entries across 17 versions & 4 rubygems

Version Path
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/extlib-0.9.8/lib/extlib/rubygems.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/extlib-0.9.8/lib/extlib/rubygems.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/extlib-0.9.8/lib/extlib/rubygems.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/extlib-0.9.8/lib/extlib/rubygems.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/extlib-0.9.8/lib/extlib/rubygems.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/extlib-0.9.8/lib/extlib/rubygems.rb
extlib-0.9.7 lib/extlib/rubygems.rb
extlib-0.9.8 lib/extlib/rubygems.rb
extlib-0.9.5 lib/extlib/rubygems.rb
extlib-0.9.4 lib/extlib/rubygems.rb
extlib-0.9.6 lib/extlib/rubygems.rb
mack-facets-0.8.2 lib/gems/extlib-0.9.8/lib/extlib/rubygems.rb
thorero-0.9.4.3 lib/extlib/rubygems.rb
thorero-0.9.4.1 lib/extlib/rubygems.rb
thorero-0.9.4.2 lib/extlib/rubygems.rb
thorero-0.9.4 lib/extlib/rubygems.rb
thorero-0.9.4.4 lib/extlib/rubygems.rb