Sha256: 37f55e14929f5a53c00f05189aadf24457bcc3acaec8900ec0f8fcfa442ee4e5
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require 'open-uri' module LicenseFinder class BowerPackage < Package def initialize(bower_module, options = {}) spec = bower_module.fetch('pkgMeta', {}) if spec.empty? endpoint = bower_module.fetch('endpoint', {}) name = endpoint['name'] version = endpoint['target'] else name = spec['name'] version = spec['version'] end super( name, version, options.merge( summary: spec['description'], description: spec['readme'], homepage: spec['homepage'], spec_licenses: Package.license_names_from_standard_spec(spec), install_path: bower_module['canonicalDir'], missing: bower_module['missing'] ) ) end def package_manager 'Bower' end def package_url meta = if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5.0') JSON.parse(open("https://registry.bower.io/packages/#{CGI.escape(name)}").read) else JSON.parse(URI.open("https://registry.bower.io/packages/#{CGI.escape(name)}").read) end meta['url'] end end end
Version data entries
3 entries across 3 versions & 1 rubygems