Class: R10K::Action::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/r10k/action/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts, argv, klass) ⇒ Runner

Returns a new instance of Runner.



4
5
6
7
8
# File 'lib/r10k/action/runner.rb', line 4

def initialize(opts, argv, klass)
  @opts = opts
  @argv = argv
  @klass = klass
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/r10k/action/runner.rb', line 19

def call
  setup_logging
  setup_settings
  # @todo check arguments
  instance.call
end

#instanceObject



10
11
12
13
14
15
16
17
# File 'lib/r10k/action/runner.rb', line 10

def instance
  if @_instance.nil?
    iopts = @opts.dup
    iopts.delete(:loglevel)
    @_instance = @klass.new(iopts, @argv)
  end
  @_instance
end

#setup_loggingObject



26
27
28
29
30
# File 'lib/r10k/action/runner.rb', line 26

def setup_logging
  if @opts.key?(:loglevel)
    R10K::Logging.level = @opts[:loglevel]
  end
end

#setup_settingsObject



32
33
# File 'lib/r10k/action/runner.rb', line 32

def setup_settings
end