The letter A styled as Alchemists logo. lchemists
Published January 29, 2022 Updated October 1, 2023
Spek Icon



Spek is short for specification and enhances Ruby gem specifications with additional information and tooling. You can use this library as foundational support to build on top of with your own enhancements.


  • Supports finding gems by name.

  • Supports loading gems by path to specification.

  • Supports picking gems by name with optional version selection.

  • Supports semantic versions via Versionaire.


  1. Ruby.


To set up the project, run:



This gem makes interacting with Ruby gems easier by providing foundational objects for which you can built on top of. Gemsmith is built on top of this gem if you need working example.


This object wraps the Gem::Specification for presentation purposes, provides semantic versioning, direct access to metadata information, pathnames, and other enriched information. You can obtain an instance using the following code, for example:

specification = do |spec| = "demo"
  spec.version = "0.0.0"
  spec.authors = ["Jill Smith"] = [""]
  spec.homepage = ""
  spec.summary = "A demo summary."
  spec.license = "Hippocratic-2.1"

  spec.signing_key = Gem.default_key_path
  spec.cert_chain = [Gem.default_cert_path]

  spec.metadata = {
    "bug_tracker_uri" => "",
    "changelog_uri" => "",
    "documentation_uri" => "",
    "funding_uri" => "",
    "label" => "Demo",
    "rubygems_mfa_required" => "true",
    "source_code_uri" => ""

presenter = specification

presenter.allowed_push_host  # ""
presenter.allowed_push_key   # "rubygems_api_key"
presenter.authors            # ["Jill Smith"]
presenter.banner             # "Demo 0.0.0: A demo summary."
presenter.certificate_chain  # [#<Pathname:~/.gem/gem-public_cert.pem>]
presenter.documentation_url  # ""
presenter.emails             # [""]
presenter.funding_url        # ""
presenter.homepage_url       # ""
presenter.issues_url         # ""
presenter.label              # "Demo"
presenter.labeled_summary    # "Demo: A demo summary."
presenter.labeled_version    # "Demo 0.0.0"
presenter.named_version      # "demo 0.0.0"
presenter.package_name       # "demo-0.0.0.gem"
presenter.package_path       # #<Pathname:tmp/demo-0.0.0.gem>
presenter.rubygems_mfa?      # true
presenter.signing_key        # #<Pathname:~/.gem/gem-private_key.pem>
presenter.source_path        # #<Pathname:~/.cache/.../3.2.0/gems/demo-0.0.0>
presenter.source_url         # ""
presenter.version            # #<struct Versionaire::Version major=0, minor=0, patch=0>
presenter.versions_url       # ""

The presenter is a read-only object so you’ll only have access to getter methods which are mostly documented here. Please note that not all methods map one-to-one so you’ll want to look at the public API of this object for further details.


When given a path to a gem specification file, the loader will load a gem specification for you. Example:

presenter = "path/to/my/test.gemspec"
presenter.class  # Spek::Presenter


The finder will find all gem specifications for a given name. Example:

presenters = "refinements"  # [Spek::Presenter]


When given a gem name, this will allow you pick from a list of gem versions if any. Otherwise, if multiple versions don’t exist, the first version found will be answered instead. Example:

require "dry/monads"

include Dry::Monads[:result]

  in Success(specification) then puts "You selected: #{}."
  in Failure(error) then puts error

The picker always answers a monad so you can quickly pattern match for further action.


When given a version and path, the versioner will update the version of your gem specification. Example:

specification = "1.0.0", "path/to/my/test.gemspec"
specification.version  # <struct Versionaire::Version major=1, minor=0, patch=0>

This makes it easier to automate the updating of your gem specification version information.


To contribute, run:

git clone
cd spek

You can also use the IRB console for direct access to all objects:



To test, run: