Ruby Language Gemspec Files


Example

Each gem has a file in the format of <gem name>.gemspec which contains metadata about the gem and it's files. The format of a gemspec is as follows:

Gem::Specification.new do |s|
  # Details about gem. They are added in the format:
  s.<detail name> = <detail value>
end

The fields required by RubyGems are:

Either author = string or authors = array

Use author = if there is only one author, and authors = when there are multiple. For authors= use an array which lists the authors names.

files = array

Here array is a list of all the files in the gem. This can also be used with the Dir[] function, for example if all your files are in the /lib/ directory, then you can use files = Dir["/lib/"].

name = string

Here string is just the name of your gem. Rubygems recommends a few rules you should follow when naming your gem.

  1. Use underscores, NO SPACES
  2. Use only lowercase letters
  3. Use hypens for gem extension (e.g. if your gem is named example for an extension you would name it example-extension) so that when then extension is required it can be required as require "example/extension".

RubyGems also adds "If you publish a gem on rubygems.org it may be removed if the name is objectionable, violates intellectual property or the contents of the gem meet these criteria. You can report such a gem on the RubyGems Support site."

platform=

I don't know

require_paths=

I don't know

summary= string

String is a summery of the gems purpose and anything that you would like to share about the gem.

version= string

The current version number of the gem.

The recommended fields are:

email = string

An email address that will be associated with the gem.

homepage= string

The website where the gem lives.

Either license= or licenses=

I don't know