Class: Bibliothecary::Parsers::CPAN
- Inherits:
-
Object
- Object
- Bibliothecary::Parsers::CPAN
- Includes:
- Analyser
- Defined in:
- lib/bibliothecary/parsers/cpan.rb
Class Method Summary collapse
- .mapping ⇒ Object
- .parse_json_manifest(file_contents) ⇒ Object
- .parse_yaml_manifest(file_contents) ⇒ Object
Methods included from Analyser
Class Method Details
.mapping ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bibliothecary/parsers/cpan.rb', line 9 def self.mapping { /^META\.json$/i => { kind: 'manifest', parser: :parse_json_manifest }, /^META\.yml$/i => { kind: 'manifest', parser: :parse_yaml_manifest } } end |
.parse_json_manifest(file_contents) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/bibliothecary/parsers/cpan.rb', line 22 def self.parse_json_manifest(file_contents) manifest = JSON.parse file_contents manifest['prereqs'].map do |_group, deps| map_dependencies(deps, 'requires', 'runtime') end.flatten end |
.parse_yaml_manifest(file_contents) ⇒ Object
29 30 31 32 |
# File 'lib/bibliothecary/parsers/cpan.rb', line 29 def self.parse_yaml_manifest(file_contents) manifest = YAML.load file_contents map_dependencies(manifest, 'requires', 'runtime') end |