Class: Integration::Base

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

Instance Method Summary collapse

Constructor Details

#initialize(pronto: false) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/integrations/base.rb', line 6

def initialize(pronto: false)
  @pronto = pronto
end

Instance Method Details

#pronto_enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/integrations/base.rb', line 10

def pronto_enabled?
  @pronto
end

#pronto_nameObject



14
15
16
# File 'lib/integrations/base.rb', line 14

def pronto_name
  self.class.name.demodulize.underscore
end

#run_with(config) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/integrations/base.rb', line 18

def run_with(config)
  raise NotImplementedError
end

#run_with_config_handling_exit(config) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/integrations/base.rb', line 22

def run_with_config_handling_exit(config)
  if pronto_enabled?
    args = ['run', '.', '--exit-code', '--runner', pronto_name]
    Keepclean.logger.debug "Running pronto with args: #{args.inspect}"
    ::Pronto::CLI.start(args)
    ::Pronto::Runner.remove_instance_variable(:@repository)
  else
    Keepclean.logger.debug "Running on all project"
    run_with(config)
  end
rescue SystemExit => e
  Keepclean.logger.debug "Handling SystemExit: #{e.inspect} => status: #{e.status} / success?: #{e.success?}"
  return e.success?
end