Skip to content

Commit

Permalink
Merge #2406
Browse files Browse the repository at this point in the history
2406: Move authors assigner to required attributes section of Gem::Specification r=bronzdoc a=greysteil

Currently, the [gem specification docs](https://guides.rubygems.org/specification-reference/) suggest that author / authors is a "recommended" attribute.

In fact, [author / authors is a required attribute](https://github.com/rubygems/rubygems/blob/master/lib/rubygems/specification_policy.rb#L287-L291).

This PR is a code move that puts the `authors` assignment method into the required attributes section (and updates its description to explain that specifying `author` is an alternative). This should make the docs much clearer next time they're generated.

Co-authored-by: Grey Baker <greysteil@gmail.com>
  • Loading branch information
bundlerbot and greysteil committed Sep 25, 2018
2 parents 08079df + 70a8c49 commit b0f6ace
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions lib/rubygems/specification.rb
Expand Up @@ -260,22 +260,11 @@ def files
].flatten.compact.uniq.sort
end

######################################################################
# :section: Recommended gemspec attributes

##
# Singular writer for #authors
# A list of authors for this gem.
#
# Usage:
#
# spec.author = 'John Jones'

def author= o
self.authors = [o]
end

##
# Sets the list of authors, ensuring it is an array.
# Alternatively, a single author can be specified by assigning a string to
# `spec.author`
#
# Usage:
#
Expand All @@ -285,6 +274,9 @@ def authors= value
@authors = Array(value).flatten.grep(String)
end

######################################################################
# :section: Recommended gemspec attributes

##
# A long description of this gem
#
Expand Down Expand Up @@ -403,6 +395,17 @@ def licenses= licenses
######################################################################
# :section: Optional gemspec attributes

##
# Singular (alternative) writer for #authors
#
# Usage:
#
# spec.author = 'John Jones'

def author= o
self.authors = [o]
end

##
# The path in the gem for executable scripts. Usually 'bin'
#
Expand Down

0 comments on commit b0f6ace

Please sign in to comment.