Class: Orats::Commands::Project::Exec

Inherits:
Common
  • Object
show all
Includes:
Rails, Server
Defined in:
lib/orats/commands/project/exec.rb

Constant Summary collapse

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

Constants included from Server

Server::START_COMMAND

Constants inherited from Common

Common::RELATIVE_PATHS

Instance Attribute Summary

Attributes inherited from Common

#local_paths, #remote_gem_version, #remote_paths

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_postgres_info, #gsub_project_path, #gsub_readme, #gsub_redis_info, #migrate_and_seed_database, #rails_template, #run_rake, #spring_binstub, #template_exist?

Methods inherited from Common

#base_path, copy_from_local_gem, #exit_if_path_exists, #exit_if_process, #file_to_string, #repo_path, #url_to_string

Methods included from Diff::Parse

#galaxyfile, #gem_version, #hosts, #inventory, #playbook

Methods included from UI

#git_commit, #log_error, #log_remote_info, #log_results, #log_status_bottom, #log_status_top, #log_task, #run_from

Constructor Details

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

Returns a new instance of Exec.



17
18
19
20
21
# File 'lib/orats/commands/project/exec.rb', line 17

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

  @active_path = services_path
end

Instance Method Details

#initObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/orats/commands/project/exec.rb', line 34

def init
  check_exit_conditions

  rails_template 'base' do
    gsub_postgres_info
    gsub_redis_info unless @options[:redis_password].empty?
    gsub_project_path
    gsub_readme

    bundle_install
    bundle_binstubs
    spring_binstub

    create_and_migrate_database
    generate_home_page
    generate_favicons
  end

  if template_exist?(@options[:template])
    rails_template @options[:template], '--skip ' do
      migrate_and_seed_database
    end
  end

  Commands::Inventory.new(@target_path,
                          @options).init unless @options[:skip_ansible]

  custom_rails_template unless @options[:custom].empty?

  server_start
end

#list_templatesObject



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

def list_templates
  log_status_top 'templates', 'Available templates to choose from:',
                 :blue
  puts
  PROJECT_TEMPLATES.each_pair do |key, value|
    log_status_bottom key, value, :cyan, true
    log_status_bottom 'usage', "orats project /tmp/foo --template #{key}",
                      :white
  end
end