lib/rconf/configurators/passenger_configurator.rb in rconf-0.9.19 vs lib/rconf/configurators/passenger_configurator.rb in rconf-0.9.20
- old
+ new
@@ -104,11 +104,11 @@
# === Return
# path:: Default passenger+nginx install path
def default_install_path
path = if File.exist?('/opt')
if File.exist?('/opt/nginx')
- pick_default_path(File.writable?('/opt/nginx'))
+ pick_default_path(File.writable?('/opt/nginx') && File.executable?('/opt/nginx/sbin/nginx'))
else
res = Command.execute('mkdir', '/opt/nginx')
pick_default_path(res.success?)
end
else
@@ -150,12 +150,15 @@
if ruby_dir !~ /\.rvm/
post_note 'Please enable rvm before passenger is installed by running ' + 'cd ..;cd -'.blue
report_failure
else
FileUtils.cp(`which rake`.chomp, ruby_dir) unless rake_exist = File.exist?(File.join(ruby_dir, 'rake'))
- Command.execute_in_ruby('passenger-install-nginx-module', '--auto',
+ FileUtils.mkdir_p(install_path)
+ Dir.chdir(install_path) do
+ Command.execute_in_ruby('passenger-install-nginx-module', '--auto',
'--auto-download', '--prefix', install_path,
:abort_on_failure => "Failed to install nginx into #{install_path}")
+ end
FileUtils.mkdir_p(File.join(install_path, 'logs'))
File.open(File.join(install_path, 'conf', 'nginx.conf'), 'w') { |f| f.puts(nginx_config) }
if File.writable?('/etc/hosts') && IO.read('/etc/hosts') !~ /hosts_entry/
File.open('/etc/hosts', 'a') { |f| f.puts hosts_entry }
else