Create a dummy minitest.gemspec for a bundled gem

To use the repository version of bundled gems, we need to build a gem by
"gem build", but the repository of minitest does not include
minitest.gemspec because it uses hoe.

This change creats a dummy minitest.gemspec to pass the CI.
This commit is contained in:
Yusuke Endoh 2023-02-17 12:50:48 +09:00
Родитель 8eaa346620
Коммит 759d23584e
1 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,31 @@ module BundledGem
outdir = File.expand_path(outdir)
gemdir, gemfile = File.split(gemspec)
Dir.chdir(gemdir) do
if gemspec == "gems/src/minitest/minitest.gemspec" && !File.exist?("minitest.gemspec")
# The repository of minitest does not include minitest.gemspec because it uses hoe.
# This creates a dummy gemspec.
File.write("minitest.gemspec", <<END)
Gem::Specification.new do |s|
s.name = "minitest"
s.version = #{ File.read("lib/minitest.rb")[/VERSION = "(.+?)"/, 1].dump }
s.require_paths = ["lib"]
s.authors = ["Ryan Davis"]
s.date = "#{ Time.now.strftime("%Y-%m-%d") }"
s.description = "(dummy gemspec)"
s.email = ["ryand-ruby@zenspider.com"]
s.extra_rdoc_files = ["History.rdoc", "Manifest.txt", "README.rdoc"]
s.files = [#{ Dir.glob("**/*").reject {|s| File.directory?(s) }.map {|s| s.dump }.join(",") }]
s.homepage = "https://github.com/seattlerb/minitest"
s.licenses = ["MIT"]
s.rdoc_options = ["--main", "README.rdoc"]
s.summary = "(dummy gemspec)"
s.add_development_dependency(%q<rdoc>, [">= 4.0", "< 7"])
s.add_development_dependency(%q<hoe>, ["~> 4.0"])
end
END
end
spec = Gem::Specification.load(gemfile)
abort "Failed to load #{gemspec}" unless spec
abort "Unexpected version #{spec.version}" unless spec.version == Gem::Version.new(version)