Module: Bibliothecary::MultiParsers::BundlerLikeManifest

Included in:
Parsers::CocoaPods, Parsers::Rubygems
Defined in:
lib/bibliothecary/multi_parsers/bundler_like_manifest.rb

Instance Method Summary collapse

Instance Method Details

#parse_ruby_manifest(manifest) ⇒ Object

this takes parsed Bundler and Bundler-like (CocoaPods) manifests and turns them into a list of dependencies.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bibliothecary/multi_parsers/bundler_like_manifest.rb', line 6

def parse_ruby_manifest(manifest)
  manifest.dependencies.inject([]) do |deps, dep|
    deps.push({
      name: dep.name,
      requirement: dep
        .requirement
        .requirements
        .sort_by(&:last)
        .map { |op, version| "#{op} #{version}" }
        .join(", "),
      type: dep.type,
    })
  end.uniq
end