summaryrefslogtreecommitdiff
path: root/lib/rubygems/specification.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-26 02:06:00 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-26 02:06:00 +0000
commit8b424513fd43c398aaeea5dede8bbc5c51602773 (patch)
treeb1509d7a77a52206f7825520c99a693f7818a8a4 /lib/rubygems/specification.rb
parentdbf3fb3d8e6e10e2ac2af19937e0016a4815ca50 (diff)
Upgrade to RubyGems 1.2.0 r1824. Incorporates [ruby-core:17353].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/specification.rb')
-rw-r--r--lib/rubygems/specification.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 0642a4f3e0..f3f38e5033 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -60,8 +60,10 @@ module Gem
# changes.
#--
# When updating this number, be sure to also update #to_ruby.
+ #
+ # NOTE RubyGems < 1.2 cannot load specification versions > 2.
- CURRENT_SPECIFICATION_VERSION = 3
+ CURRENT_SPECIFICATION_VERSION = 2
##
# An informal list of changes to the specification. The highest-valued
@@ -77,13 +79,10 @@ module Gem
'Added "required_rubygems_version"',
'Now forward-compatible with future versions',
],
- 3 => [
- 'Added dependency types',
- ],
}
# :stopdoc:
- MARSHAL_FIELDS = { -1 => 16, 1 => 16, 2 => 16, 3 => 16 }
+ MARSHAL_FIELDS = { -1 => 16, 1 => 16, 2 => 16 }
now = Time.at(Time.now.to_i)
TODAY = now - ((now.to_i + now.gmt_offset) % 86400)
@@ -248,10 +247,12 @@ module Gem
}
end
+ ##
# Dump only crucial instance variables.
- #
+ #--
# MAINTAIN ORDER!
- def _dump(limit) # :nodoc:
+
+ def _dump(limit)
Marshal.dump [
@rubygems_version,
@specification_version,
@@ -273,7 +274,9 @@ module Gem
]
end
+ ##
# Load custom marshal format, re-initializing defaults as needed
+
def self._load(str)
array = Marshal.load str
@@ -282,9 +285,15 @@ module Gem
current_version = CURRENT_SPECIFICATION_VERSION
- field_count = MARSHAL_FIELDS[spec.specification_version]
+ field_count = if spec.specification_version > current_version then
+ spec.instance_variable_set :@specification_version,
+ current_version
+ MARSHAL_FIELDS[current_version]
+ else
+ MARSHAL_FIELDS[spec.specification_version]
+ end
- if field_count.nil? or array.size < field_count then
+ if array.size < field_count then
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
end