Class: LicenseFinder::BowerPackage
- Defined in:
- lib/license_finder/packages/bower_package.rb
Instance Attribute Summary
Attributes inherited from Package
#authors, #children, #description, #groups, #homepage, #install_path, #license_names_from_spec, #logger, #manual_approval, #name, #parents, #summary, #version
Instance Method Summary collapse
-
#initialize(bower_module, options = {}) ⇒ BowerPackage
constructor
A new instance of BowerPackage.
- #package_manager ⇒ Object
- #package_url ⇒ Object
Methods inherited from Package
#<=>, #activations, #approved?, #approved_manually!, #approved_manually?, #decide_on_license, #eql?, #hash, #license_files, license_names_from_standard_spec, #licenses, #licenses_from_spec, #licensing, #log_activation, #missing?, #notice_files, #permitted!, #permitted?, #restricted!, #restricted?
Constructor Details
#initialize(bower_module, options = {}) ⇒ BowerPackage
Returns a new instance of BowerPackage.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/license_finder/packages/bower_package.rb', line 7 def initialize(bower_module, = {}) 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, .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 |
Instance Method Details
#package_manager ⇒ Object
33 34 35 |
# File 'lib/license_finder/packages/bower_package.rb', line 33 def package_manager 'Bower' end |
#package_url ⇒ Object
37 38 39 40 |
# File 'lib/license_finder/packages/bower_package.rb', line 37 def package_url = JSON.parse(open("https://registry.bower.io/packages/#{CGI.escape(name)}").read) ['url'] end |