Sha256: fcd5b584aef16b2b6d8156de83f82fb9c327683285b314c7cbc337a3379cce15

Contents?: true

Size: 743 Bytes

Versions: 12

Compression:

Stored size: 743 Bytes

Contents

module Sprinkle
  module Errors
    
    class PrettyFailure < StandardError #:nodoc:
      
      attr_accessor :details
      
      def initialize(installer, details={}, previous_error=nil)
        @installer = installer
        @details = details
        @previous_error = previous_error
      end
            
      def log(s, o)
        puts s
        puts "-" * (s.length+2)
        puts o
        puts
      end
      
      def boxed(s)
        puts red("-"*54)
        puts red("| #{s.center(50)} |")
        puts red("-"*54)
        puts
      end
      
      private
      
      def color(code, s)
        "\033[%sm%s\033[0m"%[code,s]
      end
      
      def red(s)
        color(31, s)
      end
      
    end
    
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sprinkle-0.7.1.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.7 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.6.2 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.6.1.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.6.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.6.0 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.5.2 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.5.1.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.5.1 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.5.0 lib/sprinkle/errors/pretty_failure.rb
sprinkle-0.5.0.rc1 lib/sprinkle/errors/pretty_failure.rb