class Bundler::EndpointSpecification
用于从 Gemcutter Endpoint 创建规范
属性
checksum[R]
dependencies[RW]
locked_platform[RW]
name[R]
platform[R]
remote[RW]
version[R]
公共类方法
new(name, version, platform, spec_fetcher, dependencies, metadata = nil) 点击以切换源码
调用父类方法
# File bundler/endpoint_specification.rb, line 11 def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil) super() @name = name @version = Gem::Version.create version @platform = Gem::Platform.new(platform) @spec_fetcher = spec_fetcher @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) } @loaded_from = nil @remote_specification = nil @locked_platform = nil parse_metadata(metadata) end
公共实例方法
__swap__(spec) 点击以切换源码
# File bundler/endpoint_specification.rb, line 118 def __swap__(spec) SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies) @remote_specification = spec end
_local_specification() 点击以切换源码
# File bundler/endpoint_specification.rb, line 111 def _local_specification return unless @loaded_from && File.exist?(local_specification_path) eval(File.read(local_specification_path), nil, local_specification_path).tap do |spec| spec.loaded_from = @loaded_from end end
bindir() 点击以切换源码
bundle clean 所需
调用父类方法
# File bundler/endpoint_specification.rb, line 68 def bindir if @remote_specification @remote_specification.bindir elsif _local_specification _local_specification.bindir else super end end
executables() 点击以切换源码
binstubs 所需
调用父类方法
# File bundler/endpoint_specification.rb, line 57 def executables if @remote_specification @remote_specification.executables elsif _local_specification _local_specification.executables else super end end
extensions() 点击以切换源码
安装过程中“带有本地扩展”所需
调用父类方法
# File bundler/endpoint_specification.rb, line 90 def extensions if @remote_specification @remote_specification.extensions elsif _local_specification _local_specification.extensions else super end end
fetch_platform() 点击以切换源码
# File bundler/endpoint_specification.rb, line 30 def fetch_platform @platform end
insecurely_materialized?() 点击以切换源码
# File bundler/endpoint_specification.rb, line 26 def insecurely_materialized? @locked_platform.to_s != @platform.to_s end
inspect() 点击以切换源码
# File bundler/endpoint_specification.rb, line 123 def inspect "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>" end
load_paths() 点击以切换源码
inline 所需
# File bundler/endpoint_specification.rb, line 47 def load_paths # remote specs aren't installed, and can't have load_paths if _local_specification _local_specification.load_paths else super end end
metadata() 点击以切换源码
“bundle fund` 所需
调用父类方法
# File bundler/endpoint_specification.rb, line 101 def metadata if @remote_specification @remote_specification.metadata elsif _local_specification _local_specification.metadata else super end end
post_install_message() 点击以切换源码
安装过程中 post_install_messages 所需
调用父类方法
# File bundler/endpoint_specification.rb, line 79 def post_install_message if @remote_specification @remote_specification.post_install_message elsif _local_specification _local_specification.post_install_message else super end end
require_paths() 点击以切换源码
standalone 所需,从本地 gemspec 加载已安装 gem 的 required_paths
调用父类方法
# File bundler/endpoint_specification.rb, line 36 def require_paths if @remote_specification @remote_specification.require_paths elsif _local_specification _local_specification.require_paths else super end end
私有实例方法
_remote_specification() 点击以切换源码
# File bundler/endpoint_specification.rb, line 129 def _remote_specification @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform]) end
build_dependency(name, requirements) 点击以切换源码
# File bundler/endpoint_specification.rb, line 163 def build_dependency(name, requirements) Gem::Dependency.new(name, requirements) end
local_specification_path() 点击以切换源码
# File bundler/endpoint_specification.rb, line 133 def local_specification_path "#{base_dir}/specifications/#{full_name}.gemspec" end
parse_metadata(data) 点击以切换源码
# File bundler/endpoint_specification.rb, line 137 def parse_metadata(data) unless data @required_ruby_version = nil @required_rubygems_version = nil return end data.each do |k, v| next unless v case k.to_s when "checksum" 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" @required_ruby_version = Gem::Requirement.new(v) end end rescue StandardError => e raise GemspecError, "There was an error parsing the metadata for the gem #{name} (#{version}): #{e.class}\n#{e}\nThe metadata was #{data.inspect}" end