Sha256: cb276cc792560dbedbf525b13614c5edde82074fd58517657139e58c9ef47e62

Contents?: true

Size: 860 Bytes

Versions: 8

Compression:

Stored size: 860 Bytes

Contents

require 'r10k/action'
require 'r10k/errors'
require 'r10k/logging'

require 'middleware'

module R10K::Action::Module

  class R10K::Action::Module::Deploy
    # Middleware to deploy a module

    include R10K::Logging

    # @param [Object] app The next application in the middlware stack
    # @param [R10K::Module] mod The module to deploy
    def initialize(app, mod)
      @app, @mod = app, mod
    end

    # @param [Hash] env
    #
    # @option env [true, false] :update_cache
    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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
r10k-0.0.9 lib/r10k/action/module.rb
r10k-0.0.8 lib/r10k/action/module.rb
r10k-0.0.7 lib/r10k/action/module.rb
r10k-0.0.6 lib/r10k/action/module.rb
r10k-0.0.5 lib/r10k/action/module.rb
r10k-0.0.4 lib/r10k/action/module.rb
r10k-0.0.3 lib/r10k/action/module.rb
r10k-0.0.2 lib/r10k/action/module.rb