def util_gem(name, version, deps = nil, &block)
    # TODO: deprecate
    raise "deps or block, not both" if deps and block

    if deps then
      block = proc do |s|
        # Since Hash#each is unordered in 1.8, sort
        # the keys and iterate that way so the tests are
        # deteriminstic on all implementations.
        deps.keys.sort.each do |n|
          s.add_dependency n, (deps[n] || '>= 0')
        end
      end
    end

    spec = quick_gem(name, version, &block)

    util_build_gem spec

    cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
    FileUtils.mkdir_p File.dirname cache_file
    FileUtils.mv spec.cache_file, cache_file
    FileUtils.rm spec.spec_file

    spec.loaded_from = nil

    [spec, cache_file]
  end
#
Creates a gem with +name+, +version+ and +deps+.  The specification will
be yielded before gem creation for customization.  The gem will be placed
in <tt>File.join @tempdir, 'gems'</tt>.  The specification and .gem file
location are returned.