Sha256: 97095ed1ab5b67bac8be9ad74db8d1e01f5dff7ef9eec62fb9290ab8e6a724d5

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 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.to_s
      else
        puts "   remote".yellow + " | ".black + title.to_s
      end
    end

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

    def success(message)
      puts "    success".green + " | ".black + message.to_s
    end

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

    private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wordmove-2.3.0 lib/wordmove/logger.rb