Sha256: 19eeb20c84701cd9dcb845e84f2299e2efb7d976f685a6d7bd0fa436ae97f447

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

module Orats
  module Commands
    module UI
      include Thor::Shell

      def log_task(message)
        puts
        say_status 'task', "#{message}:", :yellow
        puts '-'*80, ''; sleep 0.25
      end

      def log_status_top(type, message, color)
        puts
        say_status type, set_color(message, :bold), color
      end

      def log_status_bottom(type, message, color, strip_newline = false)
        say_status type, message, color
        puts unless strip_newline
      end

      def log_results(results, message)
        log_status_top 'results', "#{results}:", :magenta
        log_status_bottom 'message', message, :white
      end

      def log_error(top_label, top_message, bottom_label, bottom_message, strip_newline = false)
        log_status_top top_label, "#{top_message}:", :red
        log_status_bottom bottom_label, bottom_message, :yellow, strip_newline
        yield if block_given?
      end

      def log_remote_info(top_label, top_message, bottom_label, bottom_message)
        log_status_top top_label, "#{top_message}:", :blue
        log_status_bottom bottom_label, bottom_message, :cyan
      end

      def run_from(path, command)
        run "cd #{path} && #{command} && cd -"
      end

      def git_commit(message)
        run_from @active_path, "git add -A && git commit -m '#{message}'"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
orats-0.7.3 lib/orats/commands/ui.rb
orats-0.7.2 lib/orats/commands/ui.rb
orats-0.7.1 lib/orats/commands/ui.rb