rails 1.2.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/CHANGELOG +491 -12
- data/MIT-LICENSE +1 -1
- data/README +17 -25
- data/Rakefile +41 -18
- data/bin/about +1 -1
- data/bin/console +1 -1
- data/bin/destroy +1 -1
- data/bin/generate +1 -1
- data/bin/performance/request +3 -0
- data/bin/plugin +1 -1
- data/bin/runner +1 -1
- data/bin/server +1 -1
- data/builtin/rails_info/rails/info.rb +2 -2
- data/configs/apache.conf +1 -1
- data/configs/databases/mysql.yml +9 -3
- data/configs/databases/postgresql.yml +16 -12
- data/configs/initializers/inflections.rb +10 -0
- data/configs/initializers/mime_types.rb +5 -0
- data/configs/routes.rb +23 -11
- data/doc/README_FOR_APP +1 -1
- data/environments/boot.rb +95 -26
- data/environments/development.rb +2 -5
- data/environments/environment.rb +24 -25
- data/environments/test.rb +4 -1
- data/helpers/application.rb +5 -2
- data/helpers/test_helper.rb +10 -0
- data/html/422.html +30 -0
- data/html/500.html +1 -1
- data/html/index.html +2 -2
- data/html/javascripts/controls.js +484 -354
- data/html/javascripts/dragdrop.js +88 -58
- data/html/javascripts/effects.js +396 -364
- data/html/javascripts/prototype.js +2817 -1107
- data/html/robots.txt +5 -1
- data/lib/commands/console.rb +12 -5
- data/lib/commands/performance/request.rb +6 -0
- data/lib/commands/plugin.rb +15 -10
- data/lib/commands/process/spawner.rb +14 -4
- data/lib/commands/servers/base.rb +12 -0
- data/lib/commands/servers/mongrel.rb +5 -1
- data/lib/commands/servers/webrick.rb +14 -7
- data/lib/console_app.rb +5 -2
- data/lib/console_with_helpers.rb +5 -2
- data/lib/dispatcher.rb +3 -151
- data/lib/fcgi_handler.rb +79 -81
- data/lib/initializer.rb +125 -169
- data/lib/rails/plugin.rb +84 -0
- data/lib/rails/plugin/loader.rb +150 -0
- data/lib/rails/plugin/locator.rb +78 -0
- data/lib/rails/version.rb +3 -3
- data/lib/rails_generator/base.rb +11 -9
- data/lib/rails_generator/commands.rb +20 -10
- data/lib/rails_generator/generators/applications/app/USAGE +0 -7
- data/lib/rails_generator/generators/applications/app/app_generator.rb +25 -6
- data/lib/rails_generator/generators/components/controller/USAGE +11 -12
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +2 -2
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +1 -11
- data/lib/rails_generator/generators/components/controller/templates/{view.rhtml → view.html.erb} +0 -0
- data/lib/rails_generator/generators/components/integration_test/USAGE +5 -11
- data/lib/rails_generator/generators/components/mailer/USAGE +8 -10
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +3 -3
- data/lib/rails_generator/generators/components/mailer/templates/fixture.erb +3 -0
- data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +8 -24
- data/lib/rails_generator/generators/components/mailer/templates/view.erb +3 -0
- data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -3
- data/lib/rails_generator/generators/components/migration/USAGE +23 -8
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +15 -2
- data/lib/rails_generator/generators/components/migration/templates/migration.rb +6 -2
- data/lib/rails_generator/generators/components/model/USAGE +15 -14
- data/lib/rails_generator/generators/components/model/model_generator.rb +10 -3
- data/lib/rails_generator/generators/components/model/templates/fixtures.yml +11 -3
- data/lib/rails_generator/generators/components/model/templates/migration.rb +4 -1
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -3
- data/lib/rails_generator/generators/components/observer/USAGE +5 -7
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +0 -2
- data/lib/rails_generator/generators/components/plugin/USAGE +8 -18
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +20 -0
- data/lib/rails_generator/generators/components/plugin/templates/README +10 -1
- data/lib/rails_generator/generators/components/plugin/templates/USAGE +1 -1
- data/lib/rails_generator/generators/components/plugin/templates/init.rb +1 -1
- data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +1 -1
- data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +1 -1
- data/lib/rails_generator/generators/components/resource/USAGE +23 -0
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +13 -15
- data/lib/rails_generator/generators/components/resource/templates/controller.rb +1 -1
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +2 -14
- data/lib/rails_generator/generators/components/scaffold/USAGE +24 -31
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +45 -146
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +64 -37
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +23 -80
- data/lib/rails_generator/generators/components/scaffold/templates/{layout.rhtml → layout.html.erb} +0 -0
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +1 -1
- data/lib/rails_generator/generators/components/{scaffold_resource/templates/view_edit.rhtml → scaffold/templates/view_edit.html.erb} +4 -4
- data/lib/rails_generator/generators/components/{scaffold_resource/templates/view_index.rhtml → scaffold/templates/view_index.html.erb} +4 -4
- data/lib/rails_generator/generators/components/{scaffold_resource/templates/view_new.rhtml → scaffold/templates/view_new.html.erb} +3 -3
- data/lib/rails_generator/generators/components/{scaffold_resource/templates/view_show.rhtml → scaffold/templates/view_show.html.erb} +1 -1
- data/lib/rails_generator/generators/components/session_migration/USAGE +6 -11
- data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +3 -3
- data/lib/rails_generator/lookup.rb +45 -10
- data/lib/rails_generator/scripts.rb +6 -3
- data/lib/rails_generator/scripts/destroy.rb +23 -0
- data/lib/rails_generator/secret_key_generator.rb +160 -0
- data/lib/rails_generator/spec.rb +1 -1
- data/lib/source_annotation_extractor.rb +62 -0
- data/lib/tasks/annotations.rake +23 -0
- data/lib/tasks/databases.rake +249 -83
- data/lib/tasks/documentation.rake +11 -13
- data/lib/tasks/framework.rake +1 -1
- data/lib/tasks/rails.rb +1 -1
- data/lib/tasks/testing.rake +5 -7
- data/lib/test_help.rb +4 -3
- data/lib/webrick_server.rb +3 -4
- metadata +31 -49
- data/bin/breakpointer +0 -3
- data/lib/binding_of_caller.rb +0 -85
- data/lib/breakpoint.rb +0 -553
- data/lib/breakpoint_client.rb +0 -196
- data/lib/commands/breakpointer.rb +0 -1
- data/lib/rails_generator/generators/components/resource/templates/USAGE +0 -18
- data/lib/rails_generator/generators/components/resource/templates/fixtures.yml +0 -11
- data/lib/rails_generator/generators/components/resource/templates/migration.rb +0 -13
- data/lib/rails_generator/generators/components/resource/templates/model.rb +0 -2
- data/lib/rails_generator/generators/components/resource/templates/unit_test.rb +0 -10
- data/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +0 -3
- data/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml +0 -1
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +0 -9
- data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +0 -27
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +0 -8
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml +0 -8
- data/lib/rails_generator/generators/components/scaffold_resource/USAGE +0 -29
- data/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +0 -93
- data/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb +0 -79
- data/lib/rails_generator/generators/components/scaffold_resource/templates/fixtures.yml +0 -11
- data/lib/rails_generator/generators/components/scaffold_resource/templates/functional_test.rb +0 -57
- data/lib/rails_generator/generators/components/scaffold_resource/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml +0 -17
- data/lib/rails_generator/generators/components/scaffold_resource/templates/migration.rb +0 -13
- data/lib/rails_generator/generators/components/scaffold_resource/templates/model.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold_resource/templates/style.css +0 -74
- data/lib/rails_generator/generators/components/scaffold_resource/templates/unit_test.rb +0 -10
- data/lib/rails_generator/generators/components/web_service/USAGE +0 -28
- data/lib/rails_generator/generators/components/web_service/templates/api_definition.rb +0 -5
- data/lib/rails_generator/generators/components/web_service/templates/controller.rb +0 -8
- data/lib/rails_generator/generators/components/web_service/templates/functional_test.rb +0 -19
- data/lib/rails_generator/generators/components/web_service/web_service_generator.rb +0 -29
- data/lib/tasks/pre_namespace_aliases.rake +0 -53
    
        data/lib/fcgi_handler.rb
    CHANGED
    
    | @@ -9,8 +9,7 @@ class RailsFCGIHandler | |
