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-1.2.1 lib/kuber_kit/ui/api.rb
kuber_kit-1.2.0 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.1 lib/kuber_kit/ui/api.rb
kuber_kit-1.0.1 lib/kuber_kit/ui/api.rb
kuber_kit-1.0.0 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.9 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.8 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.7 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.6 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.5 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.4 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.3 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.2 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.1 lib/kuber_kit/ui/api.rb
kuber_kit-0.9.0 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.8 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.7 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.6 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.5 lib/kuber_kit/ui/api.rb
kuber_kit-0.8.4 lib/kuber_kit/ui/api.rb