class Papers::DependencySpecification
Attributes
license[RW]
license_url[RW]
name[RW]
project_url[RW]
Public Class Methods
new(options)
click to toggle source
# File lib/papers/dependency_specification.rb, line 5 def initialize(options) @name = options[:name] @license = options[:license] @license_url = options[:license_url] @project_url = options[:project_url] end
Protected Class Methods
all_from_manifest(manifest)
click to toggle source
# File lib/papers/dependency_specification.rb, line 25 def self.all_from_manifest(manifest) (manifest[manifest_key] || []).map do |name, info| license_url = info['license_url'] license = info['license'] project_url = info['project_url'] self.new(name: name, license: license, license_url: license_url, project_url: project_url) end.sort { |a, b| a.name.downcase <=> b.name.downcase } end
missing_from_manifest(manifest)
click to toggle source
# File lib/papers/dependency_specification.rb, line 34 def self.missing_from_manifest(manifest) introspected.to_set - all_from_manifest(manifest).map(&:name).to_set end
unknown_in_manifest(manifest)
click to toggle source
# File lib/papers/dependency_specification.rb, line 38 def self.unknown_in_manifest(manifest) all_from_manifest(manifest).map(&:name).to_set - introspected.to_set end
Public Instance Methods
acceptable_license?()
click to toggle source
# File lib/papers/dependency_specification.rb, line 17 def acceptable_license? Papers.config.license_whitelist.include?(license) || Papers.config.version_whitelisted_license == license || Papers.config.package_whitelist.include?(name) end
name_without_version()
click to toggle source
# File lib/papers/dependency_specification.rb, line 12 def name_without_version return @name unless @name.include?('-') @name.rpartition('-')[0] end