module PhusionPassenger::LoaderSharedHelpers

def check_rvm_using_wrapper_script(options)

def check_rvm_using_wrapper_script(options)
	ruby = options["ruby"]
	if ruby =~ %r(/\.?rvm/) && ruby =~ %r(/bin/ruby$)
		raise "You've set the `PassengerRuby` (Apache) or `passenger_ruby` (Nginx) option to '#{ruby}'. " +
			"However, because you are using RVM, this is not allowed: the option must point to " +
			"an RVM wrapper script, not a raw Ruby binary. This is because RVM is implemented " +
			"through various environment variables, which are set through the wrapper script.\n" +
			"\n" +
			"To find out the correct value for `PassengerRuby`/`passenger_ruby`, please read:\n\n" +
			"  #{APACHE2_DOC_URL}#PassengerRuby\n\n" +
			"  #{NGINX_DOC_URL}#PassengerRuby\n\n" +
			"Scroll to section 'RVM helper tool'.\n" +
			"\n-------------------------\n"
	end
end