class Papers::DependencySpecification

Attributes

license[RW]
license_url[RW]
name[RW]
project_url[RW]

Public 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']
    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
new(options) click to toggle source
# File lib/papers/dependency_specification.rb, line 7
def initialize(options)
  @name        = options[:name]
  @license     = options[:license]
  @license_url = options[:license_url]
  @project_url = options[:project_url]
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 19
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 14
def name_without_version
  return @name unless @name.include?('-')
  @name.rpartition('-')[0]
end