Class: Belt::CLI::FrontendSetupCommand
- Inherits:
-
Object
- Object
- Belt::CLI::FrontendSetupCommand
- Includes:
- AppDetection
- Defined in:
- lib/belt/cli/frontend_setup_command.rb
Constant Summary collapse
- TEMPLATE_DIR =
File.('../../templates/frontend_infra', __dir__)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ FrontendSetupCommand
constructor
A new instance of FrontendSetupCommand.
- #run ⇒ Object
Methods included from AppDetection
Constructor Details
#initialize(env) ⇒ FrontendSetupCommand
Returns a new instance of FrontendSetupCommand.
32 33 34 35 36 |
# File 'lib/belt/cli/frontend_setup_command.rb', line 32 def initialize(env) @env = env @app_name = detect_app_name @env_dir = "infrastructure/#{@env}" end |
Class Method Details
.run(args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/belt/cli/frontend_setup_command.rb', line 15 def self.run(args) env = EnvResolver.resolve(args) if env.nil? puts 'Usage: belt setup frontend <environment>' puts "\nGenerates S3 + CloudFront Terraform for frontend hosting." puts 'You can also set BELT_ENV to skip the environment argument.' puts "\nExamples:" puts ' belt setup frontend wups' puts ' belt setup frontend dev01' puts ' BELT_ENV=wups belt setup frontend' exit 1 end new(env).run end |
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/belt/cli/frontend_setup_command.rb', line 38 def run validate! generate_frontend_tf puts "\n✓ Frontend infrastructure generated for '#{@env}'!" puts "\nRun `belt apply #{@env}` to create the S3 bucket and CloudFront distribution." puts "Then `belt deploy frontend #{@env}` to build and deploy." end |