Module: Minestrone
- Defined in:
- lib/minestrone/configuration/log_formatters.rb,
lib/minestrone/cli.rb,
lib/minestrone/ssh.rb,
lib/minestrone/errors.rb,
lib/minestrone/logger.rb,
lib/minestrone/command.rb,
lib/minestrone/version.rb,
lib/minestrone/callback.rb,
lib/minestrone/cli/help.rb,
lib/minestrone/transfer.rb,
lib/minestrone/extensions.rb,
lib/minestrone/cli/options.rb,
lib/minestrone/processable.rb,
lib/minestrone/configuration.rb,
lib/minestrone/task_definition.rb,
lib/minestrone/server_definition.rb,
lib/minestrone/recipes/deploy/scm.rb,
lib/minestrone/configuration/loading.rb,
lib/minestrone/configuration/servers.rb,
lib/minestrone/recipes/deploy/scm/git.rb,
lib/minestrone/configuration/callbacks.rb,
lib/minestrone/configuration/execution.rb,
lib/minestrone/configuration/variables.rb,
lib/minestrone/recipes/deploy/scm/base.rb,
lib/minestrone/recipes/deploy/scm/none.rb,
lib/minestrone/recipes/deploy/strategy.rb,
lib/minestrone/configuration/alias_task.rb,
lib/minestrone/configuration/namespaces.rb,
lib/minestrone/configuration/connections.rb,
lib/minestrone/recipes/deploy/dependencies.rb,
lib/minestrone/recipes/deploy/strategy/base.rb,
lib/minestrone/recipes/deploy/strategy/copy.rb,
lib/minestrone/configuration/actions/inspect.rb,
lib/minestrone/recipes/deploy/local_dependency.rb,
lib/minestrone/configuration/actions/invocation.rb,
lib/minestrone/recipes/deploy/remote_dependency.rb,
lib/minestrone/configuration/actions/file_transfer.rb,
lib/minestrone/recipes/deploy/strategy/remote_cache.rb
Overview
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:
minestrone_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 }
]
log_formatter minestrone_log_formatters
You can call log_formatter multiple times, with either a hash or an array of hashes.
Colors:
:color can have the following values:
-
:hide (hides the row completely)
-
:none
-
:black
-
:red
-
:green
-
:yellow
-
:blue
-
:magenta
-
:cyan
-
:white
Styles:
:style can have the following values:
-
:bright
-
:dim
-
:underscore
-
:blink
-
:reverse
-
:hidden
== 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
Defined Under Namespace
Modules: Deploy, Processable Classes: CLI, Callback, Command, Configuration, ExtensionProxy, Logger, ProcCallback, RemoteError, SSH, ServerDefinition, TaskCallback, TaskDefinition, Transfer, Version
Constant Summary collapse
- Error =
Class.new(RuntimeError)
- CaptureError =
Class.new(Minestrone::Error)
- NoSuchTaskError =
Class.new(Minestrone::Error)
- NoMatchingServersError =
Class.new(Minestrone::Error)
- ConnectionError =
Class.new(Minestrone::RemoteError)
- TransferError =
Class.new(Minestrone::RemoteError)
- CommandError =
Class.new(Minestrone::RemoteError)
- LocalArgumentError =
Class.new(Minestrone::Error)
- VERSION =
Version.to_s
- EXTENSIONS =
Holds the set of registered plugins, keyed by name (where the name is a symbol).
{}
Class Method Summary collapse
-
.plugin(name, mod) ⇒ Object
Register the given module as a plugin with the given name.
-
.remove_plugin(name) ⇒ Object
Unregister the plugin with the given name.
Class Method Details
.plugin(name, mod) ⇒ Object
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.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/minestrone/extensions.rb', line 22 def self.plugin(name, mod) name = name.to_sym return false if EXTENSIONS.has_key?(name) methods = Minestrone::Configuration.public_instance_methods + Minestrone::Configuration.protected_instance_methods + Minestrone::Configuration.private_instance_methods if methods.any? { |m| m.to_sym == name } raise Minestrone::Error, "registering a plugin named `#{name}' would shadow a method on Minestrone::Configuration with the same name" end Minestrone::Configuration.class_eval <<-STR, __FILE__, __LINE__+1 def #{name} @__#{name}_proxy ||= Minestrone::ExtensionProxy.new(self, Minestrone::EXTENSIONS[#{name.inspect}]) end STR EXTENSIONS[name] = mod return true end |
.remove_plugin(name) ⇒ Object
Unregister the plugin with the given name.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/minestrone/extensions.rb', line 46 def self.remove_plugin(name) name = name.to_sym if EXTENSIONS.delete(name) Minestrone::Configuration.send(:remove_method, name) return true end return false end |