Class: Belt::CLI::TablesCommand
- Inherits:
-
Object
- Object
- Belt::CLI::TablesCommand
- Defined in:
- lib/belt/cli/tables_command.rb
Constant Summary collapse
- MODULE_DIR =
'infrastructure/modules/app'- MODELS_DIR =
'lambda/models'
Class Method Summary collapse
- .run(args) ⇒ Object
-
.sync_all_environments ⇒ Object
Automatically sync dynamodb.tf in the app module.
Instance Method Summary collapse
-
#initialize(quiet: false) ⇒ TablesCommand
constructor
A new instance of TablesCommand.
- #run ⇒ Object
Constructor Details
#initialize(quiet: false) ⇒ TablesCommand
Returns a new instance of TablesCommand.
29 30 31 |
# File 'lib/belt/cli/tables_command.rb', line 29 def initialize(quiet: false) @quiet = quiet end |
Class Method Details
.run(args) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/belt/cli/tables_command.rb', line 13 def self.run(args) # Environment argument accepted for backwards compatibility but unused — # dynamodb.tf lives in infrastructure/modules/app and uses var.environment. EnvResolver.resolve(args) new.run end |
.sync_all_environments ⇒ Object
Automatically sync dynamodb.tf in the app module. Called by generators after creating/updating model files.
23 24 25 26 27 |
# File 'lib/belt/cli/tables_command.rb', line 23 def self.sync_all_environments return unless Dir.exist?(MODELS_DIR) new(quiet: true).run end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/belt/cli/tables_command.rb', line 33 def run validate! models = parse_models if models.empty? puts "No models found in #{MODELS_DIR}/" unless @quiet return end generate_dynamodb_tf(models) end |