Module: Belt::CLI::AppDetection
- Included in:
- EnvironmentCommand, FrontendCommand, FrontendDeployCommand, FrontendSetupCommand, GenerateCommand, SetupCommand, TablesCommand
- Defined in:
- lib/belt/cli/app_detection.rb
Instance Method Summary collapse
- #detect_app_name ⇒ Object
-
#s3_safe_name(name) ⇒ Object
S3 bucket names follow DNS rules — underscores are not allowed.
Instance Method Details
#detect_app_name ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/belt/cli/app_detection.rb', line 6 def detect_app_name routes_file = 'infrastructure/routes.tf.rb' if File.exist?(routes_file) match = File.read(routes_file).match(/namespace :(\w+)/) return match[1] if match end File.basename(Dir.pwd) end |
#s3_safe_name(name) ⇒ Object
S3 bucket names follow DNS rules — underscores are not allowed. App names often use underscores (Ruby namespaces); convert for S3.
17 18 19 |
# File 'lib/belt/cli/app_detection.rb', line 17 def s3_safe_name(name) name.to_s.downcase.tr('_', '-') end |