Class: LazyRails::CLI

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

Instance Method Summary collapse

Instance Method Details

#newObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lazy_rails/cli.rb', line 12

def new
  puts "Welcome to the Rails Project Setup Wizard!"

  command = CommandBuilder.new(
    PromptGenerators::AskAppName.new(prompt).call
  )
  command.options << PromptGenerators::SelectDb.new(prompt).call
  command.options << app_type = PromptGenerators::SelectAppType.new(prompt).call

  if app_type == "web"
    command.options << PromptGenerators::SelectJs.new(prompt).call
    command.options << PromptGenerators::SelectCss.new(prompt).call
  end

  command.options << PromptGenerators::SelectTools.new(prompt).call
  puts "\nYour Rails project will be created with the following command:"
  puts command.build

  if prompt.yes?("Do you want to run this command now?")
    system(command.build)
    puts "Rails project '#{command.app_name}' has been created!"
  else
    puts "Command not executed. You can run it manually when you're ready."
  end
end

#versionObject



39
40
41
# File 'lib/lazy_rails/cli.rb', line 39

def version
  puts "LazyRails version #{LazyRails::VERSION}"
end