Class: Neptuno::CLI::Init

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
TTY::Config, TTY::File, TTY::Which
Defined in:
lib/neptuno/cli/init.rb

Overview

Init Neptuno files

Constant Summary collapse

WORK_TREE =
{"." => [{"services" => [], "dockerfiles" => [], "procfiles" => [], "environments" => []}]}.freeze
CONFIG =
nil

Constants included from TTY::Which

TTY::Which::TTY

Constants included from TTY::Config

TTY::Config::ABORT_MESSAGE, TTY::Config::TTY

Constants included from TTY::File

TTY::File::ABORT_MESSAGE, TTY::File::TTY

Instance Method Summary collapse

Methods included from TTY::Which

#which

Methods included from TTY::Config

#auto_restart_procs, #config, #configured_services, #docker_compose_hash, #docker_compose_services, #get_dependants, #healthy_services, #json_services_status, #running_services, #services, #services_with_procs, #starting_services

Methods included from TTY::File

#file, #in_service?, #make_service_files, #neptuno_path, #project, #service

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
# File 'lib/neptuno/cli/init.rb', line 17

def call(**)
  abort "Neptuno projects can not be nested." if neptuno_path != ""
  ::TTY::File.create_dir(WORK_TREE, Dir.pwd)
  config.set(:configured_services, value: "")
  config.set(:services, value: [])
  config.write(create: true, force: true)
  `cp -r #{File.expand_path("../templates", __dir__)}/* ./`
end