Class: R10K::Action::Module::Deploy

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/r10k/action/module.rb

Instance Method Summary collapse

Methods included from Logging

formatter, included, level, level=, #logger, outputter

Constructor Details

#initialize(app, mod) ⇒ Deploy

Returns a new instance of Deploy.

Parameters:

  • app (Object)

    The next application in the middlware stack

  • mod (R10K::Module)

    The module to deploy



16
17
18
# File 'lib/r10k/action/module.rb', line 16

def initialize(app, mod)
  @app, @mod = app, mod
end

Instance Method Details

#call(env) ⇒ Object

Parameters:

  • env (Hash)

Options Hash (env):

  • :update_cache (true, false)


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/r10k/action/module.rb', line 23

def call(env)
  @env = env

  logger.info "Deploying module #{@mod.name}"
  @mod.sync! :update_cache => @env[:update_cache]

  @app.call(@env)
rescue R10K::ExecutionFailure => e
  logger.error "Could not synchronize #{@mod.full_path}: #{e}".red
  $stderr.puts e.backtrace.join("\n").red if @env[:trace]
  @app.call(@env)
end