fetch (Gem::SpecFetcher)

    # File lib/generators/templates/application/common/merb_thor/gem_ext.rb, line 81
      def fetch(dependency, all = false, matching_platform = true, prerelease = false)
        idx = Gem::SourceIndex.from_installed_gems

        reqs = dependency.version_requirements.requirements

        if reqs.size == 1 && reqs[0][0] == "="
          dep = idx.search(dependency).sort.last
        end

        if dep
          file = dep.loaded_from.dup
          file.gsub!(/specifications/, "cache")
          file.gsub!(/gemspec$/, "gem")
          spec = ::Gem::Format.from_file_by_path(file).spec
          [[spec, file]]
        else
          old_fetch(dependency, all, matching_platform)
        end
      end