Class: Neetob::CLI::Cloudflare::EnsureCdn

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/cloudflare/ensure_cdn.rb

Constant Summary

Constants inherited from Base

Base::NEETO_DEPLOY_DOCS, Base::ZONE_IDS

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) ⇒ EnsureCdn

Returns a new instance of EnsureCdn.



11
12
13
14
# File 'lib/neetob/cli/cloudflare/ensure_cdn.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/cloudflare/ensure_cdn.rb', line 9

def app
  @app
end

Instance Method Details

#runObject

Raises:

  • (StandardError)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/neetob/cli/cloudflare/ensure_cdn.rb', line 16

def run
  command = <<-CMD
  neetob neetodeploy config_vars list --apps #{app} | grep 'ASSET_HOST' |
  awk -F '|' '{print $3}' | xargs
  CMD

  asset_host = `#{command}`
  raise(StandardError, "ASSET_HOST env is not set for #{app}") if asset_host.empty?

  ui.success("ASSET_HOST for #{app} is #{asset_host}")
end