Class: Integration::Flay

Inherits:
Base
  • Object
show all
Defined in:
lib/integrations/flay.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
26
27
28
29
30
31
# File 'lib/integrations/flay.rb', line 6

def run_with(config)
  args = []

  if mass_threshold = config['mass_threshold']
    args += ['-m', mass_threshold.to_s]
  end

  should_delete_flayignore = false
  if ignored = config['ignored']
    if File.file?('.flayignore')
      Keepclean.logger.warn('Using local .flayignore')
    else
      should_delete_flayignore = File.write('.flayignore', ignored.join("\n"), mode: 'a') != 0
    end
  end

  args += ['-d', '-#']

  Keepclean.logger.debug "Running with args: #{args.inspect}"
  flay = ::Flay.run(args)
  flay.report

  File.delete('.flayignore') if should_delete_flayignore

  flay.total == 0
end