Sha256: 681ae023eea9e512311d4bb8c22806f64fd6f4951883830cecac465cf156b1fc
Contents?: true
Size: 757 Bytes
Versions: 2
Compression:
Stored size: 757 Bytes
Contents
require 'json' module Bibliothecary module Parsers class Bower include Bibliothecary::Analyser def self.parse(filename, file_contents) if filename.match(/^bower\.json$/) json = JSON.parse(file_contents) parse_manifest(json) else [] end end def self.parse_manifest(manifest) map_dependencies(manifest, 'dependencies', 'runtime') + map_dependencies(manifest, 'devDependencies', 'development') end def self.map_dependencies(hash, key, type) hash.fetch(key,[]).map do |name, requirement| { name: name, requirement: requirement, type: type } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bibliothecary-2.0.1 | lib/bibliothecary/parsers/bower.rb |
bibliothecary-2.0.0 | lib/bibliothecary/parsers/bower.rb |