Sha256: 816e844a2b879f2096240ef97e50213a5f18a1ad999c7502b7d0f87605fdd6ed

Contents?: true

Size: 1.56 KB

Versions: 26

Compression:

Stored size: 1.56 KB

Contents

module Bundler
  class Runtime
    private
    def autorequires_for_groups(*groups)
      groups.map! { |g| g.to_sym }
      autorequires = Hash.new { |h,k| h[k] = [] }
    
      # ----- PATCH -----
    
      # ORIGINAL METHOD - unfortunately inside out
      # ordered_deps = []
      # specs_for(*groups).each do |g|
      #   dep = @definition.dependencies.find{|d| d.name == g.name }        
      #   ordered_deps << dep if dep && !ordered_deps.include?(dep)
      # end
    
      # NEW METHOD
      ordered_deps = []
      begin # this is done because of an api change between 0.9.10 and 0.9.15
        spec_names = specs_for(*groups).map { |s| s.name }
      rescue
        spec_names = specs_for(groups).map { |s| s.name }
      end
      @definition.dependencies.each do |dep|
        ordered_deps << dep if spec_names.include?(dep.name) && !ordered_deps.include?(dep)
      end

      # DEBUG: verify that ordered_deps are in gem file specification order
      # p ordered_deps.map { |d| d.name }
    
      # ----- /PATCH -----

      ordered_deps.each do |dep|
        dep.groups.each do |group|
          # If there is no autorequire, then rescue from
          # autorequiring the gems name
          if dep.autorequire
            dep.autorequire.each do |file|
              autorequires[group] << [file, true]
            end
          else
            autorequires[group] << [dep.name, false]
          end
        end
      end

      if groups.empty?
        autorequires
      else
        groups.inject({}) { |h,g| h[g] = autorequires[g]; h }
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
vj-sdk-0.8.2 lib/bundler_runtime_patch.rb
vj-sdk-0.8.0.1 lib/bundler_runtime_patch.rb
vj-sdk-0.7.14 lib/bundler_runtime_patch.rb
vj-sdk-0.7.13 lib/bundler_runtime_patch.rb
vj-sdk-0.7.11 lib/bundler_runtime_patch.rb
vj-sdk-0.7.10 lib/bundler_runtime_patch.rb
vj-sdk-0.7.9 lib/bundler_runtime_patch.rb
vj-sdk-0.7.8 lib/bundler_runtime_patch.rb
vj-sdk-0.7.7 lib/bundler_runtime_patch.rb
vj-sdk-0.7.6 lib/bundler_runtime_patch.rb
vj-sdk-0.7.5 lib/bundler_runtime_patch.rb
vj-sdk-0.7.4 lib/bundler_runtime_patch.rb
vj-sdk-0.7.3 lib/bundler_runtime_patch.rb
vj-sdk-0.7.2 lib/bundler_runtime_patch.rb
vj-sdk-0.7.1 lib/bundler_runtime_patch.rb
vj-sdk-0.7.0 lib/bundler_runtime_patch.rb
vj-sdk-0.6.9 lib/bundler_runtime_patch.rb
vj-sdk-0.6.8 lib/bundler_runtime_patch.rb
vj-sdk-0.6.7 lib/bundler_runtime_patch.rb
vj-sdk-0.6.5 lib/bundler_runtime_patch.rb