Class: Jets::CLI::Release::Info

Inherits:
History show all
Defined in:
lib/jets/cli/release/info.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from History

#show_items

Methods included from Util::FormatTime

#pretty_time, #time_ago_in_words

Methods inherited from Base

#initialize, #paginate, #paging_params, rescue_api_error

Methods included from Util::Logging

#log

Methods included from AwsServices

#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2

Methods included from AwsServices::StackStatus

#output_value, #stack_exists?

Methods included from AwsServices::GlobalMemoist

included, #reset_cache!

Methods included from Api

#api, #api_key

Constructor Details

This class inherits a constructor from Jets::CLI::Base

Instance Method Details

#get(version = nil) ⇒ Object



53
54
55
56
# File 'lib/jets/cli/release/info.rb', line 53

def get(version = nil)
  version ||= "latest"
  Jets::Api::Release.retrieve(version)
end

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/jets/cli/release/info.rb', line 5

def run
  release = get(@options[:version])

  release_fields = %w[
    version
    status
    created_at
    message
    deploy_user
    jets_env
    jets_extra
    jets_version
    jets_remote
    ruby_version
    region
    docker_image
    zip_location
    git_branch
    git_sha
    git_url
    git_message
  ].map(&:to_sym)
  data = release_fields.map do |field|
    # special cases for values
    value = if field == :created_at
      pretty_time(release[:created_at])
    else
      release[field]
    end

    label = field.to_s.titleize
    [label, value]
  end

  release.endpoints.each do |endpoint|
    name = endpoint[:name].titleize
    data << [name, endpoint[:url]]
  end

  warn Jets.project.namespace.color(:green)
  presenter = CliFormat::Presenter.new(@options)
  presenter.empty_message = "Release not found for: #{Jets.project.namespace}"
  data.each do |row|
    presenter.rows << row
  end
  presenter.show
end