lib/rconf/configurators/passenger_configurator.rb in rconf-0.8.18 vs lib/rconf/configurators/passenger_configurator.rb in rconf-0.8.19

- old
+ new

@@ -145,27 +145,32 @@ # true:: Always return true def install_passenger report_check('Installing passenger+nginx') # Grrrrr passenger installer expect rake where it's not... HACK ruby_dir = File.dirname(`which ruby`.chomp) - 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', - '--auto-download', '--prefix', install_path, - :abort_on_failure => "Failed to install nginx into #{install_path}") - 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 } + if ruby_dir !~ /\.rvm/ + post_note 'Please enable rvm before passenger is installed by running ' + 'cd ..;cd -'.blue + report_failure else - post_note "Please add the following line to your /etc/hosts file:\n#{hosts_entry}\n" + - "\nThe following aliases may help too:\n" + - "alias nrestart='kill -HUP `cat #{pid_path}/nginx.pid`'\n" + - "alias nstart='#{install_path}/sbin/nginx'\n" + - "alias nstop='#{install_path}/sbin/nginx -s stop'" + 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', + '--auto-download', '--prefix', install_path, + :abort_on_failure => "Failed to install nginx into #{install_path}") + 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 + post_note "Please add the following line to your /etc/hosts file:\n#{hosts_entry}\n" + + "\nThe following aliases may help too:\n" + + "alias nrestart='kill -HUP `cat #{pid_path}/nginx.pid`'\n" + + "alias nstart='#{install_path}/sbin/nginx'\n" + + "alias nstop='#{install_path}/sbin/nginx -s stop'" + end + post_note (post_note || '') + "\nNow open http://right-site.rightscale.local:3000 in your browser" + File.delete(File.join(ruby_dir, 'rake')) unless rake_exist + report_success end - post_note (post_note || '') + "\nNow open http://right-site.rightscale.local:3000 in your browser" - File.delete(File.join(ruby_dir, 'rake')) unless rake_exist - report_success end # Hosts entry in /etc/hosts # # === Return