| 9 9 | 
             
                'INT'     => :exit_now,
         | 
| 10 10 | 
             
                'TERM'    => :exit_now,
         | 
| 11 11 | 
             
                'USR1'    => :exit,
         | 
| 12 | 
            -
                'USR2'    => :restart | 
| 13 | 
            -
                'SIGTRAP' => :breakpoint
         | 
| 12 | 
            +
                'USR2'    => :restart
         | 
| 14 13 | 
             
              }
         | 
| 15 14 | 
             
              GLOBAL_SIGNALS = SIGNALS.keys - %w(USR1)
         | 
| 16 15 |  | 
| @@ -42,38 +41,72 @@ class RailsFCGIHandler | |
| 42 41 |  | 
| 43 42 | 
             
                # Start error timestamp at 11 seconds ago.
         | 
| 44 43 | 
             
                @last_error_on = Time.now - 11
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                dispatcher_log :info, "starting"
         | 
| 47 44 | 
             
              end
         | 
| 48 45 |  | 
| 49 46 | 
             
              def process!(provider = FCGI)
         | 
| 50 | 
            -
                 | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
                 | 
| 47 | 
            +
                mark_features!
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                dispatcher_log :info, 'starting'
         | 
| 50 | 
            +
                process_each_request provider
         | 
| 51 | 
            +
                dispatcher_log :info, 'stopping gracefully'
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              rescue Exception => error
         | 
| 54 | 
            +
                case error
         | 
| 55 | 
            +
                when SystemExit
         | 
| 56 | 
            +
                  dispatcher_log :info, 'stopping after explicit exit'
         | 
| 57 | 
            +
                when SignalException
         | 
| 58 | 
            +
                  dispatcher_error error, 'stopping after unhandled signal'
         | 
| 59 | 
            +
                else
         | 
| 60 | 
            +
                  # Retry if exceptions occur more than 10 seconds apart.
         | 
| 61 | 
            +
                  if Time.now - @last_error_on > 10
         | 
| 62 | 
            +
                    @last_error_on = Time.now
         | 
| 63 | 
            +
                    dispatcher_error error, 'retrying after unhandled exception'
         | 
| 64 | 
            +
                    retry
         | 
| 65 | 
            +
                  else
         | 
| 66 | 
            +
                    dispatcher_error error, 'stopping after unhandled exception within 10 seconds of the last'
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
              end
         | 
| 54 70 |  | 
| 55 | 
            -
                process_each_request!(provider)
         | 
| 56 71 |  | 
| 57 | 
            -
             | 
| 58 | 
            -
                 | 
| 72 | 
            +
              protected
         | 
| 73 | 
            +
                def process_each_request(provider)
         | 
| 74 | 
            +
                  cgi = nil
         | 
| 59 75 |  | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 76 | 
            +
                  provider.each_cgi do |cgi|
         | 
| 77 | 
            +
                    process_request(cgi)
         | 
| 62 78 |  | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 79 | 
            +
                    case when_ready
         | 
| 80 | 
            +
                      when :reload
         | 
| 81 | 
            +
                        reload!
         | 
| 82 | 
            +
                      when :restart
         | 
| 83 | 
            +
                        close_connection(cgi)
         | 
| 84 | 
            +
                        restart!
         | 
| 85 | 
            +
                      when :exit
         | 
| 86 | 
            +
                        close_connection(cgi)
         | 
| 87 | 
            +
                        break
         | 
| 88 | 
            +
                    end
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
                rescue SignalException => signal
         | 
| 91 | 
            +
                  raise unless signal.message == 'SIGUSR1'
         | 
| 92 | 
            +
                  close_connection(cgi)
         | 
| 72 93 | 
             
                end
         | 
| 73 | 
            -
              end
         | 
| 74 94 |  | 
| 95 | 
            +
                def process_request(cgi)
         | 
| 96 | 
            +
                  @when_ready = nil
         | 
| 97 | 
            +
                  gc_countdown
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                  with_signal_handler 'USR1' do
         | 
| 100 | 
            +
                    begin
         | 
| 101 | 
            +
                      Dispatcher.dispatch(cgi)
         | 
| 102 | 
            +
                    rescue SignalException, SystemExit
         | 
| 103 | 
            +
                      raise
         | 
| 104 | 
            +
                    rescue Exception => error
         | 
| 105 | 
            +
                      dispatcher_error error, 'unhandled dispatch error'
         | 
| 106 | 
            +
                    end
         | 
| 107 | 
            +
                  end
         | 
| 108 | 
            +
                end
         | 
| 75 109 |  | 
| 76 | 
            -
              protected
         | 
| 77 110 | 
             
                def logger
         | 
| 78 111 | 
             
                  @logger ||= Logger.new(@log_file_path)
         | 
| 79 112 | 
             
                end
         | 
| @@ -98,10 +131,17 @@ class RailsFCGIHandler | |
| 98 131 | 
             
                end
         | 
| 99 132 |  | 
| 100 133 | 
             
                def install_signal_handler(signal, handler = nil)
         | 
| 101 | 
            -
                   | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 134 | 
            +
                  if SIGNALS.include?(signal) && self.class.method_defined?(name = "#{SIGNALS[signal]}_handler")
         | 
| 135 | 
            +
                    handler ||= method(name).to_proc
         | 
| 136 | 
            +
             | 
| 137 | 
            +
                    begin
         | 
| 138 | 
            +
                      trap(signal, handler)
         | 
| 139 | 
            +
                    rescue ArgumentError
         | 
| 140 | 
            +
                      dispatcher_log :warn, "Ignoring unsupported signal #{signal}."
         | 
| 141 | 
            +
                    end
         | 
| 142 | 
            +
                  else
         | 
| 143 | 
            +
                    dispatcher_log :warn, "Ignoring unsupported signal #{signal}."
         | 
| 144 | 
            +
                  end
         | 
| 105 145 | 
             
                end
         | 
