Class: Ruby::Nginx::Commands::InstallNginx

Inherits:
TerminalCommand show all
Defined in:
lib/ruby/nginx/commands/install_nginx.rb

Instance Attribute Summary

Attributes inherited from TerminalCommand

#cmd, #error_type, #printer, #result, #user

Instance Method Summary collapse

Methods included from Helpers::SudoHelper

#sudoify

Methods included from Helpers::PromptHelper

#yes?

Constructor Details

#initializeInstallNginx

Returns a new instance of InstallNginx.



10
11
12
# File 'lib/ruby/nginx/commands/install_nginx.rb', line 10

def initialize
  super(cmd: resolve_command, raise: Ruby::Nginx::InstallError, printer: :pretty)
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby/nginx/commands/install_nginx.rb', line 14

def run
  return if installed?

  puts "\e[0;33m#{cmd}\e[0m"

  if yes?("Would you like to install NGINX?")
    super
  else
    raise Ruby::Nginx::AbortError, "NGINX is required to continue. Please install NGINX."
  end
end