Class: Orats::Commands::New::Exec

Inherits:
Orats::Common show all
Includes:
Rails, Server
Defined in:
lib/orats/commands/new/exec.rb

Overview

entry point to the new command

Constant Summary collapse

AVAILABLE_TEMPLATES =
{
  auth: 'add authentication and authorization'
}

Constants included from Server

Server::START_COMMAND

Instance Method Summary collapse

Methods included from Server

#server_start

Methods included from Rails

#bundle_binstubs, #bundle_install, #check_exit_conditions, #create_and_migrate_database, #custom_rails_template, #generate_favicons, #generate_home_page, #gsub_app_path, #gsub_postgres_info, #gsub_puma, #gsub_readme, #gsub_redis_info, #migrate_and_seed_database, #orats_rails_template, #rails_template, #rails_template_actions, #spring_binstub, #template_exist?

Methods inherited from Orats::Common

#base_path, #exit_if_invalid_system, #exit_if_path_exists, #file_to_string, #run_rake, #url_to_string

Methods included from Redis

#drop_namespace, #exit_if_redis_unreachable, #redis_bin

Methods included from Postgres

#create_database, #drop_database, #exit_if_database_exists, #exit_if_postgres_unreachable, #postgres_bin

Methods included from Process

#exit_if_process

Methods included from UI

#error, #log, #results, #task

Methods included from Shell

#commit, #run_from

Constructor Details

#initialize(target_path = '', options = {}) ⇒ Exec

Returns a new instance of Exec.



17
18
19
# File 'lib/orats/commands/new/exec.rb', line 17

def initialize(target_path = '', options = {})
  super
end

Instance Method Details

#available_templatesObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/orats/commands/new/exec.rb', line 33

def available_templates
  puts
  log 'templates',
      'Add `-t TEMPLATE` to the new command to mixin a template',
      :magenta
  puts

  AVAILABLE_TEMPLATES.each_pair do |key, value|
    log key, value, :cyan
  end
end

#initObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/orats/commands/new/exec.rb', line 21

def init
  check_exit_conditions

  rails_template 'base' do
    rails_template_actions
  end

  orats_rails_template if template_exist?(@options[:template])
  custom_rails_template unless @options[:custom].empty?
  server_start
end