Class: RailsCLI::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_cli/cli.rb

Overview

CLI class

Constant Summary collapse

DATABASES =
%w[
  postgresql
  mysql
  sqlite3
  trilogy
  oracle
  sqlserver
  jdbcmysql
  jdbcsqlite3
  jdbcpostgresql
  jdbc
].freeze
JS =
%w[
  importmap
  bun
  webpack
  esbuild
  rollup
].freeze
CSS =
%w[
  tailwind
  bootstrap
  bulma
  postcss
  sass
].freeze
SKIP_ACTIONS =
{
  'action-mailer': 'Skip Action Mailer files',
  'action-mailbox': 'Skip Action Mailbox gem',
  'action-text': 'Skip Action Text gem',
  'active-record': 'Skip Active Record files',
  'active-job': 'Skip Active Job',
  'active-storage': 'Skip Active Storage files',
  'action-cable': 'Skip Action Cable files'
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



45
46
47
# File 'lib/rails_cli/cli.rb', line 45

def self.start
  new.start
end

Instance Method Details

#startObject



49
50
51
52
53
54
55
56
57
58
# File 'lib/rails_cli/cli.rb', line 49

def start
  ::CLI::UI::Prompt.instructions_color = ::CLI::UI::Color::BLUE
  @app_name = ::CLI::UI.ask('Rails app name:', default: 'my_app')
  @database = select_database
  @js = select_js
  @css = select_css
  @skip_actions = select_skip_actions

  exec(command)
end