Class: Belt::CLI::TablesCommand
- Inherits:
-
Object
- Object
- Belt::CLI::TablesCommand
- Includes:
- AppDetection
- Defined in:
- lib/belt/cli/tables_command.rb
Defined Under Namespace
Classes: ModelParser, SchemaParser
Constant Summary collapse
- SCHEMA_FILE =
'infrastructure/schema.tf.rb'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ TablesCommand
constructor
A new instance of TablesCommand.
- #run ⇒ Object
Methods included from AppDetection
Constructor Details
#initialize(env) ⇒ TablesCommand
Returns a new instance of TablesCommand.
30 31 32 33 34 |
# File 'lib/belt/cli/tables_command.rb', line 30 def initialize(env) @env = env @app_name = detect_app_name @env_dir = "infrastructure/#{@env}" end |
Class Method Details
.run(args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/belt/cli/tables_command.rb', line 13 def self.run(args) env = EnvResolver.resolve(args) if env.nil? puts 'Usage: belt setup tables <environment>' puts "\nReads schema.tf.rb and generates dynamodb.tf in the environment directory." puts 'You can also set BELT_ENV to skip the environment argument.' puts "\nExamples:" puts ' belt setup tables wups' puts ' belt setup tables dev01' puts ' BELT_ENV=wups belt setup tables' exit 1 end new(env).run end |
Instance Method Details
#run ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/belt/cli/tables_command.rb', line 36 def run validate! models = parse_schema if models.empty? puts "No models found in #{SCHEMA_FILE}" exit 0 end generate_dynamodb_tf(models) end |