Class: RightConf::PassengerConfigurator

Inherits:
Object
  • Object
show all
Includes:
Configurator
Defined in:
lib/rconf/configurators/passenger_configurator.rb

Constant Summary collapse

PASSENGER_GEM_VERSION =
'3.0.2'
DEFAULT_NGINX_INSTALL =
['/opt/nginx', File.join(ENV['HOME'], 'nginx')]

Instance Method Summary collapse

Methods included from Configurator

#[], #check, included, #post_process, #run, #signature, #validate

Methods included from ProgressReporter

included, report_to_file, report_to_stdout

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightConf::Configurator

Instance Method Details

#check_linuxObject Also known as: check_darwin

Check that passenger gem is installed and that passenger+nginx is installed

Return

true

If both are installed

false

Otherwise



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/rconf/configurators/passenger_configurator.rb', line 41

def check_linux
  set_defaults
  report_check("Checking for passenger gem #{gem_version}")
  res = Command.execute_in_ruby('gem', 'list', 'passenger')
  success = (res.output =~ /#{gem_version}/)
  report_result(success)
  if success
    report_check('Checking for passenger+nginx')
    res = Command.execute('which', 'nginx').success?
    res = File.exists?(File.join(install_path, 'sbin', 'nginx')) unless res
    report_result(res)
    success = res
  end
  success
end

#check_windowsObject

Not implemented on Windows

Raise

(Exception)

Always raise



62
63
64
# File 'lib/rconf/configurators/passenger_configurator.rb', line 62

def check_windows
  raise "Passenger is not supported on Windows!"
end

#run_linuxObject Also known as: run_darwin

Install passenger gem in given ruby then run nginx install script

Return

true

Always return true



70
71
72
73
74
75
# File 'lib/rconf/configurators/passenger_configurator.rb', line 70

def run_linux
  set_defaults
  install_gem
  install_passenger
  true
end

#run_windowsObject

Not implemented on windows

Raise

(Exception)

Always raise



82
83
84
# File 'lib/rconf/configurators/passenger_configurator.rb', line 82

def run_windows
  raise "Passenger is not supported on Windows!"
end