Class: Rsodx::Cli::Commands::Scaffold

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
ScaffoldCommon
Defined in:
lib/rsodx/cli/commands/scaffold.rb

Constant Summary

Constants included from ScaffoldCommon

Rsodx::Cli::Commands::ScaffoldCommon::APP, Rsodx::Cli::Commands::ScaffoldCommon::APP_CONTROLLER, Rsodx::Cli::Commands::ScaffoldCommon::APP_PRESENTER, Rsodx::Cli::Commands::ScaffoldCommon::APP_SERIALIZER, Rsodx::Cli::Commands::ScaffoldCommon::APP_SERVICE, Rsodx::Cli::Commands::ScaffoldCommon::BINRSODX, Rsodx::Cli::Commands::ScaffoldCommon::CONFIGRU, Rsodx::Cli::Commands::ScaffoldCommon::CONSOLE, Rsodx::Cli::Commands::ScaffoldCommon::ENVFILE, Rsodx::Cli::Commands::ScaffoldCommon::ENV_LOADER, Rsodx::Cli::Commands::ScaffoldCommon::FOLDERS, Rsodx::Cli::Commands::ScaffoldCommon::GEMFILE, Rsodx::Cli::Commands::ScaffoldCommon::GITIGNORE, Rsodx::Cli::Commands::ScaffoldCommon::RAKEFILE, Rsodx::Cli::Commands::ScaffoldCommon::ROUTE, Rsodx::Cli::Commands::ScaffoldCommon::RUBY_VERSION

Instance Method Summary collapse

Instance Method Details

#call(arg) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rsodx/cli/commands/scaffold.rb', line 11

def call(arg)
  @name = arg[:name]
  @app_path = File.join(Dir.pwd, @name)

  puts Rsodx::LOGO

  puts "\e[33m🛤️ Initializing Transport Empire for '#{@name}'...\e[0m"
  puts "\e[34m📦 Creating files and folders...\e[0m"

  create_folders
  create_files

  puts "\e[32m✅ Done! Your microservice has been scaffolded at the '#{@app_path}' railway!\e[0m"
rescue => e
  abort "\e[31m❌ Failed to scaffold: #{e.message}\e[0m"
end