Class: Neetob::CLI::Heroku::Certs

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/heroku/certs.rb

Constant Summary

Constants inherited from Base

Base::NEETO_DEPLOY_DOCS

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary collapse

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods inherited from Base

#process

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initialize(app) ⇒ Certs

Returns a new instance of Certs.



11
12
13
14
# File 'lib/neetob/cli/heroku/certs.rb', line 11

def initialize(app)
  super()
  @app = app
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



9
10
11
# File 'lib/neetob/cli/heroku/certs.rb', line 9

def app
  @app
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/neetob/cli/heroku/certs.rb', line 16

def run
  certificates_list_heroku_output = `heroku certs -a #{app}`
  ui.success("Certificates of #{app}", print_to_audit_log: false)
  ui.info(certificates_list_heroku_output, print_to_audit_log: false)

  if Thread.current[:audit_mode]
    certificates_list_heroku_output.lines[2..].map do |line|
      match = line.match(
        /^\s*(\S+)\s+([^\d]+?)(?=\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2} UTC))/
      )
      next unless match

      {
        name: match[1],
        common_names: match[2],
        expires: match[3]
      }
    end
  end
end