Flowdock
Ruby latest stable (v2_5_5) - 0 notes - Superclass: Object

Not found

The exact documentation you were looking for could not be found. Here is the best guess.

The Specification class contains the information for a Gem. Typically defined in a .gemspec file or a Rakefile, and looks like this:

Gem::Specification.new do |s|
  s.name        = 'example'
  s.version     = '0.1.0'
  s.licenses    = ['MIT']
  s.summary     = "This is an example!"
  s.description = "Much longer explanation of the example!"
  s.authors     = ["Ruby Coder"]
  s.email       = 'rubycoder@example.com'
  s.files       = ["lib/example.rb"]
  s.homepage    = 'https://rubygems.org/gems/example'
  s.metadata    = { "source_code_uri" => "https://github.com/example/example" }
end

Starting in RubyGems 2.0, a Specification can hold arbitrary metadata. See #metadata for restrictions on the format and size of metadata items you may add to a specification.

Constants

DateTimeFormat = # :nodoc: /\A (\d{4})-(\d{2})-(\d{2}) (\s+ \d{2}:\d{2}:\d{2}\.\d+ \s* (Z | [-+]\d\d:\d\d) )? \Z/x

DateLike = Object.new # :nodoc:

EMPTY = [].freeze # :nodoc:

NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:

INITIALIZE_CODE_FOR_DEFAULTS = { }

VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/

LOAD_CACHE = {}

TODAY = Time.utc(today.year, today.month, today.day)

MARSHAL_FIELDS = { # :nodoc: -1 => 16, 1 => 16, 2 => 16, 3 => 17, 4 => 18, }

SPECIFICATION_VERSION_HISTORY = { # :nodoc: -1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'], 1 => [ 'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"', '"test_file=x" is a shortcut for "test_files=[x]"' ], 2 => [ 'Added "required_rubygems_version"', 'Now forward-compatible with future versions', ], 3 => [ 'Added Fixnum validation to the specification_version' ], 4 => [ 'Added sandboxed freeform metadata to the specification version.' ] }

CURRENT_SPECIFICATION_VERSION = 4

NONEXISTENT_SPECIFICATION_VERSION = -1

Attributes

[RW] specification_version

The Gem::Specification version of this gemspec.

Do not set this, it is set automatically when the gem is packaged.

[RW] rubyforge_project

The rubyforge project this gem lives under. i.e. RubyGems’ rubyforge_project is “rubygems”.

This option is deprecated.

[W] original_platform

Allows deinstallation of gems with legacy platforms.

[W] default_executable

Sets the default executable for this gem.

Deprecated: You must now specify the executable name to Gem.bin_path.

[RW] autorequire

Autorequire was used by old RubyGems to automatically require a file.

Deprecated: It is neither supported nor functional.

[RW] activated?

True when this gemspec has been activated. This attribute is not persisted.

[RW] activated

True when this gemspec has been activated. This attribute is not persisted.

[RW] signing_key

The key used to sign this gem. See Gem::Security for details.

[RW] rubygems_version

The version of RubyGems used to create this gem.

Do not set this, it is set automatically when the gem is packaged.

[R] required_rubygems_version

The RubyGems version required by this gem

[R] required_ruby_version

The version of Ruby required by this gem

[RW] post_install_message

A message that gets displayed after the gem is installed.

Usage:

spec.post_install_message = "Thanks for installing!"
[RW] cert_chain

The certificate chain used to sign this gem. See Gem::Security for details.

[RW] bindir

The path in the gem for executable scripts. Usually ‘bin’

Usage:

spec.bindir = 'bin'
[RW] metadata

The metadata holds extra data for this gem that may be useful to other consumers and is settable by gem authors without requiring an update to the rubygems software.

Metadata items have the following restrictions:

  • The metadata must be a Hash object

  • All keys and values must be Strings

  • Keys can be a maximum of 128 bytes and values can be a maximum of 1024 bytes

  • All strings must be UTF-8, no binary data is allowed

You can use metadata to specify links to your gem’s homepage, codebase, documentation, wiki, mailing list, issue tracker and changelog.

s.metadata = {
  "bug_tracker_uri"   => "https://example.com/user/bestgemever/issues",
  "changelog_uri"     => "https://example.com/user/bestgemever/CHANGELOG.md",
  "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
  "homepage_uri"      => "https://bestgemever.example.io",
  "mailing_list_uri"  => "https://groups.example.com/bestgemever",
  "source_code_uri"   => "https://example.com/user/bestgemever",
  "wiki_uri"          => "https://example.com/user/bestgemever/wiki"
}

These links will be used on your gem’s page on rubygems.org and must pass validation against following regex.

%r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
[RW] homepage

The URL of this gem’s home page

Usage:

spec.homepage = 'https://github.com/ruby/rake'
[RW] email

A contact email address (or addresses) for this gem

Usage:

spec.email = 'john.jones@example.com'
spec.email = ['jack@example.com', 'jill@example.com']
[R] description

A long description of this gem

The description should be more detailed than the summary but not excessively long. A few paragraphs is a recommended length with no examples or formatting.

Usage:

spec.description = <<-EOF
  Rake is a Make-like program implemented in Ruby. Tasks and
  dependencies are specified in standard Ruby syntax.
EOF
[R] summary

A short summary of this gem’s description. Displayed in `gem list -d`.

The #description should be more detailed than the summary.

Usage:

spec.summary = "This is a small summary of my gem"
[R] version

This gem’s version.

The version string can contain numbers and periods, such as 1.0.0. A gem is a ‘prerelease’ gem if the version has a letter in it, such as 1.0.0.pre.

Usage:

spec.version = '0.4.1'
[RW] name

This gem’s name.

Usage:

spec.name = 'rake'
Show files where this class is defined (1 file)
Register or log in to add new notes.