diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-22 02:52:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-22 02:52:35 +0000 |
commit | b551e8c8b36766651be4e782e09e3b02e7d14a10 (patch) | |
tree | e164a1ef908bd4451568abf05b688f1593915b81 /lib/rubygems/specification.rb | |
parent | 65544f575b25b18dc27f9364f973556ddb48538f (diff) |
* lib/rubygems: update to 1.3.6.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/specification.rb')
-rw-r--r-- | lib/rubygems/specification.rb | 82 |
1 files changed, 66 insertions, 16 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 3630b4adf5..472d60817b 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -17,7 +17,7 @@ class Date; end # for ruby_code if date.rb wasn't required # defined in a .gemspec file or a Rakefile, and looks like this: # # spec = Gem::Specification.new do |s| -# s.name = 'rfoo' +# s.name = 'example' # s.version = '1.0' # s.summary = 'Example gem specification' # ... @@ -409,15 +409,19 @@ class Gem::Specification # :startdoc: ## - # Specification constructor. Assigns the default values to the attributes - # and yields itself for further initialization. + # Specification constructor. Assigns the default values to the + # attributes and yields itself for further + # initialization. Optionally takes +name+ and +version+. - def initialize + def initialize name = nil, version = nil @new_platform = nil assign_defaults @loaded = false @loaded_from = nil + self.name = name if name + self.version = version if version + yield self if block_given? @@gather.call(self) if @@gather @@ -498,7 +502,7 @@ class Gem::Specification def self.load(filename) gemspec = nil - fail "NESTED Specification.load calls not allowed!" if @@gather + raise "NESTED Specification.load calls not allowed!" if @@gather @@gather = proc { |gs| gemspec = gs } data = File.read(filename) eval(data) @@ -598,10 +602,12 @@ class Gem::Specification end ## - # The default (generated) file name of the gem. + # The default (generated) file name of the gem. See also #spec_name. + # + # spec.file_name # => "example-1.0.gem" def file_name - full_name + ".gem" + full_name + '.gem' end ## @@ -620,7 +626,7 @@ class Gem::Specification def satisfies_requirement?(dependency) return @name == dependency.name && - dependency.version_requirements.satisfied_by?(@version) + dependency.requirement.satisfied_by?(@version) end ## @@ -630,6 +636,15 @@ class Gem::Specification [@name, @version, @new_platform == Gem::Platform::RUBY ? -1 : 1] end + ## + # The default name of the gemspec. See also #file_name + # + # spec.spec_name # => "example-1.0.gemspec" + + def spec_name + full_name + '.gemspec' + end + def <=>(other) # :nodoc: sort_obj <=> other.sort_obj end @@ -1033,14 +1048,18 @@ class Gem::Specification ## # :attr_accessor: rubygems_version # - # The version of RubyGems used to create this gem + # The version of RubyGems used to create this gem. + # + # Do not set this, it is set automatically when the gem is packaged. required_attribute :rubygems_version, Gem::RubyGemsVersion ## # :attr_accessor: specification_version # - # The Gem::Specification version of this gemspec + # The Gem::Specification version of this gemspec. + # + # Do not set this, it is set automatically when the gem is packaged. required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION @@ -1062,6 +1081,8 @@ class Gem::Specification # :attr_accessor: date # # The date this gem was created + # + # Do not set this, it is set automatically when the gem is packaged. required_attribute :date, TODAY @@ -1069,13 +1090,20 @@ class Gem::Specification # :attr_accessor: summary # # A short summary of this gem's description. Displayed in `gem list -d`. + # + # The description should be more detailed than the summary. For example, + # you might wish to copy the entire README into the description. + # + # As of RubyGems 1.3.2 newlines are no longer stripped. required_attribute :summary ## # :attr_accessor: require_paths # - # Paths in the gem to add to $LOAD_PATH when this gem is activated + # Paths in the gem to add to $LOAD_PATH when this gem is activated. + # + # The default 'lib' is typically sufficient. required_attribute :require_paths, ['lib'] @@ -1085,6 +1113,13 @@ class Gem::Specification # :attr_accessor: email # # A contact email for this gem + # + # If you are providing multiple authors and multiple emails they should be + # in the same order such that: + # + # Hash[*spec.authors.zip(spec.emails).flatten] + # + # Gives a hash of author name to email address. attribute :email @@ -1122,6 +1157,8 @@ class Gem::Specification # :attr_accessor: default_executable # # The default executable for this gem. + # + # This is not used. attribute :default_executable @@ -1149,7 +1186,7 @@ class Gem::Specification ## # :attr_accessor: required_ruby_version # - # The ruby of version required by this gem + # The version of ruby required by this gem attribute :required_ruby_version, Gem::Requirement.default @@ -1164,6 +1201,9 @@ class Gem::Specification # :attr_accessor: platform # # The platform this gem runs on. See Gem::Platform for details. + # + # Setting this to any value other than Gem::Platform::RUBY or + # Gem::Platform::CURRENT is probably wrong. attribute :platform, Gem::Platform::RUBY @@ -1192,7 +1232,14 @@ class Gem::Specification ## # :attr_accessor: authors # - # The list of authors who wrote this gem + # The list of author names who wrote this gem. + # + # If you are providing multiple authors and multiple emails they should be + # in the same order such that: + # + # Hash[*spec.authors.zip(spec.emails).flatten] + # + # Gives a hash of author name to email address. array_attribute :authors @@ -1228,21 +1275,21 @@ class Gem::Specification ## # :attr_accessor: rdoc_options # - # An ARGV-style array of options to RDoc + # An ARGV style array of options to RDoc array_attribute :rdoc_options ## # :attr_accessor: extra_rdoc_files # - # Extra files to add to RDoc + # Extra files to add to RDoc such as README or doc/examples.txt array_attribute :extra_rdoc_files ## # :attr_accessor: executables # - # Executables included in the gem + # Executables included in the gem. array_attribute :executables @@ -1266,6 +1313,9 @@ class Gem::Specification # :attr_reader: dependencies # # A list of Gem::Dependency objects this gem depends on. + # + # Use #add_dependency or #add_development_dependency to add dependencies to + # a gem. array_attribute :dependencies |