aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/erb/scaffold/templates/index.html.erb2
-rw-r--r--railties/lib/rails/generators/erb/scaffold/templates/show.html.erb2
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb16
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/boot.rb13
-rwxr-xr-xrailties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.fcgi24
-rwxr-xr-xrailties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.rb10
-rwxr-xr-xrailties/lib/rails/generators/rails/app/templates/dispatchers/gateway.cgi97
7 files changed, 8 insertions, 156 deletions
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb
index 5e6a4af9e0..b5c7fd1e58 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb
+++ b/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb
@@ -13,7 +13,7 @@
<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
<tr>
<% for attribute in attributes -%>
- <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
+ <td><%%= <%= singular_name %>.<%= attribute.name %> %></td>
<% end -%>
<td><%%= link_to 'Show', <%= singular_name %> %></td>
<td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb
index 25567957be..24f13fc0f8 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb
+++ b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb
@@ -1,7 +1,7 @@
<% for attribute in attributes -%>
<p>
<b><%= attribute.human_name %>:</b>
- <%%=h @<%= singular_name %>.<%= attribute.name %> %>
+ <%%= @<%= singular_name %>.<%= attribute.name %> %>
</p>
<% end -%>
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index b2322f90b4..78b4b057ae 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -18,9 +18,6 @@ module Rails::Generators
class_option :template, :type => :string, :aliases => "-m",
:desc => "Path to an application template (can be a filesystem path or URL)."
- class_option :with_dispatchers, :type => :boolean, :aliases => "-D", :default => false,
- :desc => "Add CGI/FastCGI/mod_ruby dispatchers code"
-
class_option :skip_activerecord, :type => :boolean, :aliases => "-O", :default => false,
:desc => "Skip ActiveRecord files"
@@ -113,19 +110,6 @@ module Rails::Generators
directory "public", "public", :recursive => false # Do small steps, so anyone can overwrite it.
end
- def create_dispatch_files
- return unless options[:with_dispatchers]
-
- template "dispatchers/dispatch.rb", "public/dispatch.rb"
- chmod "public/dispatch.rb", 0755, :verbose => false
-
- template "dispatchers/dispatch.rb", "public/dispatch.cgi"
- chmod "public/dispatch.cgi", 0755, :verbose => false
-
- template "dispatchers/dispatch.fcgi", "public/dispatch.fcgi"
- chmod "public/dispatch.fcgi", 0755, :verbose => false
- end
-
def create_public_image_files
directory "public/images"
end
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
index 52086fbc7d..6e0e2279cd 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
@@ -40,20 +40,20 @@ module Rails
class Boot
def run
- load_initializer
set_load_paths
+ load_initializer
end
def set_load_paths
%w(
- railties
- railties/lib
- activesupport/lib
+ actionmailer/lib
actionpack/lib
+ activemodel/lib
activerecord/lib
- actionmailer/lib
activeresource/lib
- actionwebservice/lib
+ activesupport/lib
+ railties/lib
+ railties
).reverse_each do |path|
path = "#{framework_root_path}/#{path}"
$LOAD_PATH.unshift(path) if File.directory?(path)
@@ -68,7 +68,6 @@ module Rails
class VendorBoot < Boot
def load_initializer
- $:.unshift("#{framework_root_path}/railties/lib")
require "rails"
install_gem_spec_stubs
Rails::GemDependency.add_frozen_gem_path
diff --git a/railties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.fcgi b/railties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.fcgi
deleted file mode 100755
index f5b3b71875..0000000000
--- a/railties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.fcgi
+++ /dev/null
@@ -1,24 +0,0 @@
-<%= shebang %>
-#
-# You may specify the path to the FastCGI crash log (a log of unhandled
-# exceptions which forced the FastCGI instance to exit, great for debugging)
-# and the number of requests to process before running garbage collection.
-#
-# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
-# and the GC period is nil (turned off). A reasonable number of requests
-# could range from 10-100 depending on the memory footprint of your app.
-#
-# Example:
-# # Default log path, normal GC behavior.
-# RailsFCGIHandler.process!
-#
-# # Default log path, 50 requests between GC.
-# RailsFCGIHandler.process! nil, 50
-#
-# # Custom log path, normal GC behavior.
-# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
-#
-require File.dirname(__FILE__) + "/../config/environment"
-require 'fcgi_handler'
-
-RailsFCGIHandler.process!
diff --git a/railties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.rb b/railties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.rb
deleted file mode 100755
index 48e888113a..0000000000
--- a/railties/lib/rails/generators/rails/app/templates/dispatchers/dispatch.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-<%= shebang %>
-
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
-
-# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
-# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
-require "dispatcher"
-
-ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
-Dispatcher.dispatch
diff --git a/railties/lib/rails/generators/rails/app/templates/dispatchers/gateway.cgi b/railties/lib/rails/generators/rails/app/templates/dispatchers/gateway.cgi
deleted file mode 100755
index bdc1055a22..0000000000
--- a/railties/lib/rails/generators/rails/app/templates/dispatchers/gateway.cgi
+++ /dev/null
@@ -1,97 +0,0 @@
-<%= shebang %>
-
-require 'drb'
-
-# This file includes an experimental gateway CGI implementation. It will work
-# only on platforms which support both fork and sockets.
-#
-# To enable it edit public/.htaccess and replace dispatch.cgi with gateway.cgi.
-#
-# Next, create the directory log/drb_gateway and grant the apache user rw access
-# to said directory.
-#
-# On the next request to your server, the gateway tracker should start up, along
-# with a few listener processes. This setup should provide you with much better
-# speeds than dispatch.cgi.
-#
-# Keep in mind that the first request made to the server will be slow, as the
-# tracker and listeners will have to load. Also, the tracker and listeners will
-# shutdown after a period if inactivity. You can set this value below -- the
-# default is 90 seconds.
-
-TrackerSocket = File.expand_path(File.join(File.dirname(__FILE__), '../log/drb_gateway/tracker.sock'))
-DieAfter = 90 # Seconds
-Listeners = 3
-
-def message(s)
- $stderr.puts "gateway.cgi: #{s}" if ENV && ENV["DEBUG_GATEWAY"]
-end
-
-def listener_socket(number)
- File.expand_path(File.join(File.dirname(__FILE__), "../log/drb_gateway/listener_#{number}.sock"))
-end
-
-unless File.exist? TrackerSocket
- message "Starting tracker and #{Listeners} listeners"
- fork do
- Process.setsid
- STDIN.reopen "/dev/null"
- STDOUT.reopen "/dev/null", "a"
-
- root = File.expand_path(File.dirname(__FILE__) + '/..')
-
- message "starting tracker"
- fork do
- ARGV.clear
- ARGV << TrackerSocket << Listeners.to_s << DieAfter.to_s
- load File.join(root, 'script', 'tracker')
- end
-
- message "starting listeners"
- require File.join(root, 'config/environment.rb')
- Listeners.times do |number|
- fork do
- ARGV.clear
- ARGV << listener_socket(number) << DieAfter.to_s
- load File.join(root, 'script', 'listener')
- end
- end
- end
-
- message "waiting for tracker and listener to arise..."
- ready = false
- 10.times do
- sleep 0.5
- break if (ready = File.exist?(TrackerSocket) && File.exist?(listener_socket(0)))
- end
-
- if ready
- message "tracker and listener are ready"
- else
- message "Waited 5 seconds, listener and tracker not ready... dropping request"
- Kernel.exit 1
- end
-end
-
-DRb.start_service
-
-message "connecting to tracker"
-tracker = DRbObject.new_with_uri("drbunix:#{TrackerSocket}")
-
-input = $stdin.read
-$stdin.close
-
-env = ENV.inspect
-
-output = nil
-tracker.with_listener do |number|
- message "connecting to listener #{number}"
- socket = listener_socket(number)
- listener = DRbObject.new_with_uri("drbunix:#{socket}")
- output = listener.process(env, input)
- message "listener #{number} has finished, writing output"
-end
-
-$stdout.write output
-$stdout.flush
-$stdout.close