Class: Neptuno::CLI::Install

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

Overview

Init Neptuno files

Constant Summary collapse

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

Constants included from TTY::Prompt

TTY::Prompt::TTY

Constants included from TTY::Command

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

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

Methods included from TTY::Prompt

#prompt

Methods included from TTY::Command

#command, #command_p, #neptuno_command

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/neptuno/cli/install.rb', line 17

def call(**)
  install "git"
  install "docker"
  install "tmux"
  install "overmind"
  install "tmuxinator"

  return unless system("apt-get -v")

  system("sudo apt-get update")
end

#install(package) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/neptuno/cli/install.rb', line 29

def install(package)
  if ::TTY::Which.exist?(package)
    puts "#{package} is already installed"
  else
    puts "Installing #{package}"
    if system("brew -v")
      system("brew install #{package}")
    elsif package == "overmind"
      system("go install github.com/DarthSim/overmind/v2@latest")
    elsif package == "tmuxinator"
      system("ASDF_RUBY_VERSION=system gem update bundler")
      system("ASDF_RUBY_VERSION=system gem install tmuxinator")
    else
      system("sudo apt-get install #{package} -y")
    end
  end
end