summaryrefslogtreecommitdiff
path: root/lib/rubygems/stub_specification.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-01 21:50:14 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-01 21:50:14 +0000
commiteffdbf5936cc090a618e13c8f9a1b5412ebab2fa (patch)
treec8410a18cbbe7ad013470fc06fef0c75ce0fd230 /lib/rubygems/stub_specification.rb
parent9c4ef4b191a1e6b9abdbb21c7c709d1d0f2397e6 (diff)
* lib/rubygems: Update to RubyGems HEAD(c202db2).
this version contains many enhancements see http://git.io/vtNwF * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/stub_specification.rb')
-rw-r--r--lib/rubygems/stub_specification.rb39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index b184d29d5e..ed07e8011f 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -15,35 +15,32 @@ class Gem::StubSpecification < Gem::BasicSpecification
end
class StubLine # :nodoc: all
- attr_reader :parts
+ attr_reader :name, :version, :platform, :require_paths
def initialize(data)
- @parts = data[PREFIX.length..-1].split(" ")
- end
-
- def name
- @parts[0]
- end
-
- def version
- Gem::Version.new @parts[1]
+ parts = data[PREFIX.length..-1].split(" ")
+ @name = parts[0]
+ @version = Gem::Version.new parts[1]
+ @platform = Gem::Platform.new parts[2]
+ @require_paths = parts.drop(3).join(" ").split("\0")
end
+ end
- def platform
- Gem::Platform.new @parts[2]
- end
+ def self.default_gemspec_stub filename
+ new filename, true
+ end
- def require_paths
- @parts[3..-1].join(" ").split("\0")
- end
+ def self.gemspec_stub filename
+ new filename, false
end
- def initialize(filename)
+ def initialize filename, default_gem
self.loaded_from = filename
@data = nil
@extensions = nil
@name = nil
@spec = nil
+ @default_gem = default_gem
end
##
@@ -57,6 +54,10 @@ class Gem::StubSpecification < Gem::BasicSpecification
end
end
+ def default_gem?
+ @default_gem
+ end
+
def build_extensions # :nodoc:
return if default_gem?
return if extensions.empty?
@@ -135,14 +136,14 @@ class Gem::StubSpecification < Gem::BasicSpecification
# Name of the gem
def name
- @name ||= data.name
+ data.name
end
##
# Platform of the gem
def platform
- @platform ||= data.platform
+ data.platform
end
##