Class: Papers::BowerComponent

Inherits:
DependencySpecification show all
Defined in:
lib/papers/dependency_specification/bower_component.rb

Instance Attribute Summary

Attributes inherited from DependencySpecification

#license, #license_url, #name, #project_url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DependencySpecification

#acceptable_license?, #initialize, #name_without_version

Constructor Details

This class inherits a constructor from Papers::DependencySpecification

Class Method Details

.asset_type_nameObject



41
42
43
# File 'lib/papers/dependency_specification/bower_component.rb', line 41

def self.asset_type_name
  'Bower component'
end

.bower_json_entriesObject



34
35
36
37
38
39
# File 'lib/papers/dependency_specification/bower_component.rb', line 34

def self.bower_json_entries
  json_files = Dir["#{Papers.config.bower_components_path}/*/.bower.json"]
  json_files.map do |path|
    JSON.parse File.read(path)
  end
end

.full_introspected_entriesObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/papers/dependency_specification/bower_component.rb', line 18

def self.full_introspected_entries
  whitelisted_license = Papers.config.version_whitelisted_license
  bower_json_entries.map do |entry|
    name =
      if whitelisted_license != nil && whitelisted_license == entry['license']
        entry['name']
      else
        "#{entry['name']}-#{entry['_release']}"
      end
    {
      'name' => name,
      'homepage' => entry['homepage']
    }
  end
end

.introspectedObject



14
15
16
# File 'lib/papers/dependency_specification/bower_component.rb', line 14

def self.introspected
  full_introspected_entries.map { |e| e['name'] }
end

.manifest_keyObject



45
46
47
# File 'lib/papers/dependency_specification/bower_component.rb', line 45

def self.manifest_key
  "bower_components"
end

Instance Method Details

#pretty_hashObject



5
6
7
8
9
10
11
12
# File 'lib/papers/dependency_specification/bower_component.rb', line 5

def pretty_hash
  {
    name: name_without_version,
    license: license,
    license_url: @license_url,
    project_url: @project_url
  }
end