| 106 146 |  | 
| 107 147 | 
             
                def with_signal_handler(signal)
         | 
| @@ -112,12 +152,12 @@ class RailsFCGIHandler | |
| 112 152 | 
             
                end
         | 
| 113 153 |  | 
| 114 154 | 
             
                def exit_now_handler(signal)
         | 
| 115 | 
            -
                  dispatcher_log :info, "asked to  | 
| 155 | 
            +
                  dispatcher_log :info, "asked to stop immediately"
         | 
| 116 156 | 
             
                  exit
         | 
| 117 157 | 
             
                end
         | 
| 118 158 |  | 
| 119 159 | 
             
                def exit_handler(signal)
         | 
| 120 | 
            -
                  dispatcher_log :info, "asked to  | 
| 160 | 
            +
                  dispatcher_log :info, "asked to stop ASAP"
         | 
| 121 161 | 
             
                  @when_ready = :exit
         | 
| 122 162 | 
             
                end
         | 
| 123 163 |  | 
| @@ -131,46 +171,6 @@ class RailsFCGIHandler | |
| 131 171 | 
             
                  @when_ready = :restart
         | 
| 132 172 | 
             
                end
         | 
| 133 173 |  | 
| 134 | 
            -
                def breakpoint_handler(signal)
         | 
| 135 | 
            -
                  dispatcher_log :info, "asked to breakpoint ASAP"
         | 
| 136 | 
            -
                  @when_ready = :breakpoint
         | 
| 137 | 
            -
                end
         | 
| 138 | 
            -
             | 
| 139 | 
            -
                def process_each_request!(provider)
         | 
| 140 | 
            -
                  cgi = nil
         | 
| 141 | 
            -
                  provider.each_cgi do |cgi|
         | 
| 142 | 
            -
                    with_signal_handler 'USR1' do
         | 
| 143 | 
            -
                      process_request(cgi)
         | 
| 144 | 
            -
                    end
         | 
| 145 | 
            -
             | 
| 146 | 
            -
                    case when_ready
         | 
| 147 | 
            -
                      when :reload
         | 
| 148 | 
            -
                        reload!
         | 
| 149 | 
            -
                      when :restart
         | 
| 150 | 
            -
                        close_connection(cgi)
         | 
| 151 | 
            -
                        restart!
         | 
| 152 | 
            -
                      when :exit
         | 
| 153 | 
            -
                        close_connection(cgi)
         | 
| 154 | 
            -
                        break
         | 
| 155 | 
            -
                      when :breakpoint
         | 
| 156 | 
            -
                        close_connection(cgi)
         | 
| 157 | 
            -
                        breakpoint!
         | 
| 158 | 
            -
                    end
         | 
| 159 | 
            -
             | 
| 160 | 
            -
                    gc_countdown
         | 
| 161 | 
            -
                  end
         | 
| 162 | 
            -
                rescue SignalException => signal
         | 
| 163 | 
            -
                  raise unless signal.message == 'SIGUSR1'
         | 
| 164 | 
            -
                  close_connection(cgi) if cgi
         | 
| 165 | 
            -
                end
         | 
| 166 | 
            -
             | 
| 167 | 
            -
                def process_request(cgi)
         | 
| 168 | 
            -
                  Dispatcher.dispatch(cgi)
         | 
| 169 | 
            -
                rescue Exception => e  # errors from CGI dispatch
         | 
| 170 | 
            -
                  raise if SignalException === e
         | 
| 171 | 
            -
                  dispatcher_error(e)
         | 
| 172 | 
            -
                end
         | 
| 173 | 
            -
             | 
| 174 174 | 
             
                def restart!
         | 
| 175 175 | 
             
                  config       = ::Config::CONFIG
         | 
| 176 176 | 
             
                  ruby         = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
         | 
| @@ -178,6 +178,11 @@ class RailsFCGIHandler | |
| 178 178 |  | 
| 179 179 | 
             
                  dispatcher_log :info, "restarted"
         | 
| 180 180 |  | 
| 181 | 
            +
                  # close resources as they won't be closed by
         | 
| 182 | 
            +
                  # the OS when using exec
         | 
| 183 | 
            +
                  logger.close rescue nil
         | 
| 184 | 
            +
                  RAILS_DEFAULT_LOGGER.close rescue nil
         | 
| 185 | 
            +
             | 
| 181 186 | 
             
                  exec(command_line)
         | 
| 182 187 | 
             
                end
         | 
| 183 188 |  | 
| @@ -188,7 +193,8 @@ class RailsFCGIHandler | |
| 188 193 | 
             
                  dispatcher_log :info, "reloaded"
         | 
| 189 194 | 
             
                end
         | 
| 190 195 |  | 
| 191 | 
            -
                 | 
| 196 | 
            +
                # Make a note of $" so we can safely reload this instance.
         | 
| 197 | 
            +
                def mark_features!
         | 
| 192 198 | 
             
                  @features = $".clone
         | 
| 193 199 | 
             
                end
         | 
| 194 200 |  | 
| @@ -198,15 +204,6 @@ class RailsFCGIHandler | |
| 198 204 | 
             
                  ActionController::Routing::Routes.reload
         | 
| 199 205 | 
             
                end
         | 
| 200 206 |  | 
| 201 | 
            -
                def breakpoint!
         | 
| 202 | 
            -
                  require 'breakpoint'
         | 
| 203 | 
            -
                  port = defined?(BREAKPOINT_SERVER_PORT) ? BREAKPOINT_SERVER_PORT : 42531
         | 
| 204 | 
            -
                  Breakpoint.activate_drb("druby://localhost:#{port}", nil, !defined?(FastCGI))
         | 
| 205 | 
            -
                  dispatcher_log :info, "breakpointing"
         | 
| 206 | 
            -
                  breakpoint
         | 
| 207 | 
            -
                  @when_ready = nil
         | 
| 208 | 
            -
                end
         | 
| 209 | 
            -
             | 
| 210 207 | 
             
                def run_gc!
         | 
| 211 208 | 
             
                  @gc_request_countdown = gc_request_period
         | 
| 212 209 | 
             
                  GC.enable; GC.start; GC.disable
         | 
| @@ -214,12 +211,13 @@ class RailsFCGIHandler | |
| 214 211 |  | 
| 215 212 | 
             
                def gc_countdown
         | 
| 216 213 | 
             
                  if gc_request_period
         | 
| 214 | 
            +
                    @gc_request_countdown ||= gc_request_period
         | 
| 217 215 | 
             
                    @gc_request_countdown -= 1
         | 
| 218 216 | 
             
                    run_gc! if @gc_request_countdown <= 0
         | 
| 219 217 | 
             
                  end
         | 
| 220 218 | 
             
                end
         | 
| 221 219 |  | 
| 222 220 | 
             
                def close_connection(cgi)
         | 
| 223 | 
            -
                  cgi.instance_variable_get("@request").finish
         | 
| 221 | 
            +
                  cgi.instance_variable_get("@request").finish if cgi
         | 
| 224 222 | 
             
                end
         | 
| 225 223 | 
             
            end
         | 
    
        data/lib/initializer.rb
    CHANGED
    
    | @@ -5,6 +5,8 @@ require 'pathname' | |
