Sha256: 37de8b4706a1227714d6c699f41147d6426b3f3a2413260f286d1954e1ff6495

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

module Mina
  module Helpers
    module Output
      def print_line(line)
        case line
        when /^\-+> (.*?)$/
          print_status Regexp.last_match[1]
        when /^! (.*?)$/
          print_error Regexp.last_match[1]
        when /^\$ (.*?)$/
          print_command Regexp.last_match[1]
        else
          print_stdout line
        end
      end

      def print_status(msg)
        puts "#{color('----->', 32)} #{msg}"
      end

      def print_error(msg)
        puts " #{color('!', 33)}     #{color(msg, 31)}"
      end

      def print_stderr(msg)
        if msg =~ /I, \[/ # fix for asset precompile
          print_stdout msg
        else
          puts "       #{color(msg, 31)}"
        end
      end

      def print_command(msg)
        puts "       #{color('$', 36)} #{color(msg, 36)}"
      end

      def print_info(msg)
        puts "       #{color(msg, 96)}"
      end

      def print_stdout(msg)
        puts "       #{msg}"
      end

      def color(str, c)
        ENV['NO_COLOR'] ? str : "\033[#{c}m#{str}\033[0m"
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mina-1.2.4 lib/mina/helpers/output.rb
mina-1.2.3 lib/mina/helpers/output.rb
mina-1.2.2 lib/mina/helpers/output.rb
mina-1.2.1 lib/mina/helpers/output.rb
mina-1.2.0 lib/mina/helpers/output.rb
mina-1.1.1 lib/mina/helpers/output.rb
mina-1.1.0 lib/mina/helpers/output.rb
mina-1.0.7 lib/mina/helpers/output.rb
mina-1.0.6 lib/mina/helpers/output.rb
mina-1.0.5 lib/mina/helpers/output.rb
mina-1.0.4 lib/mina/helpers/output.rb
mina-1.0.3 lib/mina/helpers/output.rb
mina-1.0.2 lib/mina/helpers/output.rb
mina-1.0.0 lib/mina/helpers/output.rb
mina-1.0.0.rc2 lib/mina/helpers/output.rb