Sha256: 7e7ab6727f799950354facb147d327155741a19f134f8b292fcc5adb0f116b05
Contents?: true
Size: 830 Bytes
Versions: 2
Compression:
Stored size: 830 Bytes
Contents
require 'json' require 'typhoeus' module Bibliothecary module Parsers class Clojars include Bibliothecary::Analyser def self.mapping { /(^project\.clj$|.*\/project\.clj$)/ => { kind: 'manifest', parser: :parse_manifest } } end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bibliothecary-6.3.1 | lib/bibliothecary/parsers/clojars.rb |
bibliothecary-6.3.0 | lib/bibliothecary/parsers/clojars.rb |