Sha256: 5b61a933e669521619401cea9c3d36d7b18ff222bddbee966f6227d488933e5d

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

module Wordmove
  class Logger < ::Logger
    MAX_LINE = 70

    def task(title)
      prefix = "▬" * 2
      title = " ✓ #{title} "
      padding = "▬" * padding_length(title)

      puts "\n" + prefix + title.green + padding
    end

    def task_step(local_step, title)
      if local_step
        puts "    local".cyan + " | ".black + title
      else
        puts "   remote".yellow + " | ".black + title
      end
    end

    def error(message)
      puts "    error".red + " | ".black + message
    end

    def debug(message)
      puts "    debug".magenta + " | ".black + message
    end

    private

    def padding_length(line)
      result = MAX_LINE - line.length
      result > 0 ? result : 0
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wordmove-1.4.0.pre10 lib/wordmove/logger.rb