diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-27 13:00:45 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-27 13:00:45 +0000 |
commit | d9c32d62a06edf6bcfaf357e44173cefd92778ee (patch) | |
tree | ba0a22afc2b02ca4c6eba226ff27c120595968a7 /lib/rubygems/specification.rb | |
parent | b89e894399016def7979168d16eff9026012a710 (diff) | |
download | ruby-d9c32d62a06edf6bcfaf357e44173cefd92778ee.tar.gz |
* lib/rubygems: Update to RubyGems 2.4.6 and HEAD(800f2e6).
Fixed #1159, #1171, #1173 on rubygems/rubygems
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/specification.rb')
-rw-r--r-- | lib/rubygems/specification.rb | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index eb89c4c97b..b73c563e2e 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -383,6 +383,8 @@ class Gem::Specification < Gem::BasicSpecification attr_reader :description ## + # :category: Recommended gemspec attributes + # # A contact email address (or addresses) for this gem # # Usage: @@ -393,11 +395,13 @@ class Gem::Specification < Gem::BasicSpecification attr_accessor :email ## + # :category: Recommended gemspec attributes + # # The URL of this gem's home page # # Usage: # - # spec.homepage = 'http://rake.rubyforge.org' + # spec.homepage = 'https://github.com/ruby/rake' attr_accessor :homepage @@ -1322,6 +1326,50 @@ class Gem::Specification < Gem::BasicSpecification end ## + # Abbreviate the spec for downloading. Abbreviated specs are only used for + # searching, downloading and related activities and do not need deployment + # specific information (e.g. list of files). So we abbreviate the spec, + # making it much smaller for quicker downloads. + + def abbreviate + self.files = [] + self.test_files = [] + self.rdoc_options = [] + self.extra_rdoc_files = [] + self.cert_chain = [] + end + + ## + # Sanitize the descriptive fields in the spec. Sometimes non-ASCII + # characters will garble the site index. Non-ASCII characters will + # be replaced by their XML entity equivalent. + + def sanitize + self.summary = sanitize_string(summary) + self.description = sanitize_string(description) + self.post_install_message = sanitize_string(post_install_message) + self.authors = authors.collect { |a| sanitize_string(a) } + end + + ## + # Sanitize a single string. + + def sanitize_string(string) + return string unless string + + # HACK the #to_s is in here because RSpec has an Array of Arrays of + # Strings for authors. Need a way to disallow bad values on gemspec + # generation. (Probably won't happen.) + string = string.to_s + + begin + Builder::XChar.encode string + rescue NameError, NoMethodError + string.to_xs + end + end + + ## # Returns an array with bindir attached to each executable in the # +executables+ list @@ -2609,7 +2657,7 @@ http://opensource.org/licenses/alphabetical # Warnings - %w[author description email homepage summary].each do |attribute| + %w[author email homepage summary].each do |attribute| value = self.send attribute warning "no #{attribute} specified" if value.nil? or value.empty? end |