Class: Roda::Project::CLI

Inherits:
Generator show all
Includes:
Helpers::InteractiveInput
Defined in:
lib/roda/project/cli.rb

Instance Method Summary collapse

Methods included from Helpers::InteractiveInput

#pastel, #read_line, #reader, #retry_on_error

Methods inherited from Generator

#initialize

Methods included from Helpers::Ids

#api_id, #fullstack_id, #id_to_string, #minimal_id, #minitest_id, #mysql_id, #postgresql_id, #rspec_id, #sqlite_id

Methods included from Helpers::Template

#cp_dir, #cp_file, #erb_cp_dir, #erb_cp_file, #templates_root

Constructor Details

This class inherits a constructor from Roda::Project::Generator

Instance Method Details

#callObject



8
9
10
11
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
37
38
39
40
# File 'lib/roda/project/cli.rb', line 8

def call
  puts pastel.bright_black("[roda-project v#{Roda::Project::VERSION}]\n")
  puts pastel.italic("#{Roda::Project.messages.sample.first}\n")

  get_user_context

  puts pastel.bright_black("\n[project: #{@context.project_name}]\n")

  create_base_project
  add_front_end
  add_database
  add_test_files

  puts "\ninstall dependences:\n\n"
  puts "$ cd #{@context.project_name} && bundle"
  if @context.database?
    unless @context.sqlite?
      puts "\n* create your database\n"
      puts "\n* put your dev database credentials in app/config/config.rb\n"
    end
    puts "\nmigrate the database (use RACK_ENV to migrate 'test' or 'production' environments):\n\n"
    puts "$ bin/roda db migrate"
  end
  puts "\nrun and watch the project in dev mode:\n"
  puts "\n$ bin/roda dev"
  if @context.fullstack?
    puts "\ncompile and watch assets:\n"
    puts "\n$ bin/roda assets:dev"
  end
  puts "\nrun 'bin/roda' inside #{@context.project_name} to see all available tasks\n\n"
rescue TTY::Reader::InputInterrupt
  puts "\n\nGoodbye"
end