| 5 5 | 
             
            $LOAD_PATH.unshift File.dirname(__FILE__)
         | 
| 6 6 | 
             
            require 'railties_path'
         | 
| 7 7 | 
             
            require 'rails/version'
         | 
| 8 | 
            +
            require 'rails/plugin/locator'
         | 
| 9 | 
            +
            require 'rails/plugin/loader'
         | 
| 8 10 |  | 
| 9 11 |  | 
| 10 12 | 
             
            RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
         | 
| @@ -21,7 +23,7 @@ module Rails | |
| 21 23 | 
             
              # through the block running:
         | 
| 22 24 | 
             
              #
         | 
| 23 25 | 
             
              #   Rails::Initializer.run do |config|
         | 
| 24 | 
            -
              #     config.frameworks -= [ : | 
| 26 | 
            +
              #     config.frameworks -= [ :action_mailer ]
         | 
| 25 27 | 
             
              #   end
         | 
| 26 28 | 
             
              #
         | 
| 27 29 | 
             
              # This will use the default configuration options from Rails::Configuration,
         | 
| @@ -32,7 +34,7 @@ module Rails | |
| 32 34 |  | 
| 33 35 | 
             
                # The set of loaded plugins.
         | 
| 34 36 | 
             
                attr_reader :loaded_plugins
         | 
| 35 | 
            -
             | 
| 37 | 
            +
                
         | 
| 36 38 | 
             
                # Runs the initializer. By default, this will invoke the #process method,
         | 
| 37 39 | 
             
                # which simply executes all of the initialization routines. Alternately,
         | 
| 38 40 | 
             
                # you can specify explicitly which initialization routine you want:
         | 
| @@ -58,34 +60,34 @@ module Rails | |
| 58 60 | 
             
                # Sequentially step through all of the available initialization routines,
         | 
| 59 61 | 
             
                # in order:
         | 
| 60 62 | 
             
                #
         | 
| 63 | 
            +
                # * #check_ruby_version
         | 
| 61 64 | 
             
                # * #set_load_path
         | 
| 62 | 
            -
                # * #set_connection_adapters
         | 
| 63 65 | 
             
                # * #require_frameworks
         | 
| 66 | 
            +
                # * #set_autoload_paths
         | 
| 67 | 
            +
                # * add_plugin_load_paths
         | 
| 64 68 | 
             
                # * #load_environment
         | 
| 69 | 
            +
                # * #initialize_encoding
         | 
| 65 70 | 
             
                # * #initialize_database
         | 
| 66 71 | 
             
                # * #initialize_logger
         | 
| 67 72 | 
             
                # * #initialize_framework_logging
         | 
| 68 73 | 
             
                # * #initialize_framework_views
         | 
| 69 74 | 
             
                # * #initialize_dependency_mechanism
         | 
| 70 | 
            -
                # * #initialize_breakpoints
         | 
| 71 75 | 
             
                # * #initialize_whiny_nils
         | 
| 76 | 
            +
                # * #initialize_temporary_directories
         | 
| 72 77 | 
             
                # * #initialize_framework_settings
         | 
| 73 | 
            -
                # * # | 
| 78 | 
            +
                # * #add_support_load_paths
         | 
| 74 79 | 
             
                # * #load_plugins
         | 
| 75 80 | 
             
                # * #load_observers
         | 
| 76 81 | 
             
                # * #initialize_routing
         | 
| 77 | 
            -
                #
         | 
| 78 | 
            -
                #  | 
| 79 | 
            -
                # once at the end, to support the legacy configuration style where the
         | 
| 80 | 
            -
                # environment could overwrite the defaults directly, instead of via the
         | 
| 81 | 
            -
                # Configuration instance.
         | 
| 82 | 
            +
                # * #after_initialize
         | 
| 83 | 
            +
                # * #load_application_initializers
         | 
| 82 84 | 
             
                def process
         | 
| 83 85 | 
             
                  check_ruby_version
         | 
| 84 86 | 
             
                  set_load_path
         | 
| 85 | 
            -
                   | 
| 86 | 
            -
             | 
| 87 | 
            +
                  
         | 
| 87 88 | 
             
                  require_frameworks
         | 
| 88 89 | 
             
                  set_autoload_paths
         | 
| 90 | 
            +
                  add_plugin_load_paths
         | 
| 89 91 | 
             
                  load_environment
         | 
| 90 92 |  | 
| 91 93 | 
             
                  initialize_encoding
         | 
| @@ -94,16 +96,10 @@ module Rails | |
| 94 96 | 
             
                  initialize_framework_logging
         | 
| 95 97 | 
             
                  initialize_framework_views
         | 
| 96 98 | 
             
                  initialize_dependency_mechanism
         | 
| 97 | 
            -
                  initialize_breakpoints
         | 
| 98 99 | 
             
                  initialize_whiny_nils
         | 
| 99 100 | 
             
                  initialize_temporary_directories
         | 
| 100 101 | 
             
                  initialize_framework_settings
         | 
| 101 102 |  | 
| 102 | 
            -
                  # Support for legacy configuration style where the environment
         | 
| 103 | 
            -
                  # could overwrite anything set from the defaults/global through
         | 
| 104 | 
            -
                  # the individual base class configurations.
         | 
| 105 | 
            -
                  load_environment
         | 
| 106 | 
            -
             | 
| 107 103 | 
             
                  add_support_load_paths
         | 
| 108 104 |  | 
| 109 105 | 
             
                  load_plugins
         | 
| @@ -116,6 +112,8 @@ module Rails | |
| 116 112 |  | 
| 117 113 | 
             
                  # the framework is now fully initialized
         | 
| 118 114 | 
             
                  after_initialize
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                  load_application_initializers
         | 
| 119 117 | 
             
                end
         | 
| 120 118 |  | 
| 121 119 | 
             
                # Check for valid Ruby version
         | 
| @@ -151,58 +149,57 @@ module Rails | |
| 151 149 | 
             
                  configuration.load_once_paths.freeze
         | 
| 152 150 | 
             
                end
         | 
| 153 151 |  | 
| 154 | 
            -
                # Sets the +RAILS_CONNECTION_ADAPTERS+ constant based on the value of
         | 
| 155 | 
            -
                # Configuration#connection_adapters. This constant is used to determine
         | 
| 156 | 
            -
                # which database adapters should be loaded (by default, all adapters are
         | 
| 157 | 
            -
                # loaded).
         | 
| 158 | 
            -
                def set_connection_adapters
         | 
| 159 | 
            -
                  Object.const_set("RAILS_CONNECTION_ADAPTERS", configuration.connection_adapters) if configuration.connection_adapters
         | 
| 160 | 
            -
                end
         | 
| 161 | 
            -
             | 
| 162 152 | 
             
                # Requires all frameworks specified by the Configuration#frameworks
         | 
| 163 153 | 
             
                # list. By default, all frameworks (ActiveRecord, ActiveSupport,
         | 
| 164 | 
            -
                # ActionPack, ActionMailer, and  | 
| 154 | 
            +
                # ActionPack, ActionMailer, and ActiveResource) are loaded.
         | 
