Creates a gem with name,version and deps. The
specification will be yielded before gem creation for customization. The
gem will be placed in File.join
@tempdir, 'gems'. The specification and .gem file location are
returned.
# File lib/rubygems/test_case.rb, line 517
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|
deps.each do |n, req|
s.add_dependency n, (req || '>= 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