railties 3.0.0.beta3 → 3.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/README +118 -123
- data/guides/source/3_0_release_notes.textile +13 -11
- data/guides/source/action_controller_overview.textile +2 -2
- data/guides/source/action_mailer_basics.textile +70 -26
- data/guides/source/action_view_overview.textile +1 -1
- data/guides/source/active_record_basics.textile +9 -1
- data/guides/source/active_record_querying.textile +2 -2
- data/guides/source/active_support_core_extensions.textile +377 -9
- data/guides/source/activerecord_validations_callbacks.textile +98 -55
- data/guides/source/association_basics.textile +1 -1
- data/guides/source/caching_with_rails.textile +1 -1
- data/guides/source/command_line.textile +23 -23
- data/guides/source/configuring.textile +1 -3
- data/guides/source/contribute.textile +27 -28
- data/guides/source/credits.html.erb +4 -4
- data/guides/source/debugging_rails_applications.textile +2 -2
- data/guides/source/form_helpers.textile +7 -6
- data/guides/source/generators.textile +19 -29
- data/guides/source/getting_started.textile +106 -49
- data/guides/source/i18n.textile +27 -27
- data/guides/source/index.html.erb +18 -8
- data/guides/source/initialization.textile +140 -514
- data/guides/source/layout.html.erb +6 -4
- data/guides/source/layouts_and_rendering.textile +5 -5
- data/guides/source/migrations.textile +7 -3
- data/guides/source/nested_model_forms.textile +2 -2
- data/guides/source/performance_testing.textile +11 -12
- data/guides/source/plugins.textile +30 -30
- data/guides/source/rails_application_templates.textile +3 -3
- data/guides/source/rails_on_rack.textile +3 -66
- data/guides/source/routing.textile +10 -4
- data/guides/source/security.textile +1 -1
- data/guides/source/testing.textile +55 -52
- data/guides/w3c_validator.rb +67 -0
- data/lib/rails.rb +1 -0
- data/lib/rails/application.rb +49 -13
- data/lib/rails/application/bootstrap.rb +7 -6
- data/lib/rails/application/configuration.rb +24 -47
- data/lib/rails/application/finisher.rb +8 -3
- data/lib/rails/backtrace_cleaner.rb +11 -12
- data/lib/rails/commands.rb +54 -54
- data/lib/rails/commands/application.rb +7 -2
- data/lib/rails/commands/{performance/benchmarker.rb → benchmarker.rb} +0 -0
- data/lib/rails/commands/dbconsole.rb +4 -3
- data/lib/rails/commands/destroy.rb +1 -0
- data/lib/rails/commands/generate.rb +1 -0
- data/lib/rails/commands/{performance/profiler.rb → profiler.rb} +0 -0
- data/lib/rails/commands/runner.rb +4 -2
- data/lib/rails/configuration.rb +36 -0
- data/lib/rails/engine.rb +24 -24
- data/lib/rails/engine/configuration.rb +0 -1
- data/lib/rails/generators.rb +48 -10
- data/lib/rails/generators/actions.rb +5 -3
- data/lib/rails/generators/base.rb +23 -17
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +9 -8
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +1 -1
- data/lib/rails/generators/generated_attribute.rb +7 -6
- data/lib/rails/generators/rails/app/USAGE +2 -2
- data/lib/rails/generators/rails/app/app_generator.rb +242 -97
- data/lib/rails/generators/rails/app/templates/Gemfile +3 -0
- data/lib/rails/generators/rails/app/templates/README +167 -130
- data/lib/rails/generators/rails/app/templates/Rakefile +0 -3
- data/lib/rails/generators/rails/app/templates/config/boot.rb +9 -2
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +5 -5
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/script/rails +2 -5
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -3
- data/lib/rails/generators/rails/stylesheets/templates/scaffold.css +5 -9
- data/lib/rails/generators/test_case.rb +12 -0
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +1 -1
- data/lib/rails/generators/test_unit/performance/templates/performance_test.rb +1 -1
- data/lib/rails/info.rb +0 -33
- data/lib/rails/log_subscriber.rb +13 -6
- data/lib/rails/rack/logger.rb +4 -3
- data/lib/rails/railtie.rb +4 -0
- data/lib/rails/railtie/configuration.rb +21 -4
- data/lib/rails/tasks/documentation.rake +2 -0
- data/lib/rails/tasks/framework.rake +22 -0
- data/lib/rails/tasks/middleware.rake +1 -1
- data/lib/rails/tasks/routes.rake +5 -1
- data/lib/rails/test_help.rb +3 -1
- data/lib/rails/test_unit/testing.rake +3 -1
- data/lib/rails/version.rb +1 -1
- metadata +12 -19
- data/lib/rails/application/metal_loader.rb +0 -50
- data/lib/rails/dispatcher.rb +0 -24
- data/lib/rails/generators/rails/mailer/USAGE +0 -15
- data/lib/rails/generators/rails/mailer/mailer_generator.rb +0 -14
- data/lib/rails/generators/rails/mailer/templates/mailer.rb +0 -16
- data/lib/rails/generators/rails/metal/USAGE +0 -8
- data/lib/rails/generators/rails/metal/metal_generator.rb +0 -11
- data/lib/rails/generators/rails/metal/templates/metal.rb +0 -12
@@ -6,10 +6,12 @@ module Rails
|
|
6
6
|
include Initializable
|
7
7
|
|
8
8
|
initializer :load_environment_config do
|
9
|
-
|
9
|
+
environment = config.paths.config.environments.to_a.first
|
10
|
+
require environment if environment
|
10
11
|
end
|
11
12
|
|
12
|
-
initializer :
|
13
|
+
initializer :load_active_support do
|
14
|
+
require 'active_support/dependencies'
|
13
15
|
require "active_support/all" unless config.active_support.bare
|
14
16
|
end
|
15
17
|
|
@@ -17,7 +19,6 @@ module Rails
|
|
17
19
|
# Used by Passenger to ensure everything's loaded before forking and
|
18
20
|
# to avoid autoload race conditions in JRuby.
|
19
21
|
initializer :preload_frameworks do
|
20
|
-
require 'active_support/dependencies'
|
21
22
|
ActiveSupport::Autoload.eager_autoload! if config.preload_frameworks
|
22
23
|
end
|
23
24
|
|
@@ -46,7 +47,7 @@ module Rails
|
|
46
47
|
silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(config.cache_store) }
|
47
48
|
|
48
49
|
if RAILS_CACHE.respond_to?(:middleware)
|
49
|
-
config.middleware.
|
50
|
+
config.middleware.insert_before("Rack::Runtime", RAILS_CACHE.middleware)
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
@@ -65,8 +66,8 @@ module Rails
|
|
65
66
|
ActiveSupport::Dependencies.mechanism = config.cache_classes ? :require : :load
|
66
67
|
end
|
67
68
|
|
68
|
-
initializer :
|
69
|
-
|
69
|
+
initializer :bootstrap_hook do |app|
|
70
|
+
ActiveSupport.run_load_hooks(:before_initialize, app)
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/deprecation'
|
2
|
+
require 'active_support/core_ext/string/encoding'
|
1
3
|
require 'rails/engine/configuration'
|
2
4
|
|
3
5
|
module Rails
|
@@ -7,9 +9,10 @@ module Rails
|
|
7
9
|
|
8
10
|
attr_accessor :allow_concurrency, :cache_classes, :cache_store,
|
9
11
|
:encoding, :consider_all_requests_local, :dependency_loading,
|
10
|
-
:filter_parameters, :log_level, :logger, :
|
12
|
+
:filter_parameters, :log_level, :logger, :middleware,
|
11
13
|
:plugins, :preload_frameworks, :reload_engines, :reload_plugins,
|
12
|
-
:secret_token, :serve_static_assets, :
|
14
|
+
:secret_token, :serve_static_assets, :session_options,
|
15
|
+
:time_zone, :whiny_nils
|
13
16
|
|
14
17
|
def initialize(*)
|
15
18
|
super
|
@@ -22,38 +25,39 @@ module Rails
|
|
22
25
|
@session_store = :cookie_store
|
23
26
|
@session_options = {}
|
24
27
|
@time_zone = "UTC"
|
28
|
+
@middleware = app_middleware
|
25
29
|
end
|
26
30
|
|
27
31
|
def encoding=(value)
|
28
32
|
@encoding = value
|
29
|
-
if
|
33
|
+
if "ruby".encoding_aware?
|
30
34
|
Encoding.default_external = value
|
35
|
+
Encoding.default_internal = value
|
36
|
+
else
|
37
|
+
$KCODE = value
|
38
|
+
if $KCODE == "NONE"
|
39
|
+
raise "The value you specified for config.encoding is " \
|
40
|
+
"invalid. The possible values are UTF8, SJIS, or EUC"
|
41
|
+
end
|
31
42
|
end
|
32
43
|
end
|
33
44
|
|
34
|
-
def middleware
|
35
|
-
@middleware ||= default_middleware_stack
|
36
|
-
end
|
37
|
-
|
38
|
-
def metal_loader
|
39
|
-
@metal_loader ||= Rails::Application::MetalLoader.new
|
40
|
-
end
|
41
|
-
|
42
45
|
def paths
|
43
46
|
@paths ||= begin
|
44
47
|
paths = super
|
45
48
|
paths.app.controllers << builtin_controller if builtin_controller
|
46
|
-
paths.config.database
|
47
|
-
paths.config.environment
|
48
|
-
paths.
|
49
|
-
paths.
|
50
|
-
paths.
|
51
|
-
paths.tmp
|
52
|
-
paths.
|
53
|
-
paths.vendor
|
49
|
+
paths.config.database "config/database.yml"
|
50
|
+
paths.config.environment "config/environment.rb"
|
51
|
+
paths.config.environments "config/environments", :glob => "#{Rails.env}.rb"
|
52
|
+
paths.lib.templates "lib/templates"
|
53
|
+
paths.log "log/#{Rails.env}.log"
|
54
|
+
paths.tmp "tmp"
|
55
|
+
paths.tmp.cache "tmp/cache"
|
56
|
+
paths.vendor "vendor", :load_path => true
|
57
|
+
paths.vendor.plugins "vendor/plugins"
|
54
58
|
|
55
59
|
if File.exists?("#{root}/test/mocks/#{Rails.env}")
|
56
|
-
ActiveSupport::Deprecation.warn "\"
|
60
|
+
ActiveSupport::Deprecation.warn "\"Rails.root/test/mocks/#{Rails.env}\" won't be added " <<
|
57
61
|
"automatically to load paths anymore in future releases"
|
58
62
|
paths.mocks_path "test/mocks", :load_path => true, :glob => Rails.env
|
59
63
|
end
|
@@ -127,33 +131,6 @@ module Rails
|
|
127
131
|
@session_options = args.shift || {}
|
128
132
|
end
|
129
133
|
end
|
130
|
-
|
131
|
-
protected
|
132
|
-
|
133
|
-
def session_options
|
134
|
-
return @session_options unless @session_store == :cookie_store
|
135
|
-
@session_options.merge(:secret => @secret_token)
|
136
|
-
end
|
137
|
-
|
138
|
-
def default_middleware_stack
|
139
|
-
ActionDispatch::MiddlewareStack.new.tap do |middleware|
|
140
|
-
middleware.use('::ActionDispatch::Static', lambda { paths.public.to_a.first }, :if => lambda { serve_static_assets })
|
141
|
-
middleware.use('::Rack::Lock', :if => lambda { !allow_concurrency })
|
142
|
-
middleware.use('::Rack::Runtime')
|
143
|
-
middleware.use('::Rails::Rack::Logger')
|
144
|
-
middleware.use('::ActionDispatch::ShowExceptions', lambda { consider_all_requests_local }, :if => lambda { action_dispatch.show_exceptions })
|
145
|
-
middleware.use("::ActionDispatch::RemoteIp", lambda { action_dispatch.ip_spoofing_check }, lambda { action_dispatch.trusted_proxies })
|
146
|
-
middleware.use('::Rack::Sendfile', lambda { action_dispatch.x_sendfile_header })
|
147
|
-
middleware.use('::ActionDispatch::Callbacks', lambda { !cache_classes })
|
148
|
-
middleware.use('::ActionDispatch::Cookies')
|
149
|
-
middleware.use(lambda { session_store }, lambda { session_options })
|
150
|
-
middleware.use('::ActionDispatch::Flash', :if => lambda { session_store })
|
151
|
-
middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? })
|
152
|
-
middleware.use('ActionDispatch::ParamsParser')
|
153
|
-
middleware.use('::Rack::MethodOverride')
|
154
|
-
middleware.use('::ActionDispatch::Head')
|
155
|
-
end
|
156
|
-
end
|
157
134
|
end
|
158
135
|
end
|
159
136
|
end
|
@@ -35,12 +35,17 @@ module Rails
|
|
35
35
|
app
|
36
36
|
end
|
37
37
|
|
38
|
-
initializer :
|
39
|
-
config.
|
40
|
-
|
38
|
+
initializer :eager_load! do
|
39
|
+
if config.cache_classes && !$rails_rake_task
|
40
|
+
ActiveSupport.run_load_hooks(:before_eager_load, self)
|
41
|
+
eager_load!
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
initializer :finisher_hook do
|
46
|
+
ActiveSupport.run_load_hooks(:after_initialize, self)
|
47
|
+
end
|
48
|
+
|
44
49
|
# Disable dependency loading during request cycle
|
45
50
|
initializer :disable_dependency_loading do
|
46
51
|
if config.cache_classes && !config.dependency_loading
|
@@ -2,29 +2,28 @@ require 'active_support/backtrace_cleaner'
|
|
2
2
|
|
3
3
|
module Rails
|
4
4
|
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
|
5
|
-
|
6
|
-
|
5
|
+
APP_DIRS_PATTERN = /^\/?(app|config|lib|test)/
|
6
|
+
RENDER_TEMPLATE_PATTERN = /:in `_render_template_\w*'/
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
super
|
10
10
|
add_filter { |line| line.sub("#{Rails.root}/", '') }
|
11
|
-
add_filter { |line| line.sub(
|
11
|
+
add_filter { |line| line.sub(RENDER_TEMPLATE_PATTERN, '') }
|
12
12
|
add_filter { |line| line.sub('./', '/') } # for tests
|
13
13
|
|
14
14
|
add_gem_filters
|
15
|
-
|
16
|
-
add_silencer { |line| !APP_DIRS.any? { |dir| line =~ /^\/?#{dir}/ } }
|
15
|
+
add_silencer { |line| line !~ APP_DIRS_PATTERN }
|
17
16
|
end
|
18
17
|
|
19
18
|
private
|
20
19
|
def add_gem_filters
|
21
|
-
return unless defined?
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
return unless defined?(Gem)
|
21
|
+
|
22
|
+
gems_paths = (Gem.path + [Gem.default_dir]).uniq.map!{ |p| Regexp.escape(p) }
|
23
|
+
return if gems_paths.empty?
|
24
|
+
|
25
|
+
gems_regexp = %r{(#{gems_paths.join('|')})/gems/([^/]+)-([\w\.]+)/(.*)}
|
26
|
+
add_filter { |line| line.sub(gems_regexp, '\2 (\3) \4') }
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
data/lib/rails/commands.rb
CHANGED
@@ -1,8 +1,54 @@
|
|
1
|
-
if ARGV.empty?
|
2
|
-
ARGV << '--help'
|
3
|
-
end
|
1
|
+
ARGV << '--help' if ARGV.empty?
|
4
2
|
|
5
|
-
|
3
|
+
aliases = {
|
4
|
+
"g" => "generate",
|
5
|
+
"c" => "console",
|
6
|
+
"s" => "server",
|
7
|
+
"db" => "dbconsole"
|
8
|
+
}
|
9
|
+
|
10
|
+
command = ARGV.shift
|
11
|
+
command = aliases[command] || command
|
12
|
+
|
13
|
+
case command
|
14
|
+
when 'generate', 'destroy', 'plugin', 'benchmarker', 'profiler'
|
15
|
+
require APP_PATH
|
16
|
+
Rails::Application.require_environment!
|
17
|
+
require "rails/commands/#{command}"
|
18
|
+
|
19
|
+
when 'console'
|
20
|
+
require 'rails/commands/console'
|
21
|
+
require APP_PATH
|
22
|
+
Rails::Application.require_environment!
|
23
|
+
Rails::Console.start(Rails::Application)
|
24
|
+
|
25
|
+
when 'server'
|
26
|
+
require 'rails/commands/server'
|
27
|
+
Rails::Server.new.tap { |server|
|
28
|
+
require APP_PATH
|
29
|
+
Dir.chdir(Rails::Application.root)
|
30
|
+
server.start
|
31
|
+
}
|
32
|
+
|
33
|
+
when 'dbconsole'
|
34
|
+
require 'rails/commands/dbconsole'
|
35
|
+
require APP_PATH
|
36
|
+
Rails::DBConsole.start(Rails::Application)
|
37
|
+
|
38
|
+
when 'application', 'runner'
|
39
|
+
require "rails/commands/#{command}"
|
40
|
+
|
41
|
+
when 'new'
|
42
|
+
puts "Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.\n"
|
43
|
+
puts "Type 'rails' for help."
|
44
|
+
|
45
|
+
when '--version', '-v'
|
46
|
+
ARGV.unshift '--version'
|
47
|
+
require 'rails/commands/application'
|
48
|
+
|
49
|
+
else
|
50
|
+
puts "Error: Command not recognized" unless %w(-h --help).include?(command)
|
51
|
+
puts <<-EOT
|
6
52
|
Usage: rails COMMAND [ARGS]
|
7
53
|
|
8
54
|
The most common rails commands are:
|
@@ -11,6 +57,8 @@ The most common rails commands are:
|
|
11
57
|
server Start the Rails server (short-cut alias: "s")
|
12
58
|
dbconsole Start a console for the database specified in config/database.yml
|
13
59
|
(short-cut alias: "db")
|
60
|
+
new Create a new Rails application. "rails new my_app" creates a
|
61
|
+
new application called MyApp in "./my_app"
|
14
62
|
|
15
63
|
In addition to those, there are:
|
16
64
|
application Generate the Rails application code
|
@@ -21,53 +69,5 @@ In addition to those, there are:
|
|
21
69
|
runner Run a piece of code in the application environment
|
22
70
|
|
23
71
|
All commands can be run with -h for more information.
|
24
|
-
EOT
|
25
|
-
|
26
|
-
|
27
|
-
case ARGV.shift
|
28
|
-
when 'g', 'generate'
|
29
|
-
require ENV_PATH
|
30
|
-
require 'rails/commands/generate'
|
31
|
-
when 'c', 'console'
|
32
|
-
require 'rails/commands/console'
|
33
|
-
require ENV_PATH
|
34
|
-
Rails::Console.start(Rails::Application)
|
35
|
-
when 's', 'server'
|
36
|
-
require 'rails/commands/server'
|
37
|
-
# Initialize the server first, so environment options are set
|
38
|
-
server = Rails::Server.new
|
39
|
-
require APP_PATH
|
40
|
-
|
41
|
-
Dir.chdir(Rails::Application.root)
|
42
|
-
server.start
|
43
|
-
when 'db', 'dbconsole'
|
44
|
-
require 'rails/commands/dbconsole'
|
45
|
-
require APP_PATH
|
46
|
-
Rails::DBConsole.start(Rails::Application)
|
47
|
-
|
48
|
-
when 'application'
|
49
|
-
require 'rails/commands/application'
|
50
|
-
when 'destroy'
|
51
|
-
require ENV_PATH
|
52
|
-
require 'rails/commands/destroy'
|
53
|
-
when 'benchmarker'
|
54
|
-
require ENV_PATH
|
55
|
-
require 'rails/commands/performance/benchmarker'
|
56
|
-
when 'profiler'
|
57
|
-
require ENV_PATH
|
58
|
-
require 'rails/commands/performance/profiler'
|
59
|
-
when 'plugin'
|
60
|
-
require APP_PATH
|
61
|
-
require 'rails/commands/plugin'
|
62
|
-
when 'runner'
|
63
|
-
require 'rails/commands/runner'
|
64
|
-
|
65
|
-
when '--help', '-h'
|
66
|
-
puts HELP_TEXT
|
67
|
-
when '--version', '-v'
|
68
|
-
ARGV.unshift '--version'
|
69
|
-
require 'rails/commands/application'
|
70
|
-
else
|
71
|
-
puts "Error: Command not recognized"
|
72
|
-
puts HELP_TEXT
|
73
|
-
end
|
72
|
+
EOT
|
73
|
+
end
|
@@ -4,10 +4,15 @@ if %w(--version -v).include? ARGV.first
|
|
4
4
|
exit(0)
|
5
5
|
end
|
6
6
|
|
7
|
-
ARGV
|
7
|
+
if ARGV.first != "new" || ARGV.empty?
|
8
|
+
ARGV[0] = "--help"
|
9
|
+
else
|
10
|
+
ARGV.shift
|
11
|
+
end
|
12
|
+
|
8
13
|
require 'rubygems' if ARGV.include?("--dev")
|
9
14
|
|
10
15
|
require 'rails/generators'
|
11
16
|
require 'rails/generators/rails/app/app_generator'
|
12
17
|
|
13
|
-
Rails::Generators::AppGenerator.start
|
18
|
+
Rails::Generators::AppGenerator.start
|
File without changes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'yaml'
|
3
3
|
require 'optparse'
|
4
|
+
require 'rbconfig'
|
4
5
|
|
5
6
|
module Rails
|
6
7
|
class DBConsole
|
@@ -41,7 +42,7 @@ module Rails
|
|
41
42
|
|
42
43
|
def find_cmd(*commands)
|
43
44
|
dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
|
44
|
-
commands += commands.map{|cmd| "#{cmd}.exe"} if
|
45
|
+
commands += commands.map{|cmd| "#{cmd}.exe"} if Config::CONFIG['host_os'] =~ /mswin|mingw/
|
45
46
|
|
46
47
|
full_path_command = nil
|
47
48
|
found = commands.detect do |cmd|
|
@@ -54,7 +55,7 @@ module Rails
|
|
54
55
|
end
|
55
56
|
|
56
57
|
case config["adapter"]
|
57
|
-
when
|
58
|
+
when /^mysql/
|
58
59
|
args = {
|
59
60
|
'host' => '--host',
|
60
61
|
'port' => '--port',
|
@@ -113,4 +114,4 @@ end
|
|
113
114
|
# Has to set the RAILS_ENV before config/application is required
|
114
115
|
if ARGV.first && !ARGV.first.index("-") && env = ARGV.first
|
115
116
|
ENV['RAILS_ENV'] = %w(production development test).find { |e| e.index(env) } || env
|
116
|
-
end
|
117
|
+
end
|
File without changes
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'optparse'
|
2
|
+
require 'rbconfig'
|
2
3
|
|
3
4
|
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
|
4
5
|
code_or_file = nil
|
@@ -18,7 +19,7 @@ ARGV.clone.options do |opts|
|
|
18
19
|
opts.on("-h", "--help",
|
19
20
|
"Show this help message.") { $stderr.puts opts; exit }
|
20
21
|
|
21
|
-
if
|
22
|
+
if Config::CONFIG['host_os'] !~ /mswin|mingw/
|
22
23
|
opts.separator ""
|
23
24
|
opts.separator "You can also use runner as a shebang line for your scripts like this:"
|
24
25
|
opts.separator "-------------------------------------------------------------"
|
@@ -35,7 +36,8 @@ ARGV.delete(code_or_file)
|
|
35
36
|
|
36
37
|
ENV["RAILS_ENV"] = options[:environment]
|
37
38
|
|
38
|
-
require
|
39
|
+
require APP_PATH
|
40
|
+
Rails::Application.require_environment!
|
39
41
|
|
40
42
|
begin
|
41
43
|
if code_or_file.nil?
|
data/lib/rails/configuration.rb
CHANGED
@@ -1,9 +1,45 @@
|
|
1
|
+
require 'active_support/deprecation'
|
1
2
|
require 'active_support/ordered_options'
|
2
3
|
require 'rails/paths'
|
3
4
|
require 'rails/rack'
|
4
5
|
|
5
6
|
module Rails
|
6
7
|
module Configuration
|
8
|
+
class MiddlewareStackProxy #:nodoc:
|
9
|
+
def initialize
|
10
|
+
@operations = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def insert_before(*args, &block)
|
14
|
+
@operations << [:insert_before, args, block]
|
15
|
+
end
|
16
|
+
|
17
|
+
alias :insert :insert_before
|
18
|
+
|
19
|
+
def insert_after(*args, &block)
|
20
|
+
@operations << [:insert_after, args, block]
|
21
|
+
end
|
22
|
+
|
23
|
+
def swap(*args, &block)
|
24
|
+
@operations << [:swap, args, block]
|
25
|
+
end
|
26
|
+
|
27
|
+
def use(*args, &block)
|
28
|
+
@operations << [:use, args, block]
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete(*args, &block)
|
32
|
+
@operations << [:delete, args, block]
|
33
|
+
end
|
34
|
+
|
35
|
+
def merge_into(other)
|
36
|
+
@operations.each do |operation, args, block|
|
37
|
+
other.send(operation, *args, &block)
|
38
|
+
end
|
39
|
+
other
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
7
43
|
class Generators #:nodoc:
|
8
44
|
attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging
|
9
45
|
|