Class: Neptuno::CLI::Base
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Neptuno::CLI::Base
- Includes:
- TTY::Command, TTY::Config, TTY::File, TTY::Prompt
- Defined in:
- lib/neptuno/cli/base.rb
Overview
Base cli class for Neptuno
Direct Known Subclasses
Activate, Configure, Execute, List, Docker::Attach, Docker::Build, Docker::Down, Docker::Log, Docker::Restart, Docker::Up, Environment::Config, Environment::Update, Git::Pull, Git::Stash, K8s::Attach, Overmind::Connect, Overmind::Start, Overmind::Stop, Services::Add, Services::Destroy, Services::List, Services::Update
Constant Summary collapse
- ABORT_MESSAGE =
"fatal: not a Neptuno repository (or any of the parent directories)"
Constants included from TTY::Command
TTY::Command::TTY, TTY::Command::TTYP
Constants included from TTY::Config
Constants included from TTY::File
Constants included from TTY::Prompt
Instance Method Summary collapse
- #command_service_to(request, service_as_args: "") {|chosen_service, project| ... } ⇒ Object
- #command_services_to(request, all: nil, services_as_args: []) {|chosen_services, project| ... } ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Methods included from TTY::Command
#command, #command_p, #neptuno_command
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
Methods included from TTY::Prompt
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 |
# File 'lib/neptuno/cli/base.rb', line 14 def initialize abort ABORT_MESSAGE if neptuno_path == "" config.append_path(neptuno_path) config.read end |
Instance Method Details
#command_service_to(request, service_as_args: "") {|chosen_service, project| ... } ⇒ Object
20 21 22 23 24 25 |
# File 'lib/neptuno/cli/base.rb', line 20 def command_service_to(request, service_as_args: "") chosen_service ||= service_as_args.to_a.empty? ? nil : service_as_args chosen_service ||= service if in_service? chosen_service ||= prompt.select("Command service to #{request}:", services) yield chosen_service, project end |
#command_services_to(request, all: nil, services_as_args: []) {|chosen_services, project| ... } ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/neptuno/cli/base.rb', line 27 def command_services_to(request, all: nil, services_as_args: []) chosen_services = services if all chosen_services ||= services_as_args.to_a.empty? ? nil : services_as_args chosen_services ||= [service] if in_service? chosen_services ||= configured_services.to_a.empty? ? nil : configured_services chosen_services ||= prompt.multi_select("Command services to #{request}:", services) yield chosen_services, project end |