summaryrefslogtreecommitdiff
path: root/lib/bundler/endpoint_specification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/endpoint_specification.rb')
-rw-r--r--lib/bundler/endpoint_specification.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb
index f3260a38e6..87cb352efa 100644
--- a/lib/bundler/endpoint_specification.rb
+++ b/lib/bundler/endpoint_specification.rb
@@ -3,7 +3,7 @@
module Bundler
# used for Creating Specifications from the Gemcutter Endpoint
class EndpointSpecification < Gem::Specification
- include MatchPlatform
+ include MatchRemoteMetadata
attr_reader :name, :version, :platform, :checksum
attr_accessor :source, :remote, :dependencies
@@ -12,7 +12,7 @@ module Bundler
super()
@name = name
@version = Gem::Version.create version
- @platform = platform
+ @platform = Gem::Platform.new(platform)
@spec_fetcher = spec_fetcher
@dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
@@ -22,14 +22,6 @@ module Bundler
parse_metadata(metadata)
end
- def required_ruby_version
- @required_ruby_version ||= _remote_specification.required_ruby_version
- end
-
- def required_rubygems_version
- @required_rubygems_version ||= _remote_specification.required_rubygems_version
- end
-
def fetch_platform
@platform
end
@@ -102,7 +94,7 @@ module Bundler
def _local_specification
return unless @loaded_from && File.exist?(local_specification_path)
- eval(File.read(local_specification_path)).tap do |spec|
+ eval(File.read(local_specification_path), nil, local_specification_path).tap do |spec|
spec.loaded_from = @loaded_from
end
end
@@ -133,7 +125,11 @@ module Bundler
next unless v
case k.to_s
when "checksum"
- @checksum = v.last
+ begin
+ @checksum = Checksum.from_api(v.last, @spec_fetcher.uri)
+ rescue ArgumentError => e
+ raise ArgumentError, "Invalid checksum for #{full_name}: #{e.message}"
+ end
when "rubygems"
@required_rubygems_version = Gem::Requirement.new(v)
when "ruby"