| 165 155 | 
             
                def require_frameworks
         | 
| 166 156 | 
             
                  configuration.frameworks.each { |framework| require(framework.to_s) }
         | 
| 157 | 
            +
                rescue LoadError => e
         | 
| 158 | 
            +
                  # re-raise because Mongrel would swallow it
         | 
| 159 | 
            +
                  raise e.to_s
         | 
| 167 160 | 
             
                end
         | 
| 168 161 |  | 
| 169 162 | 
             
                # Add the load paths used by support functions such as the info controller
         | 
| 170 163 | 
             
                def add_support_load_paths
         | 
| 171 164 | 
             
                end
         | 
| 172 165 |  | 
| 166 | 
            +
                # Adds all load paths from plugins to the global set of load paths, so that
         | 
| 167 | 
            +
                # code from plugins can be required (explicitly or automatically via Dependencies).
         | 
| 168 | 
            +
                def add_plugin_load_paths
         | 
| 169 | 
            +
                  plugin_loader.add_plugin_load_paths
         | 
| 170 | 
            +
                end
         | 
| 171 | 
            +
             | 
| 173 172 | 
             
                # Loads all plugins in <tt>config.plugin_paths</tt>.  <tt>plugin_paths</tt>
         | 
| 174 173 | 
             
                # defaults to <tt>vendor/plugins</tt> but may also be set to a list of
         | 
| 175 174 | 
             
                # paths, such as
         | 
| 176 | 
            -
                #   config.plugin_paths = [ | 
| 175 | 
            +
                #   config.plugin_paths = ["#{RAILS_ROOT}/lib/plugins", "#{RAILS_ROOT}/vendor/plugins"]
         | 
| 177 176 | 
             
                #
         | 
| 178 | 
            -
                #  | 
| 179 | 
            -
                # *  | 
| 180 | 
            -
                # *  | 
| 177 | 
            +
                # In the default implementation, as each plugin discovered in <tt>plugin_paths</tt> is initialized:
         | 
| 178 | 
            +
                # * its +lib+ directory, if present, is added to the load path (immediately after the applications lib directory)
         | 
| 179 | 
            +
                # * <tt>init.rb</tt> is evaluated, if present
         | 
| 181 180 | 
             
                #
         | 
| 182 181 | 
             
                # After all plugins are loaded, duplicates are removed from the load path.
         | 
| 183 | 
            -
                # If an array of plugin names is specified in config.plugins,  | 
| 184 | 
            -
                # will be loaded in that order. Otherwise, plugins are loaded in alphabetical
         | 
| 182 | 
            +
                # If an array of plugin names is specified in config.plugins, only those plugins will be loaded
         | 
| 183 | 
            +
                # and they plugins will be loaded in that order. Otherwise, plugins are loaded in alphabetical
         | 
| 185 184 | 
             
                # order.
         | 
| 185 | 
            +
                #
         | 
| 186 | 
            +
                # if config.plugins ends contains :all then the named plugins will be loaded in the given order and all other
         | 
| 187 | 
            +
                # plugins will be loaded in alphabetical order
         | 
| 186 188 | 
             
                def load_plugins
         | 
| 187 | 
            -
                   | 
| 188 | 
            -
             | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 191 | 
            -
             | 
| 192 | 
            -
                    plugin_paths = find_plugins(configuration.plugin_paths)
         | 
| 193 | 
            -
                    configuration.plugins.each do |name|
         | 
| 194 | 
            -
                      path = plugin_paths.find { |p| File.basename(p) == name }
         | 
| 195 | 
            -
                      raise(LoadError, "Cannot find the plugin '#{name}'!") if path.nil?
         | 
| 196 | 
            -
                      load_plugin path
         | 
| 197 | 
            -
                    end
         | 
| 198 | 
            -
                  end
         | 
| 199 | 
            -
                  $LOAD_PATH.uniq!
         | 
| 189 | 
            +
                  plugin_loader.load_plugins
         | 
| 190 | 
            +
                end
         | 
| 191 | 
            +
             | 
| 192 | 
            +
                def plugin_loader
         | 
| 193 | 
            +
                  @plugin_loader ||= configuration.plugin_loader.new(self)
         | 
| 200 194 | 
             
                end
         | 
| 201 195 |  | 
| 202 196 | 
             
                # Loads the environment specified by Configuration#environment_path, which
         | 
| 203 | 
            -
                # is typically one of development,  | 
| 197 | 
            +
                # is typically one of development, test, or production.
         | 
| 204 198 | 
             
                def load_environment
         | 
| 205 199 | 
             
                  silence_warnings do
         | 
| 200 | 
            +
                    return if @environment_loaded
         | 
| 201 | 
            +
                    @environment_loaded = true
         | 
| 202 | 
            +
                    
         | 
| 206 203 | 
             
                    config = configuration
         | 
| 207 204 | 
             
                    constants = self.class.constants
         | 
| 208 205 |  | 
| @@ -215,10 +212,12 @@ module Rails | |
| 215 212 | 
             
                end
         | 
| 216 213 |  | 
| 217 214 | 
             
                def load_observers
         | 
| 218 | 
            -
                   | 
| 215 | 
            +
                  if configuration.frameworks.include?(:active_record)
         | 
| 216 | 
            +
                    ActiveRecord::Base.instantiate_observers
         | 
| 217 | 
            +
                  end
         | 
| 219 218 | 
             
                end
         | 
| 220 219 |  | 
| 221 | 
            -
                # This  | 
| 220 | 
            +
                # This initialization sets $KCODE to 'u' to enable the multibyte safe operations.
         | 
| 222 221 | 
             
                # Plugin authors supporting other encodings should override this behaviour and
         | 
| 223 222 | 
             
                # set the relevant +default_charset+ on ActionController::Base
         | 
| 224 223 | 
             
                def initialize_encoding
         | 
| @@ -230,9 +229,10 @@ module Rails | |
| 230 229 | 
             
                # this sets the database configuration from Configuration#database_configuration
         | 
| 231 230 | 
             
                # and then establishes the connection.
         | 
| 232 231 | 
             
                def initialize_database
         | 
| 233 | 
            -
                   | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 232 | 
            +
                  if configuration.frameworks.include?(:active_record)
         | 
| 233 | 
            +
                    ActiveRecord::Base.configurations = configuration.database_configuration
         | 
| 234 | 
            +
                    ActiveRecord::Base.establish_connection
         | 
| 235 | 
            +
                  end
         | 
| 236 236 | 
             
                end
         | 
| 237 237 |  | 
| 238 238 | 
             
                # If the +RAILS_DEFAULT_LOGGER+ constant is already set, this initialization
         | 
| @@ -249,11 +249,12 @@ module Rails | |
| 249 249 |  | 
| 250 250 | 
             
                  unless logger = configuration.logger
         | 
| 251 251 | 
             
                    begin
         | 
| 252 | 
            -
                      logger =  | 
| 253 | 
            -
                      logger.level =  | 
| 254 | 
            -
             | 
| 255 | 
            -
             | 
| 256 | 
            -
                      logger | 
| 252 | 
            +
                      logger = ActiveSupport::BufferedLogger.new(configuration.log_path)
         | 
