Sha256: 7ddf55a7d5db85bf5780f96a4877c755446d073139c2b394e6434cc3c3392415
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
module LicenseFinder class BundlerDependencyQuery def dependencies bundler_definition.specs_for(requested_groups).map do |spec| dependency = define_a_new_dependency_from_a_gemspec(spec) add_additional_information_from_bundler_to_a_dependency(dependency) end end private def add_additional_information_from_bundler_to_a_dependency(dependency) bundler_dependency = find_bundlers_representation_of_a_dependency_by_name(dependency.name) if bundler_dependency dependency.bundler_groups = bundler_dependency.groups end dependency end def define_a_new_dependency_from_a_gemspec(gemspec) BundledGem.new(gemspec).dependency end def find_bundlers_representation_of_a_dependency_by_name(name) bundler_dependencies.detect { |dep| dep.name == name } end def requested_groups bundler_definition.groups - LicenseFinder.config.ignore_groups end def gemfile_path Pathname.new("Gemfile").expand_path end def lockfile_path root = gemfile_path.dirname root.join('Gemfile.lock') end def bundler_dependencies @bundler_dependencies ||= bundler_definition.dependencies end def bundler_definition @bundler_definition ||= Bundler::Definition.build(gemfile_path, lockfile_path, nil) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
license_finder-0.5.0 | lib/license_finder/bundler_dependency_query.rb |