What object processes new Gem::Specification objects?

57 Views Asked by At

What object/process picks up a newly created Specification object when running gem build against a typical gemspec file?

For instance, suppose we have mynewgem.gemspec with contents as follows:

Gem::Specification.new do |s|
  s.name = "mynewgem"
  s.version = "0.0.1"
  s.summary = "here is a summary"
  s.description = "here is a desc"
  s.authors = ["Full Name"]
  s.email = "[email protected]"
  s.files = Dir.glob("lib/**/*", File::FNM_DOTMATCH)
  s.homepage = "https://rubygems.org/gems/mynewgem"
  s.license = "My License"

  s.add_dependency "this-dependency", "~> 1.2.3"
  s.add_dependency "that-dependency", "~> 4.5.6"
end

What class/method is referencing the newly created Gem::Specification object here? It's obviously not directly assigned to a variable in mynewgem.gemspec. How does whatever sees this new object actually see/reference it?

1

There are 1 best solutions below

1
Jared Beck On BEST ANSWER

What object/process picks up [the] newly created Specification object when running gem build against a typical gemspec file?

Please see Gem::Commands::BuildCommand#build_package

# rubygems/commands/build_command.rb
def build_package(gemspec)
  spec = Gem::Specification.load(gemspec)
  if spec
    Gem::Package.build(
      # etc ...