Class: Belt::CLI::FrontendSetupCommand

Inherits:
Object
  • Object
show all
Includes:
AppDetection
Defined in:
lib/belt/cli/frontend_setup_command.rb

Constant Summary collapse

TEMPLATE_DIR =
File.expand_path('../../templates/module', __dir__)
MODULE_DIR =
'infrastructure/modules/app'

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AppDetection

#detect_app_name, #detect_environments, #detect_namespace, #s3_safe_name

Constructor Details

#initialize(env = nil, quiet: false) ⇒ FrontendSetupCommand

Returns a new instance of FrontendSetupCommand.



23
24
25
26
# File 'lib/belt/cli/frontend_setup_command.rb', line 23

def initialize(env = nil, quiet: false)
  @app_name = detect_app_name
  @quiet = quiet
end

Class Method Details

.run(args) ⇒ Object



16
17
18
19
20
21
# File 'lib/belt/cli/frontend_setup_command.rb', line 16

def self.run(args)
  # Environment arg is no longer needed since frontend.tf goes in the module,
  # but we still accept it for backwards compat (just ignore it).
  _env = EnvResolver.resolve(args)
  new.run
end

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
# File 'lib/belt/cli/frontend_setup_command.rb', line 28

def run
  validate!
  generate_frontend_tf
  return if @quiet

  puts "\n✓ Frontend infrastructure generated in #{MODULE_DIR}!"
  puts "\nRun `belt deploy` to create the S3 bucket and CloudFront distribution."
  puts "Then `belt deploy frontend` to build and deploy."
end