Class: Bibliothecary::Parsers::Pub
- Inherits:
-
Object
- Object
- Bibliothecary::Parsers::Pub
- Includes:
- Analyser
- Defined in:
- lib/bibliothecary/parsers/pub.rb
Class Method Summary collapse
- .mapping ⇒ Object
- .parse_yaml_lockfile(file_contents) ⇒ Object
- .parse_yaml_manifest(file_contents) ⇒ Object
Methods included from Analyser
Class Method Details
.mapping ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bibliothecary/parsers/pub.rb', line 8 def self.mapping { /^pubspec\.yaml$/i => { kind: 'manifest', parser: :parse_yaml_manifest }, /^pubspec\.lock$/i => { kind: 'lockfile', parser: :parse_yaml_lockfile } } end |
.parse_yaml_lockfile(file_contents) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bibliothecary/parsers/pub.rb', line 27 def self.parse_yaml_lockfile(file_contents) manifest = YAML.load file_contents manifest.fetch('packages', []).map do |name, dep| { name: name, requirement: dep['version'], type: 'runtime' } end end |
.parse_yaml_manifest(file_contents) ⇒ Object
21 22 23 24 25 |
# File 'lib/bibliothecary/parsers/pub.rb', line 21 def self.parse_yaml_manifest(file_contents) manifest = YAML.load file_contents map_dependencies(manifest, 'dependencies', 'runtime') + map_dependencies(manifest, 'dev_dependencies', 'development') end |