def add_dependency_with_type(dependency, type, *requirements)
    requirements = if requirements.empty? then
                     Gem::Requirement.default
                   else
                     requirements.flatten
                   end

    unless dependency.respond_to?(:name) &&
      dependency.respond_to?(:version_requirements)

      dependency = Gem::Dependency.new(dependency, requirements, type)
    end

    dependencies << dependency
  end
#
Adds a dependency on gem +dependency+ with type +type+ that requires
+requirements+.  Valid types are currently <tt>:runtime</tt> and
<tt>:development</tt>.