rails 2.2.3 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/CHANGELOG +272 -191
- data/MIT-LICENSE +1 -1
- data/README +6 -19
- data/Rakefile +24 -71
- data/bin/rails +1 -0
- data/builtin/rails_info/rails/info.rb +12 -8
- data/configs/databases/mysql.yml +3 -0
- data/configs/initializers/backtrace_silencers.rb +7 -0
- data/configs/initializers/new_rails_defaults.rb +2 -0
- data/configs/initializers/session_store.rb +15 -0
- data/dispatches/config.ru +7 -0
- data/doc/README_FOR_APP +2 -5
- data/environments/boot.rb +1 -0
- data/environments/environment.rb +14 -48
- data/environments/production.rb +11 -7
- data/environments/test.rb +6 -0
- data/helpers/application_controller.rb +10 -0
- data/helpers/test_helper.rb +1 -1
- data/html/500.html +0 -3
- data/html/index.html +1 -0
- data/lib/commands/about.rb +1 -1
- data/lib/commands/dbconsole.rb +18 -2
- data/lib/commands/plugin.rb +4 -3
- data/lib/commands/runner.rb +13 -7
- data/lib/commands/server.rb +98 -33
- data/lib/console_app.rb +4 -4
- data/lib/console_with_helpers.rb +2 -23
- data/lib/dispatcher.rb +1 -1
- data/lib/fcgi_handler.rb +12 -10
- data/lib/initializer.rb +108 -41
- data/lib/rails/backtrace_cleaner.rb +54 -0
- data/lib/rails/gem_dependency.rb +124 -94
- data/lib/rails/plugin.rb +49 -6
- data/lib/rails/plugin/loader.rb +66 -27
- data/lib/rails/plugin/locator.rb +1 -1
- data/lib/rails/rack.rb +3 -1
- data/lib/rails/rack/debugger.rb +21 -0
- data/lib/rails/rack/log_tailer.rb +35 -0
- data/lib/rails/rack/metal.rb +51 -0
- data/lib/rails/rack/static.rb +15 -4
- data/lib/rails/version.rb +2 -2
- data/lib/rails_generator/base.rb +3 -0
- data/lib/rails_generator/commands.rb +8 -3
- data/lib/rails_generator/generators/applications/app/app_generator.rb +210 -136
- data/lib/rails_generator/generators/applications/app/scm/git.rb +16 -0
- data/lib/rails_generator/generators/applications/app/scm/scm.rb +8 -0
- data/lib/rails_generator/generators/applications/app/scm/svn.rb +7 -0
- data/lib/rails_generator/generators/applications/app/template_runner.rb +401 -0
- data/lib/rails_generator/generators/components/controller/USAGE +12 -11
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +7 -1
- data/lib/rails_generator/generators/components/controller/templates/helper_test.rb +4 -0
- data/lib/rails_generator/generators/components/helper/USAGE +24 -0
- data/lib/rails_generator/generators/components/helper/helper_generator.rb +25 -0
- data/lib/rails_generator/generators/components/helper/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/helper/templates/helper_test.rb +4 -0
- data/lib/rails_generator/generators/components/metal/USAGE +8 -0
- data/lib/rails_generator/generators/components/metal/metal_generator.rb +8 -0
- data/lib/rails_generator/generators/components/metal/templates/metal.rb +12 -0
- data/lib/rails_generator/generators/components/resource/USAGE +2 -2
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +2 -0
- data/lib/rails_generator/generators/components/resource/templates/helper_test.rb +4 -0
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +2 -0
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +1 -1
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +4 -4
- data/lib/rails_generator/generators/components/scaffold/templates/helper_test.rb +4 -0
- data/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +1 -1
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +2 -2
- data/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +2 -2
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +2 -2
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +1 -1
- data/lib/rails_generator/secret_key_generator.rb +2 -0
- data/lib/tasks/databases.rake +13 -6
- data/lib/tasks/documentation.rake +2 -9
- data/lib/tasks/framework.rake +26 -1
- data/lib/tasks/gems.rake +33 -48
- data/lib/tasks/middleware.rake +7 -0
- data/lib/tasks/misc.rake +7 -0
- data/lib/tasks/statistics.rake +0 -1
- data/lib/tasks/testing.rake +5 -5
- data/lib/tasks/tmp.rake +2 -2
- data/lib/test_help.rb +16 -8
- metadata +92 -159
- data/bin/performance/request +0 -3
- data/bin/process/inspector +0 -3
- data/bin/process/reaper +0 -3
- data/bin/process/spawner +0 -3
- data/config.ru +0 -17
- data/configs/apache.conf +0 -40
- data/configs/lighttpd.conf +0 -54
- data/doc/guides/html/2_2_release_notes.html +0 -1185
- data/doc/guides/html/actioncontroller_basics.html +0 -1270
- data/doc/guides/html/activerecord_validations_callbacks.html +0 -749
- data/doc/guides/html/association_basics.html +0 -2585
- data/doc/guides/html/authors.html +0 -240
- data/doc/guides/html/benchmarking_and_profiling.html +0 -1018
- data/doc/guides/html/caching_with_rails.html +0 -583
- data/doc/guides/html/command_line.html +0 -434
- data/doc/guides/html/configuring.html +0 -438
- data/doc/guides/html/creating_plugins.html +0 -1594
- data/doc/guides/html/debugging_rails_applications.html +0 -1175
- data/doc/guides/html/finders.html +0 -1090
- data/doc/guides/html/form_helpers.html +0 -638
- data/doc/guides/html/getting_started_with_rails.html +0 -2066
- data/doc/guides/html/index.html +0 -349
- data/doc/guides/html/layouts_and_rendering.html +0 -1406
- data/doc/guides/html/migrations.html +0 -921
- data/doc/guides/html/routing_outside_in.html +0 -2213
- data/doc/guides/html/security.html +0 -1346
- data/doc/guides/html/testing_rails_applications.html +0 -1859
- data/doc/guides/source/2_2_release_notes.txt +0 -435
- data/doc/guides/source/actioncontroller_basics/changelog.txt +0 -5
- data/doc/guides/source/actioncontroller_basics/cookies.txt +0 -34
- data/doc/guides/source/actioncontroller_basics/csrf.txt +0 -32
- data/doc/guides/source/actioncontroller_basics/filters.txt +0 -119
- data/doc/guides/source/actioncontroller_basics/http_auth.txt +0 -24
- data/doc/guides/source/actioncontroller_basics/index.txt +0 -40
- data/doc/guides/source/actioncontroller_basics/introduction.txt +0 -9
- data/doc/guides/source/actioncontroller_basics/methods.txt +0 -39
- data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +0 -14
- data/doc/guides/source/actioncontroller_basics/params.txt +0 -93
- data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +0 -43
- data/doc/guides/source/actioncontroller_basics/rescue.txt +0 -67
- data/doc/guides/source/actioncontroller_basics/session.txt +0 -187
- data/doc/guides/source/actioncontroller_basics/streaming.txt +0 -91
- data/doc/guides/source/actioncontroller_basics/verification.txt +0 -40
- data/doc/guides/source/active_record_basics.txt +0 -181
- data/doc/guides/source/activerecord_validations_callbacks.txt +0 -404
- data/doc/guides/source/association_basics.txt +0 -1840
- data/doc/guides/source/authors.txt +0 -39
- data/doc/guides/source/benchmarking_and_profiling/appendix.txt +0 -95
- data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +0 -105
- data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +0 -185
- data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +0 -27
- data/doc/guides/source/benchmarking_and_profiling/index.txt +0 -242
- data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +0 -179
- data/doc/guides/source/benchmarking_and_profiling/statistics.txt +0 -57
- data/doc/guides/source/caching_with_rails.txt +0 -367
- data/doc/guides/source/command_line.txt +0 -147
- data/doc/guides/source/configuring.txt +0 -225
- data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +0 -191
- data/doc/guides/source/creating_plugins/appendix.txt +0 -46
- data/doc/guides/source/creating_plugins/controllers.txt +0 -59
- data/doc/guides/source/creating_plugins/core_ext.txt +0 -123
- data/doc/guides/source/creating_plugins/custom_route.txt +0 -69
- data/doc/guides/source/creating_plugins/gem.txt +0 -1
- data/doc/guides/source/creating_plugins/generator_method.txt +0 -89
- data/doc/guides/source/creating_plugins/helpers.txt +0 -51
- data/doc/guides/source/creating_plugins/index.txt +0 -52
- data/doc/guides/source/creating_plugins/migration_generator.txt +0 -156
- data/doc/guides/source/creating_plugins/models.txt +0 -76
- data/doc/guides/source/creating_plugins/odds_and_ends.txt +0 -69
- data/doc/guides/source/creating_plugins/test_setup.txt +0 -230
- data/doc/guides/source/debugging_rails_applications.txt +0 -733
- data/doc/guides/source/finders.txt +0 -668
- data/doc/guides/source/form_helpers.txt +0 -345
- data/doc/guides/source/getting_started_with_rails.txt +0 -1256
- data/doc/guides/source/images/belongs_to.png +0 -0
- data/doc/guides/source/images/bullet.gif +0 -0
- data/doc/guides/source/images/csrf.png +0 -0
- data/doc/guides/source/images/habtm.png +0 -0
- data/doc/guides/source/images/has_many.png +0 -0
- data/doc/guides/source/images/has_many_through.png +0 -0
- data/doc/guides/source/images/has_one.png +0 -0
- data/doc/guides/source/images/has_one_through.png +0 -0
- data/doc/guides/source/images/header_backdrop.png +0 -0
- data/doc/guides/source/images/icons/README +0 -5
- data/doc/guides/source/images/icons/callouts/1.png +0 -0
- data/doc/guides/source/images/icons/callouts/10.png +0 -0
- data/doc/guides/source/images/icons/callouts/11.png +0 -0
- data/doc/guides/source/images/icons/callouts/12.png +0 -0
- data/doc/guides/source/images/icons/callouts/13.png +0 -0
- data/doc/guides/source/images/icons/callouts/14.png +0 -0
- data/doc/guides/source/images/icons/callouts/15.png +0 -0
- data/doc/guides/source/images/icons/callouts/2.png +0 -0
- data/doc/guides/source/images/icons/callouts/3.png +0 -0
- data/doc/guides/source/images/icons/callouts/4.png +0 -0
- data/doc/guides/source/images/icons/callouts/5.png +0 -0
- data/doc/guides/source/images/icons/callouts/6.png +0 -0
- data/doc/guides/source/images/icons/callouts/7.png +0 -0
- data/doc/guides/source/images/icons/callouts/8.png +0 -0
- data/doc/guides/source/images/icons/callouts/9.png +0 -0
- data/doc/guides/source/images/icons/caution.png +0 -0
- data/doc/guides/source/images/icons/example.png +0 -0
- data/doc/guides/source/images/icons/home.png +0 -0
- data/doc/guides/source/images/icons/important.png +0 -0
- data/doc/guides/source/images/icons/next.png +0 -0
- data/doc/guides/source/images/icons/note.png +0 -0
- data/doc/guides/source/images/icons/prev.png +0 -0
- data/doc/guides/source/images/icons/tip.png +0 -0
- data/doc/guides/source/images/icons/up.png +0 -0
- data/doc/guides/source/images/icons/warning.png +0 -0
- data/doc/guides/source/images/polymorphic.png +0 -0
- data/doc/guides/source/images/rails_logo_remix.gif +0 -0
- data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
- data/doc/guides/source/images/session_fixation.png +0 -0
- data/doc/guides/source/index.txt +0 -118
- data/doc/guides/source/layouts_and_rendering.txt +0 -982
- data/doc/guides/source/migrations/anatomy_of_a_migration.txt +0 -85
- data/doc/guides/source/migrations/changelog.txt +0 -5
- data/doc/guides/source/migrations/creating_a_migration.txt +0 -109
- data/doc/guides/source/migrations/foreign_keys.txt +0 -8
- data/doc/guides/source/migrations/index.txt +0 -22
- data/doc/guides/source/migrations/rakeing_around.txt +0 -111
- data/doc/guides/source/migrations/scheming.txt +0 -47
- data/doc/guides/source/migrations/using_models_in_migrations.txt +0 -46
- data/doc/guides/source/migrations/writing_a_migration.txt +0 -159
- data/doc/guides/source/routing_outside_in.txt +0 -986
- data/doc/guides/source/security.txt +0 -984
- data/doc/guides/source/stylesheets/base.css +0 -358
- data/doc/guides/source/stylesheets/forms.css +0 -35
- data/doc/guides/source/stylesheets/more.css +0 -82
- data/doc/guides/source/templates/guides.html.erb +0 -97
- data/doc/guides/source/templates/inline.css +0 -165
- data/doc/guides/source/testing_rails_applications.txt +0 -995
- data/helpers/application.rb +0 -15
- data/lib/commands/performance/request.rb +0 -6
- data/lib/commands/process/inspector.rb +0 -68
- data/lib/commands/process/reaper.rb +0 -149
- data/lib/commands/process/spawner.rb +0 -219
- data/lib/commands/process/spinner.rb +0 -57
- data/lib/commands/servers/base.rb +0 -31
- data/lib/commands/servers/lighttpd.rb +0 -94
- data/lib/commands/servers/mongrel.rb +0 -69
- data/lib/commands/servers/new_mongrel.rb +0 -16
- data/lib/commands/servers/thin.rb +0 -25
- data/lib/commands/servers/webrick.rb +0 -66
- data/lib/rails/mongrel_server/commands.rb +0 -342
- data/lib/rails/mongrel_server/handler.rb +0 -55
- data/lib/rails/rack/logger.rb +0 -28
data/environments/test.rb
CHANGED
@@ -12,6 +12,7 @@ config.whiny_nils = true
|
|
12
12
|
# Show full error reports and disable caching
|
13
13
|
config.action_controller.consider_all_requests_local = true
|
14
14
|
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
15
16
|
|
16
17
|
# Disable request forgery protection in test environment
|
17
18
|
config.action_controller.allow_forgery_protection = false
|
@@ -20,3 +21,8 @@ config.action_controller.allow_forgery_protection = false
|
|
20
21
|
# The :test delivery method accumulates sent emails in the
|
21
22
|
# ActionMailer::Base.deliveries array.
|
22
23
|
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
+
|
8
|
+
# Scrub sensitive parameters from your log
|
9
|
+
# filter_parameter_logging :password
|
10
|
+
end
|
data/helpers/test_helper.rb
CHANGED
@@ -2,7 +2,7 @@ ENV["RAILS_ENV"] = "test"
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
3
|
require 'test_help'
|
4
4
|
|
5
|
-
class
|
5
|
+
class ActiveSupport::TestCase
|
6
6
|
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
7
|
# in a transaction that's rolled back on completion. This ensures that the
|
8
8
|
# test database remains unchanged so your fixtures don't have to be reloaded
|
data/html/500.html
CHANGED
@@ -25,9 +25,6 @@
|
|
25
25
|
<div class="dialog">
|
26
26
|
<h1>We're sorry, but something went wrong.</h1>
|
27
27
|
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
28
|
-
<p><small>(If you're the administrator of this website, then please read
|
29
|
-
the log file "<%= "<%s>" % "%=h RAILS_ENV %" %>.log"
|
30
|
-
to find out what went wrong.)</small></p>
|
31
28
|
</div>
|
32
29
|
</body>
|
33
30
|
</html>
|
data/html/index.html
CHANGED
@@ -229,6 +229,7 @@
|
|
229
229
|
<li><a href="http://api.rubyonrails.org/">Rails API</a></li>
|
230
230
|
<li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
|
231
231
|
<li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
|
232
|
+
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
|
232
233
|
</ul>
|
233
234
|
</li>
|
234
235
|
</ul>
|
data/lib/commands/about.rb
CHANGED
data/lib/commands/dbconsole.rb
CHANGED
@@ -3,12 +3,23 @@ require 'yaml'
|
|
3
3
|
require 'optparse'
|
4
4
|
|
5
5
|
include_password = false
|
6
|
+
options = {}
|
6
7
|
|
7
8
|
OptionParser.new do |opt|
|
8
9
|
opt.banner = "Usage: dbconsole [options] [environment]"
|
9
10
|
opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v|
|
10
11
|
include_password = true
|
11
12
|
end
|
13
|
+
|
14
|
+
opt.on("--mode [MODE]", ['html', 'list', 'line', 'column'],
|
15
|
+
"Automatically put the sqlite3 database in the specified mode (html, list, line, column).") do |mode|
|
16
|
+
options['mode'] = mode
|
17
|
+
end
|
18
|
+
|
19
|
+
opt.on("-h", "--header") do |h|
|
20
|
+
options['header'] = h
|
21
|
+
end
|
22
|
+
|
12
23
|
opt.parse!(ARGV)
|
13
24
|
abort opt.to_s unless (0..1).include?(ARGV.size)
|
14
25
|
end
|
@@ -41,7 +52,7 @@ when "mysql"
|
|
41
52
|
|
42
53
|
if config['password'] && include_password
|
43
54
|
args << "--password=#{config['password']}"
|
44
|
-
elsif config['password'] && !config['password'].empty?
|
55
|
+
elsif config['password'] && !config['password'].to_s.empty?
|
45
56
|
args << "-p"
|
46
57
|
end
|
47
58
|
|
@@ -60,8 +71,13 @@ when "sqlite"
|
|
60
71
|
exec(find_cmd('sqlite'), config["database"])
|
61
72
|
|
62
73
|
when "sqlite3"
|
63
|
-
|
74
|
+
args = []
|
75
|
+
|
76
|
+
args << "-#{options['mode']}" if options['mode']
|
77
|
+
args << "-header" if options['header']
|
78
|
+
args << config['database']
|
64
79
|
|
80
|
+
exec(find_cmd('sqlite3'), *args)
|
65
81
|
else
|
66
82
|
abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!"
|
67
83
|
end
|
data/lib/commands/plugin.rb
CHANGED
@@ -134,7 +134,8 @@ class RailsEnvironment
|
|
134
134
|
def externals
|
135
135
|
return [] unless use_externals?
|
136
136
|
ext = `svn propget svn:externals "#{root}/vendor/plugins"`
|
137
|
-
|
137
|
+
lines = ext.respond_to?(:lines) ? ext.lines : ext
|
138
|
+
lines.reject{ |line| line.strip == '' }.map do |line|
|
138
139
|
line.strip.split(/\s+/, 2)
|
139
140
|
end
|
140
141
|
end
|
@@ -278,8 +279,8 @@ class Plugin
|
|
278
279
|
base_cmd += " #{options[:revision]}" if options[:revision]
|
279
280
|
puts base_cmd if $verbose
|
280
281
|
if system(base_cmd)
|
281
|
-
puts "removing: .git" if $verbose
|
282
|
-
rm_rf
|
282
|
+
puts "removing: .git .gitignore" if $verbose
|
283
|
+
rm_rf %w(.git .gitignore)
|
283
284
|
else
|
284
285
|
rm_rf install_path
|
285
286
|
end
|
data/lib/commands/runner.rb
CHANGED
@@ -38,11 +38,17 @@ RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
|
|
38
38
|
|
39
39
|
require RAILS_ROOT + '/config/environment'
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
begin
|
42
|
+
if code_or_file.nil?
|
43
|
+
$stderr.puts "Run '#{$0} -h' for help."
|
44
|
+
exit 1
|
45
|
+
elsif File.exist?(code_or_file)
|
46
|
+
eval(File.read(code_or_file), nil, code_or_file)
|
47
|
+
else
|
48
|
+
eval(code_or_file)
|
49
|
+
end
|
50
|
+
ensure
|
51
|
+
if defined? Rails
|
52
|
+
Rails.logger.flush if Rails.logger.respond_to?(:flush)
|
53
|
+
end
|
48
54
|
end
|
data/lib/commands/server.rb
CHANGED
@@ -1,49 +1,114 @@
|
|
1
1
|
require 'active_support'
|
2
|
+
require 'action_controller'
|
3
|
+
|
2
4
|
require 'fileutils'
|
5
|
+
require 'optparse'
|
3
6
|
|
7
|
+
# TODO: Push Thin adapter upstream so we don't need worry about requiring it
|
4
8
|
begin
|
5
|
-
require_library_or_gem '
|
9
|
+
require_library_or_gem 'thin'
|
6
10
|
rescue Exception
|
7
|
-
#
|
11
|
+
# Thin not available
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
options = {
|
15
|
+
:Port => 3000,
|
16
|
+
:Host => "0.0.0.0",
|
17
|
+
:environment => (ENV['RAILS_ENV'] || "development").dup,
|
18
|
+
:config => RAILS_ROOT + "/config.ru",
|
19
|
+
:detach => false,
|
20
|
+
:debugger => false,
|
21
|
+
:path => nil
|
22
|
+
}
|
23
|
+
|
24
|
+
ARGV.clone.options do |opts|
|
25
|
+
opts.on("-p", "--port=port", Integer,
|
26
|
+
"Runs Rails on the specified port.", "Default: 3000") { |v| options[:Port] = v }
|
27
|
+
opts.on("-b", "--binding=ip", String,
|
28
|
+
"Binds Rails to the specified ip.", "Default: 0.0.0.0") { |v| options[:Host] = v }
|
29
|
+
opts.on("-c", "--config=file", String,
|
30
|
+
"Use custom rackup configuration file") { |v| options[:config] = v }
|
31
|
+
opts.on("-d", "--daemon", "Make server run as a Daemon.") { options[:detach] = true }
|
32
|
+
opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { options[:debugger] = true }
|
33
|
+
opts.on("-e", "--environment=name", String,
|
34
|
+
"Specifies the environment to run this server under (test/development/production).",
|
35
|
+
"Default: development") { |v| options[:environment] = v }
|
36
|
+
opts.on("-P", "--path=/path", String, "Runs Rails app mounted at a specific path.", "Default: /") { |v| options[:path] = v }
|
37
|
+
|
38
|
+
opts.separator ""
|
39
|
+
|
40
|
+
opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
|
41
|
+
|
42
|
+
opts.parse!
|
14
43
|
end
|
15
44
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
45
|
+
server = Rack::Handler.get(ARGV.first) rescue nil
|
46
|
+
unless server
|
47
|
+
begin
|
48
|
+
server = Rack::Handler::Mongrel
|
49
|
+
rescue LoadError => e
|
50
|
+
server = Rack::Handler::WEBrick
|
51
|
+
end
|
20
52
|
end
|
21
53
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
54
|
+
puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
|
55
|
+
puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}#{options[:path]}"
|
56
|
+
|
57
|
+
%w(cache pids sessions sockets).each do |dir_to_make|
|
58
|
+
FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make))
|
59
|
+
end
|
60
|
+
|
61
|
+
if options[:detach]
|
62
|
+
Process.daemon
|
63
|
+
pid = "#{RAILS_ROOT}/tmp/pids/server.pid"
|
64
|
+
File.open(pid, 'w'){ |f| f.write(Process.pid) }
|
65
|
+
at_exit { File.delete(pid) if File.exist?(pid) }
|
66
|
+
end
|
67
|
+
|
68
|
+
ENV["RAILS_ENV"] = options[:environment]
|
69
|
+
RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
|
70
|
+
|
71
|
+
if File.exist?(options[:config])
|
72
|
+
config = options[:config]
|
73
|
+
if config =~ /\.ru$/
|
74
|
+
cfgfile = File.read(config)
|
75
|
+
if cfgfile[/^#\\(.*)/]
|
76
|
+
opts.parse!($1.split(/\s+/))
|
34
77
|
end
|
78
|
+
inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config)
|
79
|
+
else
|
80
|
+
require config
|
81
|
+
inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
|
82
|
+
end
|
83
|
+
else
|
84
|
+
require RAILS_ROOT + "/config/environment"
|
85
|
+
inner_app = ActionController::Dispatcher.new
|
35
86
|
end
|
36
87
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
when "mongrel", "new_mongrel"
|
43
|
-
puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
|
44
|
-
when "thin"
|
45
|
-
puts "=> Booting Thin (use 'script/server webrick' to force WEBrick)"
|
88
|
+
if options[:path].nil?
|
89
|
+
map_path = "/"
|
90
|
+
else
|
91
|
+
ActionController::Base.relative_url_root = options[:path]
|
92
|
+
map_path = options[:path]
|
46
93
|
end
|
47
94
|
|
48
|
-
|
49
|
-
|
95
|
+
app = Rack::Builder.new {
|
96
|
+
use Rails::Rack::LogTailer unless options[:detach]
|
97
|
+
use Rails::Rack::Debugger if options[:debugger]
|
98
|
+
map map_path do
|
99
|
+
use Rails::Rack::Static
|
100
|
+
run inner_app
|
101
|
+
end
|
102
|
+
}.to_app
|
103
|
+
|
104
|
+
puts "=> Call with -d to detach"
|
105
|
+
|
106
|
+
trap(:INT) { exit }
|
107
|
+
|
108
|
+
puts "=> Ctrl-C to shutdown server"
|
109
|
+
|
110
|
+
begin
|
111
|
+
server.run(app, options.merge(:AccessLog => []))
|
112
|
+
ensure
|
113
|
+
puts 'Exiting'
|
114
|
+
end
|
data/lib/console_app.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_support/test_case'
|
2
|
+
require 'action_controller'
|
2
3
|
|
3
4
|
# work around the at_exit hook in test/unit, which kills IRB
|
4
5
|
Test::Unit.run = true if Test::Unit.respond_to?(:run=)
|
@@ -23,8 +24,7 @@ end
|
|
23
24
|
#reloads the environment
|
24
25
|
def reload!
|
25
26
|
puts "Reloading..."
|
26
|
-
|
27
|
-
|
28
|
-
dispatcher.reload_application
|
27
|
+
Dispatcher.cleanup_application
|
28
|
+
Dispatcher.reload_application
|
29
29
|
true
|
30
30
|
end
|
data/lib/console_with_helpers.rb
CHANGED
@@ -1,26 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
parent_module.constants.each do |const|
|
4
|
-
mod = parent_module.const_get(const)
|
5
|
-
if mod.class == Module
|
6
|
-
send(:include, mod)
|
7
|
-
include_all_modules_from(mod)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def helper(*helper_names)
|
14
|
-
returning @helper_proxy ||= Object.new do |helper|
|
15
|
-
helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
require_dependency 'application'
|
20
|
-
|
21
|
-
class << helper
|
22
|
-
include_all_modules_from ActionView
|
1
|
+
def helper
|
2
|
+
@helper ||= ApplicationController.helpers
|
23
3
|
end
|
24
4
|
|
25
5
|
@controller = ApplicationController.new
|
26
|
-
helper :application rescue nil
|
data/lib/dispatcher.rb
CHANGED
data/lib/fcgi_handler.rb
CHANGED
@@ -38,6 +38,8 @@ class RailsFCGIHandler
|
|
38
38
|
# Safely install signal handlers.
|
39
39
|
install_signal_handlers
|
40
40
|
|
41
|
+
@app = Dispatcher.new
|
42
|
+
|
41
43
|
# Start error timestamp at 11 seconds ago.
|
42
44
|
@last_error_on = Time.now - 11
|
43
45
|
end
|
@@ -69,36 +71,36 @@ class RailsFCGIHandler
|
|
69
71
|
|
70
72
|
protected
|
71
73
|
def process_each_request(provider)
|
72
|
-
|
74
|
+
request = nil
|
73
75
|
|
74
76
|
catch :exit do
|
75
|
-
provider.
|
76
|
-
process_request(
|
77
|
+
provider.each do |request|
|
78
|
+
process_request(request)
|
77
79
|
|
78
80
|
case when_ready
|
79
81
|
when :reload
|
80
82
|
reload!
|
81
83
|
when :restart
|
82
|
-
close_connection(
|
84
|
+
close_connection(request)
|
83
85
|
restart!
|
84
86
|
when :exit
|
85
|
-
close_connection(
|
87
|
+
close_connection(request)
|
86
88
|
throw :exit
|
87
89
|
end
|
88
90
|
end
|
89
91
|
end
|
90
92
|
rescue SignalException => signal
|
91
93
|
raise unless signal.message == 'SIGUSR1'
|
92
|
-
close_connection(
|
94
|
+
close_connection(request)
|
93
95
|
end
|
94
96
|
|
95
|
-
def process_request(
|
97
|
+
def process_request(request)
|
96
98
|
@processing, @when_ready = true, nil
|
97
99
|
gc_countdown
|
98
100
|
|
99
101
|
with_signal_handler 'USR1' do
|
100
102
|
begin
|
101
|
-
|
103
|
+
::Rack::Handler::FastCGI.serve(request, @app)
|
102
104
|
rescue SignalException, SystemExit
|
103
105
|
raise
|
104
106
|
rescue Exception => error
|
@@ -231,7 +233,7 @@ class RailsFCGIHandler
|
|
231
233
|
end
|
232
234
|
end
|
233
235
|
|
234
|
-
def close_connection(
|
235
|
-
|
236
|
+
def close_connection(request)
|
237
|
+
request.finish if request
|
236
238
|
end
|
237
239
|
end
|
data/lib/initializer.rb
CHANGED
@@ -40,19 +40,20 @@ module Rails
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
def backtrace_cleaner
|
44
|
+
@@backtrace_cleaner ||= begin
|
45
|
+
# Relies on ActiveSupport, so we have to lazy load to postpone definition until AS has been loaded
|
46
|
+
require 'rails/backtrace_cleaner'
|
47
|
+
Rails::BacktraceCleaner.new
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def root
|
52
|
+
Pathname.new(RAILS_ROOT) if defined?(RAILS_ROOT)
|
53
|
+
end
|
54
|
+
|
51
55
|
def env
|
52
|
-
@_env ||=
|
53
|
-
require 'active_support/string_inquirer'
|
54
|
-
ActiveSupport::StringInquirer.new(RAILS_ENV)
|
55
|
-
end
|
56
|
+
@_env ||= ActiveSupport::StringInquirer.new(RAILS_ENV)
|
56
57
|
end
|
57
58
|
|
58
59
|
def cache
|
@@ -134,6 +135,7 @@ module Rails
|
|
134
135
|
set_autoload_paths
|
135
136
|
add_plugin_load_paths
|
136
137
|
load_environment
|
138
|
+
preload_frameworks
|
137
139
|
|
138
140
|
initialize_encoding
|
139
141
|
initialize_database
|
@@ -146,7 +148,6 @@ module Rails
|
|
146
148
|
|
147
149
|
initialize_dependency_mechanism
|
148
150
|
initialize_whiny_nils
|
149
|
-
initialize_temporary_session_directory
|
150
151
|
|
151
152
|
initialize_time_zone
|
152
153
|
initialize_i18n
|
@@ -154,6 +155,8 @@ module Rails
|
|
154
155
|
initialize_framework_settings
|
155
156
|
initialize_framework_views
|
156
157
|
|
158
|
+
initialize_metal
|
159
|
+
|
157
160
|
add_support_load_paths
|
158
161
|
|
159
162
|
load_gems
|
@@ -164,11 +167,18 @@ module Rails
|
|
164
167
|
load_gems
|
165
168
|
check_gem_dependencies
|
166
169
|
|
170
|
+
# bail out if gems are missing - note that check_gem_dependencies will have
|
171
|
+
# already called abort() unless $gems_rake_task is set
|
172
|
+
return unless gems_dependencies_loaded
|
173
|
+
|
167
174
|
load_application_initializers
|
168
175
|
|
169
176
|
# the framework is now fully initialized
|
170
177
|
after_initialize
|
171
178
|
|
179
|
+
# Setup database middleware after initializers have run
|
180
|
+
initialize_database_middleware
|
181
|
+
|
172
182
|
# Prepare dispatcher callbacks and run 'prepare' callbacks
|
173
183
|
prepare_dispatcher
|
174
184
|
|
@@ -255,10 +265,23 @@ module Rails
|
|
255
265
|
def require_frameworks
|
256
266
|
configuration.frameworks.each { |framework| require(framework.to_s) }
|
257
267
|
rescue LoadError => e
|
258
|
-
#
|
268
|
+
# Re-raise as RuntimeError because Mongrel would swallow LoadError.
|
259
269
|
raise e.to_s
|
260
270
|
end
|
261
271
|
|
272
|
+
# Preload all frameworks specified by the Configuration#frameworks.
|
273
|
+
# Used by Passenger to ensure everything's loaded before forking and
|
274
|
+
# to avoid autoload race conditions in JRuby.
|
275
|
+
def preload_frameworks
|
276
|
+
if configuration.preload_frameworks
|
277
|
+
configuration.frameworks.each do |framework|
|
278
|
+
# String#classify and #constantize aren't available yet.
|
279
|
+
toplevel = Object.const_get(framework.to_s.gsub(/(?:^|_)(.)/) { $1.upcase })
|
280
|
+
toplevel.load_all! if toplevel.respond_to?(:load_all!)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
262
285
|
# Add the load paths used by support functions such as the info controller
|
263
286
|
def add_support_load_paths
|
264
287
|
end
|
@@ -278,7 +301,9 @@ module Rails
|
|
278
301
|
end
|
279
302
|
|
280
303
|
def load_gems
|
281
|
-
|
304
|
+
unless $gems_build_rake_task
|
305
|
+
@configuration.gems.each { |gem| gem.load }
|
306
|
+
end
|
282
307
|
end
|
283
308
|
|
284
309
|
def check_gem_dependencies
|
@@ -286,7 +311,7 @@ module Rails
|
|
286
311
|
if unloaded_gems.size > 0
|
287
312
|
@gems_dependencies_loaded = false
|
288
313
|
# don't print if the gems rake tasks are being run
|
289
|
-
unless $
|
314
|
+
unless $gems_rake_task
|
290
315
|
abort <<-end_error
|
291
316
|
Missing these required gems:
|
292
317
|
#{unloaded_gems.map { |gem| "#{gem.name} #{gem.requirement}" } * "\n "}
|
@@ -353,14 +378,14 @@ Run `rake gems:install` to install the missing gems.
|
|
353
378
|
|
354
379
|
def load_view_paths
|
355
380
|
if configuration.frameworks.include?(:action_view)
|
356
|
-
|
357
|
-
|
358
|
-
ActionMailer::Base.template_root.load if configuration.frameworks.include?(:action_mailer)
|
381
|
+
ActionController::Base.view_paths.load! if configuration.frameworks.include?(:action_controller)
|
382
|
+
ActionMailer::Base.view_paths.load! if configuration.frameworks.include?(:action_mailer)
|
359
383
|
end
|
360
384
|
end
|
361
385
|
|
362
386
|
# Eager load application classes
|
363
387
|
def load_application_classes
|
388
|
+
return if $rails_rake_task
|
364
389
|
if configuration.cache_classes
|
365
390
|
configuration.eager_load_paths.each do |load_path|
|
366
391
|
matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/
|
@@ -393,9 +418,26 @@ Run `rake gems:install` to install the missing gems.
|
|
393
418
|
end
|
394
419
|
end
|
395
420
|
|
421
|
+
def initialize_database_middleware
|
422
|
+
if configuration.frameworks.include?(:active_record)
|
423
|
+
if ActionController::Base.session_store == ActiveRecord::SessionStore
|
424
|
+
configuration.middleware.insert_before :"ActiveRecord::SessionStore", ActiveRecord::ConnectionAdapters::ConnectionManagement
|
425
|
+
configuration.middleware.insert_before :"ActiveRecord::SessionStore", ActiveRecord::QueryCache
|
426
|
+
else
|
427
|
+
configuration.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement
|
428
|
+
configuration.middleware.use ActiveRecord::QueryCache
|
429
|
+
end
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
396
433
|
def initialize_cache
|
397
434
|
unless defined?(RAILS_CACHE)
|
398
435
|
silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(configuration.cache_store) }
|
436
|
+
|
437
|
+
if RAILS_CACHE.respond_to?(:middleware)
|
438
|
+
# Insert middleware to setup and teardown local cache for each request
|
439
|
+
configuration.middleware.insert_after(:"ActionController::Failsafe", RAILS_CACHE.middleware)
|
440
|
+
end
|
399
441
|
end
|
400
442
|
end
|
401
443
|
|
@@ -456,9 +498,9 @@ Run `rake gems:install` to install the missing gems.
|
|
456
498
|
# set to use Configuration#view_path.
|
457
499
|
def initialize_framework_views
|
458
500
|
if configuration.frameworks.include?(:action_view)
|
459
|
-
view_path = ActionView::PathSet
|
460
|
-
ActionMailer::Base.template_root
|
461
|
-
ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.
|
501
|
+
view_path = ActionView::PathSet.type_cast(configuration.view_path)
|
502
|
+
ActionMailer::Base.template_root = view_path if configuration.frameworks.include?(:action_mailer) && ActionMailer::Base.view_paths.blank?
|
503
|
+
ActionController::Base.view_paths = view_path if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.blank?
|
462
504
|
end
|
463
505
|
end
|
464
506
|
|
@@ -467,9 +509,10 @@ Run `rake gems:install` to install the missing gems.
|
|
467
509
|
# loading module used to lazily load controllers (Configuration#controller_paths).
|
468
510
|
def initialize_routing
|
469
511
|
return unless configuration.frameworks.include?(:action_controller)
|
470
|
-
|
471
|
-
ActionController::Routing
|
472
|
-
ActionController::Routing::Routes.
|
512
|
+
|
513
|
+
ActionController::Routing.controller_paths += configuration.controller_paths
|
514
|
+
ActionController::Routing::Routes.add_configuration_file(configuration.routes_configuration_file)
|
515
|
+
ActionController::Routing::Routes.reload!
|
473
516
|
end
|
474
517
|
|
475
518
|
# Sets the dependency loading mechanism based on the value of
|
@@ -484,22 +527,20 @@ Run `rake gems:install` to install the missing gems.
|
|
484
527
|
require('active_support/whiny_nil') if configuration.whiny_nils
|
485
528
|
end
|
486
529
|
|
487
|
-
def initialize_temporary_session_directory
|
488
|
-
if configuration.frameworks.include?(:action_controller)
|
489
|
-
session_path = "#{configuration.root_path}/tmp/sessions/"
|
490
|
-
ActionController::Base.session_options[:tmpdir] = File.exist?(session_path) ? session_path : Dir::tmpdir
|
491
|
-
end
|
492
|
-
end
|
493
|
-
|
494
530
|
# Sets the default value for Time.zone, and turns on ActiveRecord::Base#time_zone_aware_attributes.
|
495
531
|
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
|
496
532
|
def initialize_time_zone
|
497
533
|
if configuration.time_zone
|
498
534
|
zone_default = Time.__send__(:get_zone, configuration.time_zone)
|
535
|
+
|
499
536
|
unless zone_default
|
500
|
-
raise
|
537
|
+
raise \
|
538
|
+
'Value assigned to config.time_zone not recognized.' +
|
539
|
+
'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
|
501
540
|
end
|
541
|
+
|
502
542
|
Time.zone_default = zone_default
|
543
|
+
|
503
544
|
if configuration.frameworks.include?(:active_record)
|
504
545
|
ActiveRecord::Base.time_zone_aware_attributes = true
|
505
546
|
ActiveRecord::Base.default_timezone = :utc
|
@@ -507,7 +548,7 @@ Run `rake gems:install` to install the missing gems.
|
|
507
548
|
end
|
508
549
|
end
|
509
550
|
|
510
|
-
# Set the i18n configuration from config.i18n but special-case for the load_path which should be
|
551
|
+
# Set the i18n configuration from config.i18n but special-case for the load_path which should be
|
511
552
|
# appended to what's already set instead of overwritten.
|
512
553
|
def initialize_i18n
|
513
554
|
configuration.i18n.each do |setting, value|
|
@@ -519,6 +560,15 @@ Run `rake gems:install` to install the missing gems.
|
|
519
560
|
end
|
520
561
|
end
|
521
562
|
|
563
|
+
def initialize_metal
|
564
|
+
Rails::Rack::Metal.requested_metals = configuration.metals
|
565
|
+
Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths
|
566
|
+
|
567
|
+
configuration.middleware.insert_before(
|
568
|
+
:"ActionController::RewindableInput",
|
569
|
+
Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?)
|
570
|
+
end
|
571
|
+
|
522
572
|
# Initializes framework-specific settings for each of the loaded frameworks
|
523
573
|
# (Configuration#frameworks). The available settings map to the accessors
|
524
574
|
# on each of the corresponding Base classes.
|
@@ -556,7 +606,7 @@ Run `rake gems:install` to install the missing gems.
|
|
556
606
|
return unless configuration.frameworks.include?(:action_controller)
|
557
607
|
require 'dispatcher' unless defined?(::Dispatcher)
|
558
608
|
Dispatcher.define_dispatcher_callbacks(configuration.cache_classes)
|
559
|
-
Dispatcher.
|
609
|
+
Dispatcher.run_prepare_callbacks
|
560
610
|
end
|
561
611
|
|
562
612
|
def disable_dependency_loading
|
@@ -597,12 +647,15 @@ Run `rake gems:install` to install the missing gems.
|
|
597
647
|
# A stub for setting options on ActiveSupport.
|
598
648
|
attr_accessor :active_support
|
599
649
|
|
650
|
+
# Whether to preload all frameworks at startup.
|
651
|
+
attr_accessor :preload_frameworks
|
652
|
+
|
600
653
|
# Whether or not classes should be cached (set to false if you want
|
601
654
|
# application classes to be reloaded on each request)
|
602
655
|
attr_accessor :cache_classes
|
603
656
|
|
604
657
|
# The list of paths that should be searched for controllers. (Defaults
|
605
|
-
# to <tt>app/controllers</tt
|
658
|
+
# to <tt>app/controllers</tt>.)
|
606
659
|
attr_accessor :controller_paths
|
607
660
|
|
608
661
|
# The path to the database configuration file to use. (Defaults to
|
@@ -665,6 +718,11 @@ Run `rake gems:install` to install the missing gems.
|
|
665
718
|
@plugins = plugins.nil? ? nil : plugins.map { |p| p.to_sym }
|
666
719
|
end
|
667
720
|
|
721
|
+
# The list of metals to load. If this is set to <tt>nil</tt>, all metals will
|
722
|
+
# be loaded in alphabetical order. If this is set to <tt>[]</tt>, no metals will
|
723
|
+
# be loaded. Otherwise metals will be loaded in the order specified
|
724
|
+
attr_accessor :metals
|
725
|
+
|
668
726
|
# The path to the root of the plugins directory. By default, it is in
|
669
727
|
# <tt>vendor/plugins</tt>.
|
670
728
|
attr_accessor :plugin_paths
|
@@ -763,6 +821,7 @@ Run `rake gems:install` to install the missing gems.
|
|
763
821
|
self.log_level = default_log_level
|
764
822
|
self.view_path = default_view_path
|
765
823
|
self.controller_paths = default_controller_paths
|
824
|
+
self.preload_frameworks = default_preload_frameworks
|
766
825
|
self.cache_classes = default_cache_classes
|
767
826
|
self.dependency_loading = default_dependency_loading
|
768
827
|
self.whiny_nils = default_whiny_nils
|
@@ -803,8 +862,10 @@ Run `rake gems:install` to install the missing gems.
|
|
803
862
|
|
804
863
|
# Enable threaded mode. Allows concurrent requests to controller actions and
|
805
864
|
# multiple database connections. Also disables automatic dependency loading
|
806
|
-
# after boot
|
865
|
+
# after boot, and disables reloading code on every request, as these are
|
866
|
+
# fundamentally incompatible with thread safety.
|
807
867
|
def threadsafe!
|
868
|
+
self.preload_frameworks = true
|
808
869
|
self.cache_classes = true
|
809
870
|
self.dependency_loading = false
|
810
871
|
self.action_controller.allow_concurrency = true
|
@@ -854,6 +915,11 @@ Run `rake gems:install` to install the missing gems.
|
|
854
915
|
end
|
855
916
|
end
|
856
917
|
|
918
|
+
def middleware
|
919
|
+
require 'action_controller'
|
920
|
+
ActionController::Dispatcher.middleware
|
921
|
+
end
|
922
|
+
|
857
923
|
def builtin_directories
|
858
924
|
# Include builtins only in the development environment.
|
859
925
|
(environment == 'development') ? Dir["#{RAILTIES_PATH}/builtin/*/"] : []
|
@@ -861,10 +927,10 @@ Run `rake gems:install` to install the missing gems.
|
|
861
927
|
|
862
928
|
def framework_paths
|
863
929
|
paths = %w(railties railties/lib activesupport/lib)
|
864
|
-
paths << 'actionpack/lib' if frameworks.include?
|
930
|
+
paths << 'actionpack/lib' if frameworks.include?(:action_controller) || frameworks.include?(:action_view)
|
865
931
|
|
866
932
|
[:active_record, :action_mailer, :active_resource, :action_web_service].each do |framework|
|
867
|
-
paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include?
|
933
|
+
paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include?(framework)
|
868
934
|
end
|
869
935
|
|
870
936
|
paths.map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
|
@@ -888,18 +954,14 @@ Run `rake gems:install` to install the missing gems.
|
|
888
954
|
# Add the app's controller directory
|
889
955
|
paths.concat(Dir["#{root_path}/app/controllers/"])
|
890
956
|
|
891
|
-
# Then components subdirectories.
|
892
|
-
paths.concat(Dir["#{root_path}/components/[_a-z]*"])
|
893
|
-
|
894
957
|
# Followed by the standard includes.
|
895
958
|
paths.concat %w(
|
896
959
|
app
|
960
|
+
app/metal
|
897
961
|
app/models
|
898
962
|
app/controllers
|
899
963
|
app/helpers
|
900
964
|
app/services
|
901
|
-
components
|
902
|
-
config
|
903
965
|
lib
|
904
966
|
vendor
|
905
967
|
).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
|
@@ -914,6 +976,7 @@ Run `rake gems:install` to install the missing gems.
|
|
914
976
|
|
915
977
|
def default_eager_load_paths
|
916
978
|
%w(
|
979
|
+
app/metal
|
917
980
|
app/models
|
918
981
|
app/controllers
|
919
982
|
app/helpers
|
@@ -950,6 +1013,10 @@ Run `rake gems:install` to install the missing gems.
|
|
950
1013
|
true
|
951
1014
|
end
|
952
1015
|
|
1016
|
+
def default_preload_frameworks
|
1017
|
+
false
|
1018
|
+
end
|
1019
|
+
|
953
1020
|
def default_cache_classes
|
954
1021
|
true
|
955
1022
|
end
|