All you need is YAML.
gemspec.yml allows you to define all of your gem's metadata
in plain YAML, and have it loaded by a boilerplate <name>.gemspec
file which fills in any missing data with smart defaults.
git clone https://github.com/postmodern/gemspec.yml.git
mkdir newgem/
cp gemspec.yml/gemspec.yml newgem/
cp gemspec.yml/foo.gemspec newgem/newgem.gemspecname: foo
summary: Foo gem
description:
More stuff about the foo gem.
license: MIT
authors: You
email: you@example.com
homepage: https://github.com/you/foo#readme
metadata:
documentation_uri: https://rubydoc.info/gems/foo
source_code_uri: https://github.com/postmodern/foo
bug_tracker_uri: https://github.com/postmodern/foo/issues
changelog_uri: https://github.com/postmodern/foo/blob/main/CHANGELOG.md
dependencies:
bar: ~> 0.1
baz: ~> 0.2, >= 0.2.4
quix: ">= 1.2.3, < 2"
development_dependencies:
bundler: ~> 2.0
post_install_message: |
Multi-Line
$ echo "post install"
Message$ gem build foo.gemspec
Successfully built RubyGem
Name: foo
Version: 0.0.1
File: foo-0.0.1.gem
- The file MUST be named
gemspec.yml. - The file MUST be located in the top-level directory of the gem.
- The file MUST contain plain YAML.
- Nested YAML elements MUST be indented by two spaces.
- Each line SHOULD NOT exceed 80 columns.
- The
gemspec.ymlfile MUST be accompanied by a<name>.gemspecfile, which loads it's contents.
The name of the gem.
name: fooRequired: yes
Type: String
Format: gem name
The version of the gem.
version: 0.1.0Type: String
Format: version number
Required: no
Default: if omitted, the boilerplate gemspec will attempt to load the
lib/<name>/version.rb file and resolve the <Name>::VERSION constant.
A short summary for the gem.
summary: Foo gem for all of you foo needsRequired: yes
Type: String
Format: text, single-line
A longer description for the gem.
description: Foo gem provides foo functionality for tasks requiring foodescription: |
Foo gem for providing foo functionality.
Please refer to the foo documentation.Required: yes
Type: String
Format: text, multi-line
The license identifier for the gem.
license: MITlicense:
- GPL-3.0
- LGPL-3.0Required: yes
Type: String or Array of Strings
Format: License identifier
The author(s) of the gem.
authors: Meauthors:
- Me
- Bob
- AliceRequired: yes
Type: String or Array of Strings
Format: name
The primary email contact for the gem.
email: me@example.comRequired: yes
Type: String
Format: email address
The primary homepage for the gem.
homepage: https://foo.github.io/Required: yes
Type: String
Format: URL
Additional metadata for the gem.
metadata:
documentation_uri: https://rubydoc.info/gems/foo
source_code_uri: https://github.com/you/foo
bug_tracker_uri: https://github.com/you/foo/issues
changelog_uri: https://github.com/you/foo/blob/main/CHANGELOG.mdRequired: no
Type: Hash of String => String
Format: identifier => text
The directories within the gem that will be added to $LOAD_PATH when the gem
is loaded.
require_paths: librequire_paths:
- lib
- vendor/*/libType: String or Array of Strings
Format: relative path or dir glob pattern
Required: no
Default: if omitted, it will include the lib/ and ext/ directories,
if they exist.
The executable file names that will be installed by the gem.
executables:
- foo
- barType: Array of Strings
Format: file name
Required: no
Default: if omitted, it will default to the file names within the gem's
bin/ directory.
Any extension build files that will be executed when the gem is installed.
extensions: ext/foo/extconf.rbextensions: ext/*/{extconf.rb,Makefile}Required: no
Default: if omitted, it will default to all extconf.rb files within the
gem's ext/ directory, if it exists.
Type: String or Array of Strings
Format: relative path or dir glob pattern
The files that will be packaged into the gem.
files:
- README.md
- lib/**/*.rbRequired: no
Default: if omitted, it will use the output of git ls-files.
Type: String or Array of Strings
Format: relative path or dir glob pattern
Any additional files that should be included in auto-generated documentation.
extra_doc_files: *.mdextra_doc_files:
- *.md
- doc/EXAMPLES.md
- doc/SPEC.txtRequired: no
Default: if omitted, it will include any top-level .txt or .md files.
Type: String or Array of Strings
Format: relative path or dir glob pattern
The unit/spec test files.
test_files: test/{**/}*_test.rbRequired: no
Default: if omitted, it will default to
the {test/{**/}*_test.rb,spec/{**/}*_spec.rb glob pattern.
Type: String or Array of Strings
Format: relative path or dir glob pattern
Any external dependencies for the gem.
requirements: graphviz >= 2.0.0requirements:
- graphviz >= 2.0.0
- sqlite3 >= 3.30.0Required: no
Type: String or Array of Strings
Format: dependency
The Ruby version required to use this gem.
required_ruby_version: ">= 2.0.0"Required: no
Type: String
Format: version requirement
Note: Strings beginning with > must be double-quoted for YAML.
The RubyGems version required to install or use this gem.
required_rubygems_version: ">= 3.0.0"Required: no
Type: String
Format: version requirement
Note: Strings beginning with > must be double-quoted for YAML.
An optional message to display after the gem has been successfully installed.
post_install_message: |
Congratulations on installing the Foo gem. Do not forget to edit ~/.foorcRequired: no
Type: String
Format: multi-line
Runtime gem dependencies for the gem.
dependencies:
bar: ~> 0.1
baz: ~> 0.5, < 2
quix: ">= 1.2.3, < 2"Required: no
Type: Hash of String => String
Format: gem name => version requirement
Note: Strings beginning with > must be double-quoted for YAML.
Development dependencies for the gem.
dependencies:
bundler: ~> 2.0
rspec: ~> 3.0Required: no
Type: Hash of String => String
Format: gem name => version requirement
Note: Strings beginning with > must be double-quoted for YAML.