class Integration::LicenseFinder

Public Instance Methods

run_with(config) click to toggle source
# File lib/integrations/license_finder.rb, line 6
def run_with(config)
  Tempfile.create(['dependency_decisions', '.yml']) do |f|
    dependency_decisions = []

    allowed_licenses = config.fetch('allowed_licenses', [])

    allowed_licenses.each do |allowed_license|
      dependency_decisions << [:permit, allowed_license, { who: 'Keepclean' }]
    end

    f.write dependency_decisions.to_yaml
    f.close

    args = ['--decisions_file', f.path]
    Keepclean.logger.debug "Running with args: #{args.inspect}"
    ::LicenseFinder::CLI::Main.start(args)
  end

  true
end