Sha256: 33f7460fba851d976cd79406ec92b49664f276cd3b33414d0cb1a160d6b2b53d

Contents?: true

Size: 935 Bytes

Versions: 72

Compression:

Stored size: 935 Bytes

Contents

require 'json'
class KuberKit::UI::Api < KuberKit::UI::Simple
  class Task < KuberKit::UI::Simple::Task
    def print_started
      # do nothing, api formatter should only show result
    end

    def print_finished
      # do nothing, api formatter should only show result
    end
  end

  def create_task_group
    TaskGroup.new(KuberKit::UI::Api::Task)
  end

  def create_task(title, &block)
    task = KuberKit::UI::Api::Task.new(title, &block)
    task.execute
    task.wait
  end

  def print_info(title, text)
    logger.debug(text)
  end

  def print_error(title, text)
    logger.debug(text)
    print_json({error: text})
  end

  def print_warning(title, text)
    logger.debug(text)
  end

  def print_debug(title, text)
    logger.debug(text)
  end

  def print_result(message, data = {})
    print_json({message: message}.merge(data))
  end

  protected
    def print_json(data)
      puts JSON.generate(data)
    end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
kuber_kit-0.8.3 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.2 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.1 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.0 lib/kuber_kit/ui/api.rb
kuber_kit-0.7.1 lib/kuber_kit/ui/api.rb
kuber_kit-0.7.0 lib/kuber_kit/ui/api.rb
kuber_kit-0.6.4 lib/kuber_kit/ui/api.rb
kuber_kit-0.6.3 lib/kuber_kit/ui/api.rb
kuber_kit-0.6.2 lib/kuber_kit/ui/api.rb
kuber_kit-0.6.1 lib/kuber_kit/ui/api.rb
kuber_kit-0.6.0 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.10 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.9 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.8 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.7 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.6 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.5 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.4 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.3 lib/kuber_kit/ui/api.rb
kuber_kit-0.5.2 lib/kuber_kit/ui/api.rb