ruby / ruby/rubygems

Standardize +requirements+ field from the specification

Open
#1,296 19 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature request
Dominant language
Ruby
Stars
4k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
81

Description

Currently, they are no standards regarding the definition of external dependencies for gems. We have requirements field in the specification that is quite benevolent and as such does not allow to write useful third-party tooling to handle the problem of installing proper header files/libraries on targeted systems.

They are projects like https://github.com/voxik/gem-nice-install that tries to work around it by creating their own specification file, but that's a path that does not scale well.

What I would like to see is a standardize requirements field that would provide a structured information about external system dependencies. Note that on RubyGems part this can be implemented as a guideline, proper installation of those dependencies can be left to external tooling such as gem-nice-install.

My idea is to leverage the requirements field and make it a JSON schema of external dependencies such as:

{ 
  "ruby": {
    "libxml2": {
      "fedora": {
        "22": [
          "libxml2-devel"
        ],
        "default": [
          "libxml2-devel"
        ]
      },
      "ubuntu": {
        "14.04": [
          "libxml2-dev"
        ]
      }
    }
  },
  "java": {

  }
}

The highest level would represent platforms as known from RubyGems (ruby, java, x86-mingw32, ...), then there will be a list of dependencies (official names) with definition of operating systems and their versions which would at last specify the package/port name for a given OS version.

OS identifiers would have to be standardize ideally so they remain the same across all released gems:

fedora, rhel,
opensuse, sles,
ubuntu, debian,
arch,
coreos,
darwin,
gentoo,
nixos,
solaris,
freebsd, openbsd, netbsd,
darwin,
windows

RubyGems part would be to ensure that the requirements field is a valid JSON in the given format with valid identifiers issuing a warning on gem build if not.

Please note that even if one dependency or two will be specified by the author, it might still be enough information on downloading a proper dependency on other systems (Fedora -devel vs Debian -dev sub-packages).

This standardization could enable many Ruby developers to create proper tooling and make installing gems with extensions finally as easy as installing those without. It will also enable us to improve gem-to-rpm conversions (and conversions to other formats) automaticaly with proper dependencies stated. It's something I really miss in current RubyGems.

@drbrain @tenderlove

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RubyGems' requirements field and the gem-build validation entry point, then review the proposed JSON structure and the comment discussion. Determine the agreed schema, platform identifiers, dependency naming rules, and warning behavior. Done means the standard and its validation scope are specified clearly enough for external tooling to consume.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.