Class: Souls::Create

Inherits:
Thor
  • Object
show all
Defined in:
lib/souls/cli/create/index.rb,
lib/souls/cli/create/functions.rb

Instance Method Summary collapse

Instance Method Details

#functionsObject



7
8
9
10
11
# File 'lib/souls/cli/create/functions.rb', line 7

def functions
  create_app_file
  create_gemfile
  create_env_yaml
end

#workerObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/souls/cli/create/index.rb', line 6

def worker
  require("#{Souls.get_mother_path}/config/souls")
  Dir.chdir(Souls.get_mother_path.to_s) do
    file_dir = "apps/#{options[:name]}"
    raise(StandardError, "Same Worker Already Exist!") if Dir.exist?(file_dir)

    workers = Souls.configuration.workers
    app = Souls.configuration.app
    port = 3000 + workers.size
    souls_worker_name = "souls-#{app}-#{options[:name]}"
    download_worker(worker_name: options[:name])
    souls_conf_update(worker_name: souls_worker_name)
    souls_conf_update(worker_name: souls_worker_name, strain: "api")
    workflow(worker_name: options[:name])
    procfile(worker_name: options[:name], port: port)
    mother_procfile(worker_name: options[:name])
    souls_config_init(worker_name: options[:name])
    steepfile(worker_name: options[:name])
    souls_helper_rbs(worker_name: options[:name])
    system("cd apps/#{options[:name]} && bundle")
    souls_worker_credit(worker_name: options[:name])
  end
  true
end