Class: Bibliothecary::Parsers::Clojars
- Inherits:
-
Object
- Object
- Bibliothecary::Parsers::Clojars
- Includes:
- Analyser
- Defined in:
- lib/bibliothecary/parsers/clojars.rb
Class Method Summary collapse
Methods included from Analyser
Class Method Details
.mapping ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/bibliothecary/parsers/clojars.rb', line 9 def self.mapping { /^project\.clj$/ => { kind: 'manifest', parser: :parse_manifest } } end |
.parse_manifest(manifest) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bibliothecary/parsers/clojars.rb', line 18 def self.parse_manifest(manifest) response = Typhoeus.post("#{Bibliothecary.configuration.clojars_parser_host}/project.clj", body: manifest) json = JSON.parse response.body index = json.index("dependencies") return [] unless index; dependencies = json[index + 1] dependencies.map do |dependency| { name: dependency[0], requirement: dependency[1], type: "runtime" } end end |