| 253 | 
            +
                      logger.level = ActiveSupport::BufferedLogger.const_get(configuration.log_level.to_s.upcase)
         | 
| 254 | 
            +
                      logger.auto_flushing = false if configuration.environment == "production"
         | 
| 255 | 
            +
                    rescue StandardError =>e
         | 
| 256 | 
            +
                      logger = ActiveSupport::BufferedLogger.new(STDERR)
         | 
| 257 | 
            +
                      logger.level = ActiveSupport::BufferedLogger::WARN
         | 
| 257 258 | 
             
                      logger.warn(
         | 
| 258 259 | 
             
                        "Rails Error: Unable to access log file. Please ensure that #{configuration.log_path} exists and is chmod 0666. " +
         | 
| 259 260 | 
             
                        "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
         | 
| @@ -274,14 +275,13 @@ module Rails | |
| 274 275 | 
             
                  end
         | 
| 275 276 | 
             
                end
         | 
| 276 277 |  | 
| 277 | 
            -
                # Sets  | 
| 278 | 
            +
                # Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
         | 
| 278 279 | 
             
                # (but only for those frameworks that are to be loaded). If the framework's
         | 
| 279 | 
            -
                #  | 
| 280 | 
            +
                # paths have already been set, it is not changed, otherwise it is
         | 
| 280 281 | 
             
                # set to use Configuration#view_path.
         | 
| 281 282 | 
             
                def initialize_framework_views
         | 
| 282 | 
            -
                   | 
| 283 | 
            -
             | 
| 284 | 
            -
                  end
         | 
| 283 | 
            +
                  ActionMailer::Base.template_root ||= configuration.view_path  if configuration.frameworks.include?(:action_mailer)
         | 
| 284 | 
            +
                  ActionController::Base.view_paths = [configuration.view_path] if configuration.frameworks.include?(:action_controller) && ActionController::Base.view_paths.empty?
         | 
| 285 285 | 
             
                end
         | 
| 286 286 |  | 
| 287 287 | 
             
                # If ActionController is not one of the loaded frameworks (Configuration#frameworks)
         | 
| @@ -299,12 +299,6 @@ module Rails | |
| 299 299 | 
             
                  Dependencies.mechanism = configuration.cache_classes ? :require : :load
         | 
| 300 300 | 
             
                end
         | 
| 301 301 |  | 
| 302 | 
            -
                # Sets the +BREAKPOINT_SERVER_PORT+ if Configuration#breakpoint_server
         | 
| 303 | 
            -
                # is true.
         | 
| 304 | 
            -
                def initialize_breakpoints
         | 
| 305 | 
            -
                  silence_warnings { Object.const_set("BREAKPOINT_SERVER_PORT", 42531) if configuration.breakpoint_server }
         | 
| 306 | 
            -
                end
         | 
| 307 | 
            -
             | 
| 308 302 | 
             
                # Loads support for "whiny nil" (noisy warnings when methods are invoked
         | 
| 309 303 | 
             
                # on +nil+ values) if Configuration#whiny_nils is true.
         | 
| 310 304 | 
             
                def initialize_whiny_nils
         | 
| @@ -338,76 +332,17 @@ module Rails | |
| 338 332 |  | 
| 339 333 | 
             
                # Fires the user-supplied after_initialize block (Configuration#after_initialize)
         | 
| 340 334 | 
             
                def after_initialize
         | 
| 341 | 
            -
                  configuration. | 
| 342 | 
            -
             | 
| 343 | 
            -
             | 
| 344 | 
            -
                protected
         | 
| 345 | 
            -
                  # Return a list of plugin paths within base_path.  A plugin path is
         | 
| 346 | 
            -
                  # a directory that contains either a lib directory or an init.rb file.
         | 
| 347 | 
            -
                  # This recurses into directories which are not plugin paths, so you
         | 
| 348 | 
            -
                  # may organize your plugins within the plugin path.
         | 
| 349 | 
            -
                  def find_plugins(*base_paths)
         | 
| 350 | 
            -
                    base_paths.flatten.inject([]) do |plugins, base_path|
         | 
| 351 | 
            -
                      Dir.glob(File.join(base_path, '*')).each do |path|
         | 
| 352 | 
            -
                        if plugin_path?(path)
         | 
| 353 | 
            -
                          plugins << path if plugin_enabled?(path)
         | 
| 354 | 
            -
                        elsif File.directory?(path)
         | 
| 355 | 
            -
                          plugins += find_plugins(path)
         | 
| 356 | 
            -
                        end
         | 
| 357 | 
            -
                      end
         | 
| 358 | 
            -
                      plugins
         | 
| 359 | 
            -
                    end
         | 
| 360 | 
            -
                  end
         | 
| 361 | 
            -
             | 
| 362 | 
            -
                  def plugin_path?(path)
         | 
| 363 | 
            -
                    File.directory?(path) and (File.directory?(File.join(path, 'lib')) or File.file?(File.join(path, 'init.rb')))
         | 
| 335 | 
            +
                  configuration.after_initialize_blocks.each do |block|
         | 
| 336 | 
            +
                    block.call
         | 
| 364 337 | 
             
                  end
         | 
| 338 | 
            +
                end
         | 
| 365 339 |  | 
| 366 | 
            -
             | 
| 367 | 
            -
             | 
| 340 | 
            +
                def load_application_initializers
         | 
| 341 | 
            +
                  Dir["#{configuration.root_path}/config/initializers/**/*.rb"].sort.each do |initializer|
         | 
| 342 | 
            +
                    load(initializer)
         | 
| 368 343 | 
             
                  end
         | 
| 344 | 
            +
                end
         | 
| 369 345 |  | 
| 370 | 
            -
                  # Load the plugin at <tt>path</tt> unless already loaded.
         | 
| 371 | 
            -
                  #
         | 
| 372 | 
            -
                  # Each plugin is initialized:
         | 
| 373 | 
            -
                  # * add its +lib+ directory, if present, to the beginning of the load path
         | 
| 374 | 
            -
                  # * evaluate <tt>init.rb</tt> if present
         | 
| 375 | 
            -
                  #
         | 
| 376 | 
            -
                  # Returns <tt>true</tt> if the plugin is successfully loaded or
         | 
| 377 | 
            -
                  # <tt>false</tt> if it is already loaded (similar to Kernel#require).
         | 
| 378 | 
            -
                  # Raises <tt>LoadError</tt> if the plugin is not found.
         | 
| 379 | 
            -
                  def load_plugin(directory)
         | 
| 380 | 
            -
                    name = File.basename(directory)
         | 
| 381 | 
            -
                    return false if loaded_plugins.include?(name)
         | 
| 382 | 
            -
             | 
| 383 | 
            -
                    # Catch nonexistent and empty plugins.
         | 
| 384 | 
            -
                    raise LoadError, "No such plugin: #{directory}" unless plugin_path?(directory)
         | 
| 385 | 
            -
             | 
| 386 | 
            -
                    lib_path  = File.join(directory, 'lib')
         | 
| 387 | 
            -
                    init_path = File.join(directory, 'init.rb')
         | 
| 388 | 
            -
                    has_lib   = File.directory?(lib_path)
         | 
| 389 | 
            -
                    has_init  = File.file?(init_path)
         | 
| 390 | 
            -
             | 
| 391 | 
            -
                    # Add lib to load path *after* the application lib, to allow
         | 
| 392 | 
            -
                    # application libraries to override plugin libraries.
         | 
| 393 | 
            -
                    if has_lib
         | 
| 394 | 
            -
                      application_lib_index = $LOAD_PATH.index(File.join(RAILS_ROOT, "lib")) || 0
         | 
| 395 | 
            -
                      $LOAD_PATH.insert(application_lib_index + 1, lib_path)
         | 
| 396 | 
            -
                      Dependencies.load_paths << lib_path
         | 
| 397 | 
            -
                      Dependencies.load_once_paths << lib_path
         | 
| 398 | 
            -
                    end
         | 
| 399 | 
            -
             | 
| 400 | 
            -
                    # Allow plugins to reference the current configuration object
         | 
| 401 | 
            -
                    config = configuration
         | 
| 402 | 
            -
            	
         | 
| 403 | 
            -
                    # Add to set of loaded plugins before 'name' collapsed in eval.
         | 
| 404 | 
            -
                    loaded_plugins << name
         | 
| 405 | 
            -
             | 
| 406 | 
            -
                    # Evaluate init.rb.
         | 
| 407 | 
            -
                    silence_warnings { eval(IO.read(init_path), binding, init_path) } if has_init
         | 
| 408 | 
            -
             | 
| 409 | 
            -
                    true
         | 
| 410 | 
            -
                  end
         | 
| 411 346 | 
             
              end
         | 
| 412 347 |  | 
| 413 348 | 
             
              # The Configuration class holds all the parameters for the Initializer and
         | 
| @@ -432,24 +367,16 @@ module Rails | |
| 432 367 | 
             
                # A stub for setting options on ActionView::Base
         | 
| 433 368 | 
             
                attr_accessor :action_view
         | 
| 434 369 |  | 
| 435 | 
            -
                # A stub for setting options on ActionWebService::Base
         | 
| 436 | 
            -
                attr_accessor :action_web_service
         | 
| 437 | 
            -
             | 
| 438 370 | 
             
                # A stub for setting options on ActiveRecord::Base
         | 
| 439 371 | 
             
                attr_accessor :active_record
         | 
| 440 372 |  | 
| 441 | 
            -
                #  | 
| 442 | 
            -
                attr_accessor : | 
| 373 | 
            +
                # A stub for setting options on ActiveRecord::Base
         | 
| 374 | 
            +
                attr_accessor :active_resource
         | 
| 443 375 |  | 
| 444 376 | 
             
                # Whether or not classes should be cached (set to false if you want
         | 
| 445 377 | 
             
                # application classes to be reloaded on each request)
         | 
| 446 378 | 
             
                attr_accessor :cache_classes
         | 
| 447 379 |  | 
| 448 | 
            -
                # The list of connection adapters to load. (By default, all connection
         | 
| 449 | 
            -
                # adapters are loaded. You can set this to be just the adapter(s) you
         | 
| 450 | 
            -
                # will use to reduce your application's load time.)
         | 
| 451 | 
            -
                attr_accessor :connection_adapters
         | 
| 452 | 
            -
             | 
| 453 380 | 
             
                # The list of paths that should be searched for controllers. (Defaults
         | 
| 454 381 | 
             
                # to <tt>app/controllers</tt> and <tt>components</tt>.)
         | 
| 455 382 | 
             
                attr_accessor :controller_paths
         | 
| @@ -461,7 +388,7 @@ module Rails | |
| 461 388 | 
             
                # The list of rails framework components that should be loaded. (Defaults
         | 
| 462 389 | 
             
                # to <tt>:active_record</tt>, <tt>:action_controller</tt>,
         | 
| 463 390 | 
             
                # <tt>:action_view</tt>, <tt>:action_mailer</tt>, and
         | 
| 464 | 
            -
                # <tt>: | 
| 391 | 
            +
                # <tt>:active_resource</tt>).
         | 
| 465 392 | 
             
                attr_accessor :frameworks
         | 
| 466 393 |  | 
| 467 394 | 
             
                # An array of additional paths to prepend to the load path. By default,
         | 
| @@ -497,12 +424,36 @@ module Rails | |
| 497 424 | 
             
                # The list of plugins to load. If this is set to <tt>nil</tt>, all plugins will
         | 
| 498 425 | 
             
                # be loaded. If this is set to <tt>[]</tt>, no plugins will be loaded. Otherwise,
         | 
| 499 426 | 
             
                # plugins will be loaded in the order specified.
         | 
| 500 | 
            -
                 | 
| 427 | 
            +
                attr_reader :plugins
         | 
| 428 | 
            +
                def plugins=(plugins)
         | 
| 429 | 
            +
                  @plugins = plugins.nil? ? nil : plugins.map { |p| p.to_sym }
         | 
| 430 | 
            +
                end
         | 
| 501 431 |  | 
| 502 432 | 
             
                # The path to the root of the plugins directory. By default, it is in
         | 
| 503 433 | 
             
                # <tt>vendor/plugins</tt>.
         | 
| 504 434 | 
             
                attr_accessor :plugin_paths
         | 
| 505 435 |  | 
| 436 | 
            +
                # The classes that handle finding the desired plugins that you'd like to load for
         | 
| 437 | 
            +
                # your application. By default it is the Rails::Plugin::FileSystemLocator which finds
         | 
| 438 | 
            +
                # plugins to load in <tt>vendor/plugins</tt>. You can hook into gem location by subclassing
         | 
| 439 | 
            +
                # Rails::Plugin::Locator and adding it onto the list of <tt>plugin_locators</tt>.
         | 
| 440 | 
            +
                attr_accessor :plugin_locators
         | 
| 441 | 
            +
             | 
| 442 | 
            +
                # The class that handles loading each plugin. Defaults to Rails::Plugin::Loader, but
         | 
| 443 | 
            +
                # a sub class would have access to fine grained modification of the loading behavior. See
         | 
| 444 | 
            +
                # the implementation of Rails::Plugin::Loader for more details.
         | 
| 445 | 
            +
                attr_accessor :plugin_loader
         | 
| 446 | 
            +
                
         | 
| 447 | 
            +
                # Deprecated options:
         | 
| 448 | 
            +
                def breakpoint_server(_ = nil)
         | 
| 449 | 
            +
                  $stderr.puts %(
         | 
| 450 | 
            +
                  *******************************************************************
         | 
| 451 | 
            +
                  * config.breakpoint_server has been deprecated and has no effect. *
         | 
| 452 | 
            +
                  *******************************************************************
         | 
| 453 | 
            +
                  )
         | 
| 454 | 
            +
                end
         | 
| 455 | 
            +
                alias_method :breakpoint_server=, :breakpoint_server
         | 
| 456 | 
            +
             | 
| 506 457 | 
             
                # Create a new Configuration instance, initialized with the default
         | 
| 507 458 | 
             
                # values.
         | 
| 508 459 | 
             
                def initialize
         | 
| @@ -516,10 +467,11 @@ module Rails | |
| 516 467 | 
             
                  self.view_path                    = default_view_path
         | 
| 517 468 | 
             
                  self.controller_paths             = default_controller_paths
         | 
| 518 469 | 
             
                  self.cache_classes                = default_cache_classes
         | 
| 519 | 
            -
                  self.breakpoint_server            = default_breakpoint_server
         | 
| 520 470 | 
             
                  self.whiny_nils                   = default_whiny_nils
         | 
| 521 471 | 
             
                  self.plugins                      = default_plugins
         | 
| 522 472 | 
             
                  self.plugin_paths                 = default_plugin_paths
         | 
| 473 | 
            +
                  self.plugin_locators              = default_plugin_locators
         | 
| 474 | 
            +
                  self.plugin_loader                = default_plugin_loader
         | 
| 523 475 | 
             
                  self.database_configuration_file  = default_database_configuration_file
         | 
| 524 476 |  | 
| 525 477 | 
             
                  for framework in default_frameworks
         | 
| @@ -542,6 +494,9 @@ module Rails | |
| 542 494 | 
             
                    else
         | 
| 543 495 | 
             
                      Pathname.new(::RAILS_ROOT).realpath.to_s
         | 
| 544 496 | 
             
                    end
         | 
| 497 | 
            +
                  
         | 
| 498 | 
            +
                  Object.const_set(:RELATIVE_RAILS_ROOT, ::RAILS_ROOT.dup) unless defined?(::RELATIVE_RAILS_ROOT)
         | 
| 499 | 
            +
                  ::RAILS_ROOT.replace @root_path
         | 
| 545 500 | 
             
                end
         | 
| 546 501 |  | 
| 547 502 | 
             
                # Loads and returns the contents of the #database_configuration_file. The
         | 
| @@ -563,16 +518,16 @@ module Rails | |
| 563 518 | 
             
                  ::RAILS_ENV
         | 
| 564 519 | 
             
                end
         | 
| 565 520 |  | 
| 566 | 
            -
                #  | 
| 521 | 
            +
                # Adds a block which will be executed after rails has been fully initialized.
         | 
| 567 522 | 
             
                # Useful for per-environment configuration which depends on the framework being
         | 
| 568 523 | 
             
                # fully initialized.
         | 
| 569 524 | 
             
                def after_initialize(&after_initialize_block)
         | 
| 570 | 
            -
                   | 
| 525 | 
            +
                  after_initialize_blocks << after_initialize_block if after_initialize_block
         | 
| 571 526 | 
             
                end
         | 
| 572 527 |  | 
| 573 | 
            -
                # Returns the  | 
| 574 | 
            -
                def  | 
| 575 | 
            -
                  @ | 
| 528 | 
            +
                # Returns the blocks added with Configuration#after_initialize
         | 
| 529 | 
            +
                def after_initialize_blocks
         | 
| 530 | 
            +
                  @after_initialize_blocks ||= []
         | 
| 576 531 | 
             
                end
         | 
| 577 532 |  | 
| 578 533 | 
             
                # Add a preparation callback that will run before every request in development
         | 
| @@ -590,16 +545,14 @@ module Rails | |
| 590 545 | 
             
                end
         | 
| 591 546 |  | 
| 592 547 | 
             
                def framework_paths
         | 
| 593 | 
            -
                   | 
| 594 | 
            -
                   | 
| 595 | 
            -
             | 
| 596 | 
            -
             | 
| 597 | 
            -
                     | 
| 598 | 
            -
             | 
| 599 | 
            -
             | 
| 600 | 
            -
             | 
| 601 | 
            -
                    actionwebservice/lib
         | 
| 602 | 
            -
                  ).map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
         | 
