pax_global_header00006660000000000000000000000064117406065660014525gustar00rootroot0000000000000052 comment=7acaa2af5fb63e8423a46a8617ae0544dff00a01 ruby-capistrano-colors-0.5.5/000077500000000000000000000000001174060656600161555ustar00rootroot00000000000000ruby-capistrano-colors-0.5.5/Manifest000066400000000000000000000002301174060656600176410ustar00rootroot00000000000000README.rdoc Rakefile capistrano_colors.gemspec lib/capistrano_colors.rb lib/capistrano_colors/configuration.rb lib/capistrano_colors/logger.rb Manifest ruby-capistrano-colors-0.5.5/README.rdoc000066400000000000000000000071401174060656600177650ustar00rootroot00000000000000== DESCRIPTION The aim of capistrano_colors is to make the capistrano output more userfriendly. When capistrano_colors is included in your deploy.rb capistrano output gets nice and shiny colors. == INSTALLATION sudo gem install capistrano_colors == USAGE === Per project installation In config/deploy.rb require 'capistrano_colors' === System wide installation Create/Modify you ~/.caprc with the following require 'capistrano_colors' == Creating you own color matchers Create a custom colormatcher with the colorize command. colorize can be called with a hash of options or an array of hashes. The options hash should have the following fields. * :match - A regular expression of the row to match. * :color - The color we want on the matching rows. * :prio - What prio should this rule have (higher = more prio) * :attribute - Special effect (:underline, :reverse, :blink) * :level - Specify if this matcher should be bound to some of capistranos log levels (info,debug,...) * :prepend - Text to be prepended to the output * :timestamp - Show current time with the output === match :match is a simple regular expression for the row that should be matched. === color :color can have the following values: * :hide (hides the row completely) * :none * :black * :red * :green * :yellow * :blue * :magenta * :cyan * :white === prio :prio is a Integer defining the matchers prio. === attribute :attribute can have the following values: * :bright * :dim * :underscore * :blink * :reverse * :hidden == Example require 'capistrano_colors' capistrano_color_matchers = [ { :match => /command finished/, :color => :hide, :prio => 10 }, { :match => /executing command/, :color => :blue, :prio => 10, :attribute => :underscore }, { :match => /^transaction: commit$/, :color => :magenta, :prio => 10, :attribute => :blink }, { :match => /git/, :color => :white, :prio => 20, :attribute => :reverse }, ] colorize( capistrano_color_matchers ) == CHANGES v.0.5.5 - Added :timestamp option. Submitted by Mike Gunderloy v.0.5.0 - Total rewrite and that is why we have a big version bump ;) - Moved modules/classes to separate files. - Wrote a simple color-regexp-match-engine. - Possible to make you own custom color-matchers. v.0.2.1 - Bugfix for some err: messages that where not printed in red. - Moved console colors to constants - Simple cleanup == AUTHOR Mathias Stjernström (http://pastbedti.me/) == LICENSE MIT License Copyright (c) 2007 - 2008 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ruby-capistrano-colors-0.5.5/Rakefile000066400000000000000000000000331174060656600176160ustar00rootroot00000000000000require "bundler/gem_tasks"ruby-capistrano-colors-0.5.5/capistrano_colors.gemspec000066400000000000000000000027451174060656600232560ustar00rootroot00000000000000# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{capistrano_colors} s.version = "0.5.5" s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= s.authors = ["Mathias Stjernstrom"] s.date = %q{2011-03-17} s.description = %q{Simple gem to display colors in capistrano output.} s.email = %q{mathias@globalinn.com} s.extra_rdoc_files = ["README.rdoc", "lib/capistrano_colors.rb", "lib/capistrano_colors/configuration.rb", "lib/capistrano_colors/logger.rb"] s.files = ["README.rdoc", "Rakefile", "capistrano_colors.gemspec", "lib/capistrano_colors.rb", "lib/capistrano_colors/configuration.rb", "lib/capistrano_colors/logger.rb", "Manifest"] s.homepage = %q{http://github.com/stjernstrom/capistrano_colors} s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Capistrano_colors", "--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = %q{capistranocolor} s.rubygems_version = %q{1.3.7} s.summary = %q{Simple gem to display colors in capistrano output.} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q, [">= 2.3.0"]) else s.add_dependency(%q, [">= 2.3.0"]) end else s.add_dependency(%q, [">= 2.3.0"]) end end ruby-capistrano-colors-0.5.5/lib/000077500000000000000000000000001174060656600167235ustar00rootroot00000000000000ruby-capistrano-colors-0.5.5/lib/capistrano_colors.rb000066400000000000000000000021251174060656600227740ustar00rootroot00000000000000require 'capistrano/configuration' require 'capistrano/logger' require 'capistrano_colors/configuration' require 'capistrano_colors/logger' # DEBUG Capistrano::Logger.add_color_matcher({ :match => /executing `.*/, :color => :green, :level => 2, :prio => -10, :prepend => "== Currently ", :timestamp => true }) Capistrano::Logger.add_color_matcher({ :match => /.*/, :color => :yellow, :level => 2, :prio => -20 }) # INFO Capistrano::Logger.add_color_matcher({ :match => /.*out\] (fatal:|ERROR:).*/, :color => :red, :level => 1, :prio => -10 }) Capistrano::Logger.add_color_matcher({ :match => /Permission denied/, :color => :red, :level => 1, :prio => -20 }) Capistrano::Logger.add_color_matcher({ :match => /sh: .+: command not found/, :color => :magenta, :level => 1, :prio => -30 }) # IMPORTANT Capistrano::Logger.add_color_matcher({ :match => /^err ::/, :color => :red, :level => 0, :prio => -10 }) Capistrano::Logger.add_color_matcher({ :match => /.*/, :color => :blue, :level => 0, :prio => -20 }) ruby-capistrano-colors-0.5.5/lib/capistrano_colors/000077500000000000000000000000001174060656600224475ustar00rootroot00000000000000ruby-capistrano-colors-0.5.5/lib/capistrano_colors/configuration.rb000066400000000000000000000034461174060656600256520ustar00rootroot00000000000000module Capistrano class Configuration # Add custom colormatchers # # Passing a hash or a array of hashes with custom colormatchers. # # Add the following to your deploy.rb or in your ~/.caprc # # == Example: # # require 'capistrano_colors' # # capistrano_color_matchers = [ # { :match => /command finished/, :color => :hide, :prio => 10, :prepend => "$$$" }, # { :match => /executing command/, :color => :blue, :prio => 10, :attribute => :underscore, :timestamp => true }, # { :match => /^transaction: commit$/, :color => :magenta, :prio => 10, :attribute => :blink }, # { :match => /git/, :color => :white, :prio => 20, :attribute => :reverse }, # ] # # colorize( capistrano_color_matchers ) # # You can call colorize multiple time with either a hash or an array of hashes multiple times. # # == Colors: # # :color can have the following values: # # * :hide (hides the row completely) # * :none # * :black # * :red # * :green # * :yellow # * :blue # * :magenta # * :cyan # * :white # # == Attributes: # # :attribute can have the following values: # # * :bright # * :dim # * :underscore # * :blink # * :reverse # * :hidden # # # == Text alterations # # :prepend gives static text to be prepended to the output # :timestamp adds the current time before the output # def colorize(options) if options.class == Array options.each do |opt| Capistrano::Logger.add_color_matcher( opt ) end else Capistrano::Logger.add_color_matcher( options ) end end end end ruby-capistrano-colors-0.5.5/lib/capistrano_colors/logger.rb000066400000000000000000000037401174060656600242570ustar00rootroot00000000000000module Capistrano class Logger CAP_COLORS = { :none => "0", :black => "30", :red => "31", :green => "32", :yellow => "33", :blue => "34", :magenta => "35", :cyan => "36", :white => "37" } CAP_ATTRIBUTES = { :bright => 1, :dim => 2, :underscore => 4, :blink => 5, :reverse => 7, :hidden => 8 } @@color_matchers = [] alias_method :org_log, :log def log(level, message, line_prefix=nil) #:nodoc: color = :none attribute = nil # Sort matchers in reverse order so we can break if we found a match. @@sorted_color_matchers ||= @@color_matchers.sort_by { |i| -i[:prio] } @@sorted_color_matchers.each do |filter| if (filter[:level] == level || filter[:level].nil?) if message =~ filter[:match] || line_prefix =~ filter[:match] color = filter[:color] attribute = filter[:attribute] message = filter[:prepend] + message unless filter[:prepend].nil? message = Time.now.strftime('%T') + ' ' + message if filter[:timestamp] break end end end if color != :hide current_color = CAP_COLORS[color] current_attribute = CAP_ATTRIBUTES[attribute] line_prefix = colorize(line_prefix.to_s, current_color, current_attribute, nil) unless line_prefix.nil? org_log(level, colorize(message, current_color, current_attribute), line_prefix) end end def self.add_color_matcher( options ) #:nodoc: @@color_matchers.push( options ) end def colorize(message, color, attribute, nl = "\n") attribute = "#{attribute};" if attribute "\e[#{attribute}#{color}m" + message.strip + "\e[0m#{nl}" end end end ruby-capistrano-colors-0.5.5/metadata.yml000066400000000000000000000035521174060656600204650ustar00rootroot00000000000000--- !ruby/object:Gem::Specification name: capistrano_colors version: !ruby/object:Gem::Version hash: 1 prerelease: segments: - 0 - 5 - 5 version: 0.5.5 platform: ruby authors: - Mathias Stjernstrom autorequire: bindir: bin cert_chain: [] date: 2011-03-17 00:00:00 Z dependencies: - !ruby/object:Gem::Dependency name: capistrano prerelease: false requirement: &id001 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 2 - 3 - 0 version: 2.3.0 type: :development version_requirements: *id001 description: Simple gem to display colors in capistrano output. email: mathias@globalinn.com executables: [] extensions: [] extra_rdoc_files: - README.rdoc - lib/capistrano_colors.rb - lib/capistrano_colors/configuration.rb - lib/capistrano_colors/logger.rb files: - README.rdoc - Rakefile - capistrano_colors.gemspec - lib/capistrano_colors.rb - lib/capistrano_colors/configuration.rb - lib/capistrano_colors/logger.rb - Manifest homepage: http://github.com/stjernstrom/capistrano_colors licenses: [] post_install_message: rdoc_options: - --line-numbers - --inline-source - --title - Capistrano_colors - --main - README.rdoc require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 11 segments: - 1 - 2 version: "1.2" requirements: [] rubyforge_project: capistranocolor rubygems_version: 1.8.10 signing_key: specification_version: 3 summary: Simple gem to display colors in capistrano output. test_files: []