In Files

Files

Class/Module Index [+]

Quicksearch

Capistrano

Add custom log formatters

Passing a hash or a array of hashes with custom log formatters.

Add the following to your deploy.rb or in your ~/.caprc

Example:

capistrano_log_formatters = [
  { :match => /command finished/,       :color => :hide,      :priority => 10, :prepend => "$$$" },
  { :match => /executing command/,      :color => :blue,      :priority => 10, :style => :underscore, :timestamp => true },
  { :match => /^transaction: commit$/,  :color => :magenta,   :priority => 10, :style => :blink },
  { :match => /git/,                    :color => :white,     :priority => 20, :style => :reverse }
]

format_logs capistrano_log_formatters

You can call format_logs multiple times, with either a hash or an array of hashes.

Colors:

:color can have the following values:

Styles:

:style can have the following values:

== Text alterations

:prepend gives static text to be prepended to the output :replace replaces the matched text in the output :timestamp adds the current time before the output


Notes:

no global verbose flag for scm_verbose
sync, checkout and export are just sync in p4

Constants

CaptureError
CommandError
ConnectionError
EXTENSIONS

Holds the set of registered plugins, keyed by name (where the name is a symbol).

Error
LocalArgumentError
NoMatchingServersError
NoSuchTaskError
TransferError

Public Class Methods

plugin(name, mod) click to toggle source

Register the given module as a plugin with the given name. It will henceforth be available via a proxy object on Configuration instances, accessible by a method with the given name.

# File lib/capistrano/extensions.rb, line 20
def self.plugin(name, mod)
  name = name.to_sym
  return false if EXTENSIONS.has_key?(name)

  methods = Capistrano::Configuration.public_instance_methods +
    Capistrano::Configuration.protected_instance_methods +
    Capistrano::Configuration.private_instance_methods

  if methods.any? { |m| m.to_sym == name }
    raise Capistrano::Error, "registering a plugin named `#{name}' would shadow a method on Capistrano::Configuration with the same name"
  end

  Capistrano::Configuration.class_eval       def #{name}        @__#{name}_proxy ||= Capistrano::ExtensionProxy.new(self, Capistrano::EXTENSIONS[#{name.inspect}])      end, __FILE__, __LINE__+1

  EXTENSIONS[name] = mod
  return true
end
remove_plugin(name) click to toggle source

Unregister the plugin with the given name.

# File lib/capistrano/extensions.rb, line 43
def self.remove_plugin(name)
  name = name.to_sym
  if EXTENSIONS.delete(name)
    Capistrano::Configuration.send(:remove_method, name)
    return true
  end

  return false
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.