| 548 | 
            +
                  paths = %w(railties railties/lib activesupport/lib)
         | 
| 549 | 
            +
                  paths << 'actionpack/lib' if frameworks.include? :action_controller or frameworks.include? :action_view
         | 
| 550 | 
            +
                  
         | 
| 551 | 
            +
                  [:active_record, :action_mailer, :active_resource, :action_web_service].each do |framework|
         | 
| 552 | 
            +
                    paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include? framework
         | 
| 553 | 
            +
                  end
         | 
| 554 | 
            +
                  
         | 
| 555 | 
            +
                  paths.map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
         | 
| 603 556 | 
             
                end
         | 
| 604 557 |  | 
| 605 558 | 
             
                private
         | 
| @@ -608,7 +561,7 @@ module Rails | |
| 608 561 | 
             
                  end
         | 
| 609 562 |  | 
| 610 563 | 
             
                  def default_frameworks
         | 
| 611 | 
            -
                    [ :active_record, :action_controller, :action_view, :action_mailer, : | 
| 564 | 
            +
                    [ :active_record, :action_controller, :action_view, :action_mailer, :active_resource ]
         | 
| 612 565 | 
             
                  end
         | 
| 613 566 |  | 
| 614 567 | 
             
                  def default_load_paths
         | 
| @@ -627,7 +580,6 @@ module Rails | |
| 627 580 | 
             
                      app/controllers
         | 
| 628 581 | 
             
                      app/helpers
         | 
| 629 582 | 
             
                      app/services
         | 
| 630 | 
            -
                      app/apis
         | 
| 631 583 | 
             
                      components
         | 
| 632 584 | 
             
                      config
         | 
| 633 585 | 
             
                      lib
         | 
| @@ -659,7 +611,7 @@ module Rails | |
| 659 611 | 
             
                  end
         | 
| 660 612 |  | 
| 661 613 | 
             
                  def default_controller_paths
         | 
| 662 | 
            -
                    paths = [ | 
| 614 | 
            +
                    paths = [File.join(root_path, 'app', 'controllers')]
         | 
| 663 615 | 
             
                    paths.concat builtin_directories
         | 
| 664 616 | 
             
                    paths
         | 
| 665 617 | 
             
                  end
         | 
| @@ -672,10 +624,6 @@ module Rails | |
| 672 624 | 
             
                    false
         | 
| 673 625 | 
             
                  end
         | 
| 674 626 |  | 
| 675 | 
            -
                  def default_breakpoint_server
         | 
| 676 | 
            -
                    false
         | 
| 677 | 
            -
                  end
         | 
| 678 | 
            -
             | 
| 679 627 | 
             
                  def default_whiny_nils
         | 
| 680 628 | 
             
                    false
         | 
| 681 629 | 
             
                  end
         | 
| @@ -687,6 +635,14 @@ module Rails | |
| 687 635 | 
             
                  def default_plugin_paths
         | 
| 688 636 | 
             
                    ["#{root_path}/vendor/plugins"]
         | 
| 689 637 | 
             
                  end
         | 
| 638 | 
            +
             | 
| 639 | 
            +
                  def default_plugin_locators
         | 
| 640 | 
            +
                    [Plugin::FileSystemLocator]
         | 
| 641 | 
            +
                  end
         | 
| 642 | 
            +
             | 
| 643 | 
            +
                  def default_plugin_loader
         | 
| 644 | 
            +
                    Plugin::Loader
         | 
| 645 | 
            +
                  end
         | 
| 690 646 | 
             
              end
         | 
| 691 647 | 
             
            end
         | 
| 692 648 |  |