diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-22 08:24:42 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-22 08:24:42 +0000 |
commit | 372dcece3f69989d133f720468f1e24aa1133cda (patch) | |
tree | c173ca48a23ce18afa44feb15bf68d2dd14ac619 /lib/rubygems/specification.rb | |
parent | d0e5a34ac7c34e70c145024a0fed8f6042814f29 (diff) | |
download | ruby-372dcece3f69989d133f720468f1e24aa1133cda.tar.gz |
Update to RubyGems 1.3.7.pre.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/specification.rb')
-rw-r--r-- | lib/rubygems/specification.rb | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 472d60817b..4c5a02d39c 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -504,8 +504,8 @@ class Gem::Specification gemspec = nil raise "NESTED Specification.load calls not allowed!" if @@gather @@gather = proc { |gs| gemspec = gs } - data = File.read(filename) - eval(data) + data = File.read filename + eval data, nil, filename gemspec ensure @@gather = nil @@ -524,7 +524,7 @@ class Gem::Specification # Sets the rubygems_version to the current RubyGems version def mark_version - @rubygems_version = Gem::RubyGemsVersion + @rubygems_version = Gem::VERSION end ## @@ -677,33 +677,43 @@ class Gem::Specification } end - def to_yaml(opts = {}) # :nodoc: + def encode_with coder # :nodoc: mark_version attributes = @@attributes.map { |name,| name.to_s }.sort attributes = attributes - %w[name version platform] + coder.add 'name', @name + coder.add 'version', @version + platform = case @original_platform + when nil, '' then + 'ruby' + when String then + @original_platform + else + @original_platform.to_s + end + coder.add 'platform', platform + + attributes.each do |name| + coder.add name, instance_variable_get("@#{name}") + end + end + + def to_yaml(opts = {}) # :nodoc: + return super if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? + yaml = YAML.quick_emit object_id, opts do |out| out.map taguri, to_yaml_style do |map| - map.add 'name', @name - map.add 'version', @version - platform = case @original_platform - when nil, '' then - 'ruby' - when String then - @original_platform - else - @original_platform.to_s - end - map.add 'platform', platform - - attributes.each do |name| - map.add name, instance_variable_get("@#{name}") - end + encode_with map end end end + def init_with coder # :nodoc: + yaml_initialize coder.tag, coder.map + end + def yaml_initialize(tag, vals) # :nodoc: vals.each do |ivar, val| instance_variable_set "@#{ivar}", val @@ -759,7 +769,7 @@ class Gem::Specification result << " s.specification_version = #{specification_version}" result << nil - result << " if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then" + result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then" unless dependencies.empty? then dependencies.each do |dep| @@ -804,9 +814,9 @@ class Gem::Specification extend Gem::UserInteraction normalize - if rubygems_version != Gem::RubyGemsVersion then + if rubygems_version != Gem::VERSION then raise Gem::InvalidSpecificationException, - "expected RubyGems version #{Gem::RubyGemsVersion}, was #{rubygems_version}" + "expected RubyGems version #{Gem::VERSION}, was #{rubygems_version}" end @@required_attributes.each do |symbol| @@ -1052,7 +1062,7 @@ class Gem::Specification # # Do not set this, it is set automatically when the gem is packaged. - required_attribute :rubygems_version, Gem::RubyGemsVersion + required_attribute :rubygems_version, Gem::VERSION ## # :attr_accessor: specification_version @@ -1481,14 +1491,12 @@ class Gem::Specification end overwrite_accessor :files do - result = [] - result.push(*@files) if defined?(@files) - result.push(*@test_files) if defined?(@test_files) - result.push(*(add_bindir(@executables))) - result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files) - result.push(*@extensions) if defined?(@extensions) - result.uniq.compact + # DO NOT CHANGE TO ||= ! This is not a normal accessor. (yes, it sucks) + @files = [@files, + @test_files, + add_bindir(@executables), + @extra_rdoc_files, + @extensions, + ].flatten.uniq.compact end - end - |