lib/rda/nginx.rb in rda-0.3.1 vs lib/rda/nginx.rb in rda-0.3.2

- old
+ new

@@ -39,11 +39,11 @@ remove_file "#{Rda::Rails.root}/config/setup_load_paths.rb" end private def installed? - Dir.exists?(conf_path) if conf_path + File.directory?(conf_path) if conf_path end def conf_path return @conf_path if @conf_path @@ -68,11 +68,11 @@ @hostname || "#{Rda::Rails.app_name}.local" end def available_paths search_paths = Rda.config.nginx_conf_paths || [] - @paths ||= search_paths.select { |p| Dir.exists? p if p } unless search_paths.empty? + @paths ||= search_paths.select { |p| File.directory? p if p } unless search_paths.empty? end def prompt_not_found $stderr.puts "ERROR: Config directory of Nginx is not found in the following paths:\n\n" Rda.config.nginx_conf_paths.each { |p| $stderr.puts "* #{p}" } @@ -94,35 +94,35 @@ end def mkdir_for_sites %W(available enabled).each do |n| dir = conf_path + "/sites-#{n}" - empty_directory(dir) unless Dir.exists?(dir) + empty_directory(dir) unless File.directory?(dir) end end def set_passenger_user_and_group conf = conf_path + '/nginx.conf' unless configured?(conf, 'passenger_default_user') - gsub_file conf, /http {/, <<-PASSENGER + gsub_file conf, /http \{/, <<-PASSENGER http { passenger_default_user root; PASSENGER end unless configured?(conf, 'passenger_default_group') - gsub_file conf, /http {/, <<-PASSENGER + gsub_file conf, /http \{/, <<-PASSENGER http { passenger_default_group root; PASSENGER end end def include_sites_enabled conf = conf_path + '/nginx.conf' unless configured?(conf, "include #{conf_path}/sites-enabled/*;") - gsub_file conf, /http {/, <<-INCLUDE_SITES_ENABLED + gsub_file conf, /http \{/, <<-INCLUDE_SITES_ENABLED http { include #{conf_path}/sites-enabled/*; INCLUDE_SITES_ENABLED end end