Class: Integration::LicenseFinder

Inherits:
Base
  • Object
show all
Defined in:
lib/integrations/license_finder.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #pronto_enabled?, #pronto_name, #run_with_config_handling_exit

Constructor Details

This class inherits a constructor from Integration::Base

Instance Method Details

#run_with(config) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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