Class: Neptuno::CLI::Execute

Inherits:
Base
  • Object
show all
Includes:
TTY::Config, TTY::File
Defined in:
lib/neptuno/cli/execute.rb

Overview

Init Neptuno files

Constant Summary

Constants included from TTY::Config

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

Constants included from TTY::File

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

Constants inherited from Base

Base::ABORT_MESSAGE

Constants included from TTY::Command

TTY::Command::TTY, TTY::Command::TTYP

Constants included from TTY::Prompt

TTY::Prompt::TTY

Instance Method Summary collapse

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 inherited from Base

#command_service_to, #command_services_to, #initialize

Methods included from TTY::Command

#command, #command_p, #neptuno_command

Methods included from TTY::Prompt

#prompt

Constructor Details

This class inherits a constructor from Neptuno::CLI::Base

Instance Method Details

#call(**options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/neptuno/cli/execute.rb', line 12

def call(**options)
  command_service_to("execute", service_as_args: options[:args]&.first) do |service, _project|
    commands = Dir.glob("#{neptuno_path}/scripts/#{service}/*").map { |x| x.split("/") }.map(&:last)
    command = options[:args].last if commands.include?(options[:args]&.last)
    puts "#{neptuno_path}/scripts/#{service}/*"
    puts service
    puts commands
    puts Dir.glob("#{neptuno_path}/scripts/#{service}/*")
    command ||= prompt.select("execute", commands || [])
    `cd #{neptuno_path}/scripts/#{service} && ./#{command}`
  end
end