aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/finisher.rb
Commit message (Collapse)AuthorAgeFilesLines
* Explains a detail re eager loading [ci skip]Xavier Noria2019-02-201-0/+3
|
* Zeitwerk integrationXavier Noria2019-02-121-0/+8
|
* Only execute route updater once on app bootJonathan Boler2018-06-191-1/+1
|
* Clarify that config.eager_load controls eager loading [ci skip]Eugene Kenny2017-12-301-1/+1
| | | | | | | Before Rails 4.0, `config.cache_classes` determined whether application code was eager loaded. The `config.eager_load` option was introduced to allow the two behaviours to be configured independently, but this documentation was never updated to reflect that change.
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Fully initialize routes before the first request is handledJean Boussier2017-01-181-0/+1
| | | | | | | | | | | | `AD::Journey::GTG::Simulator` is lazily built the first time `Journey::Router#find_routes` is invoked, which happens when the first request is served. On large applications with many routes, building the simulator can take several hundred milliseconds (~700ms for us). Triggering this initialization during the boot process reduces the impact of deploys on the application response time.
* code gardening: removes redundant selfsXavier Noria2016-08-081-2/+2
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* applies new string literal convention in railties/libXavier Noria2016-08-061-5/+5
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Setup default session store internally, no longer through an application ↵Prathamesh Sonpatki2016-07-171-0/+8
| | | | | | | | | | | | | initializer - By default the session store will be set to cookie store with application name as session key. - Older apps are not affected as they will have the session store initializer generated by Rails in older versions, and Rails will not overwrite the session store if it is already set or disabled. - But new apps will not have the initializer, instead the session store will be set to cookie store by default. - Based on comment by DHH here - https://github.com/rails/rails/issues/25181#issuecomment-222312764.
* Add option to enable dependency loading in productionRafael Mendonça França2016-06-221-1/+1
| | | | | | | | This will make easier to applications that rely on having const_missing hooks in production upgrade to Rails 5. This option is going to be remove in the future and the default behavior will be to disable the dependency loading.
* Fix rails/info routes for apps with globbing routeNicholas Firth-McCoy2016-06-201-1/+4
| | | | | | | | The /rails/info routes were inaccessible in apps with a catch-all globbing route, as they were being appended after the globbing route and would never be matched. See also ccc3ddb7762bae0df7e2f8d643b19b6a4769d5be.
* `behaviour` --> `behavior`Jon Moss2016-05-271-1/+1
| | | | http://edgeguides.rubyonrails.org/api_documentation_guidelines.html#english
* Directly support stateful executor hooksMatthew Draper2016-04-051-13/+26
| | | | Also, make sure to call the +complete+ hooks if +run+ fails.
* Publish AS::Executor and AS::Reloader APIsMatthew Draper2016-03-021-13/+60
| | | | | | These should allow external code to run blocks of user code to do "work", at a similar unit size to a web request, without needing to get intimate with ActionDipatch.
* Add `internal` attribute to routesJon Moss2016-02-221-4/+4
| | | | | | | | | | | | | | This is meant to provide a way for Action Cable, Sprockets, and possibly other Rack applications to mark themselves as internal, and to exclude themselves from the routing inspector, and thus `rails routes` / `rake routes`. I think this is the only way to have mounted Rack apps be marked as internal, within AD/Journey. Another option would be to create an array of regexes for internal apps, and then to iterate over that everytime a request comes through. Also, I only had the first `add_route` method set `internal`'s default to false, to avoid littering it all over the codebase.
* Always obtain the lock and do the unloadMatthew Draper2016-02-021-1/+1
| | | | | | We mostly care about `reload_classes_only_on_change=true`, because that's the default... and there, we definitely need to wait for the lock when necessary.
* We need stricter locking before we can unloadMatthew Draper2015-07-201-1/+1
| | | | | | | | | | | | Specifically, the "loose upgrades" behaviour that allows us to obtain an exclusive right to load things while other requests are in progress (but waiting on the exclusive lock for themselves) prevents us from treating load & unload interchangeably: new things appearing is fine, but they do *not* expect previously-present constants to vanish. We can still use loose upgrades for unloading -- once someone has decided to unload, they don't really care if someone else gets there first -- it just needs to be tracked separately.
* Rely on the load interlock for non-caching reloads, tooMatthew Draper2015-07-091-2/+4
|
* Revert "Don't unhook autoloading in production"Aaron Patterson2015-02-161-0/+7
| | | | This reverts commit a8bf12979e5fa15282b39c8cfa315e663f613539.
* Add configuration to enable mail previewsLeonard Garvey2014-07-011-2/+0
| | | | | | | | | | | | | | | | | | Adds `config.action_mailer.preview_enabled` This allows mail previewing to be enabled easily in non-development environments such as staging. The default is set to true for development so no changes should be required to existing Rails applications. The mail preview path can still be configured using the existing `config.action_mailer.preview_path` configuration option. Adding this avoids devs from having to do stuff like: https://gist.github.com/lengarvey/fa2c9bd6cdbeba96526a Update actionmailer/CHANGELOG with new configuration. Update configuring guide with new configuratation. Add `config.action_mailer.preview_path` to configuring guide.
* Add mailer previews feature based on mail_view gemAndrew White2013-12-171-0/+2
|
* Revert "Match Dev/Prod parity for Index Page"Piotr Sarnacki2013-07-221-3/+1
| | | | | | | | Showing welcome page in production can expose information, which should not be visible on production if people don't override the default root route. This reverts commit b0caea29c2da9f4c8bb958019813482da297067d.
* Match Dev/Prod parity for Index Pageschneems2013-07-201-1/+3
| | | | | | | With Rails 4 the default index page was moved from a static file `index.html` inside the `public/` folder to an internal controller/view inside of the railties gem. This was to allow use of erb in the default index page and to remove the requirement that new apps must delete a static file to make their index pages work. While this was a good change, the functionality was unexpected to developers who wish to get their apps running in production ASAP. They will create a new app `rails new my app`, start a server to verify it works, then immediately deploy the app to verify that it can start working in production. Unfortunately locally they see a page when they visit `localhost:3000` when they visit their production app they get an error page. We initially anticipated this problem in the original pull request, but did not properly anticipate the severity or quantity of people who would like this functionality. Having a default index page serves as an excellent litmus test for a passed deploy on default apps, and it is very unexpected to have a page work locally, but not on production. This change makes the default index page available in production if the developer has not over-written it by defining their own `root` path inside of routes.
* clearing autoloaded constants triggers routes reloading [Fixes #10685]Xavier Noria2013-06-061-8/+27
| | | | | Conflicts: railties/test/application/loading_test.rb
* Don't unhook autoloading in productionAndrew White2013-02-191-7/+0
| | | | | | | | | | | | | | | Whilst autoloading is known to be not threadsafe, leaving it in place is a softer solution than failing hard when an application is deployed. Many older applications will have paths added to `autoload_paths` and ideally these should be eagerly loaded to be threadsafe. However one of these paths is quite often lib which could lead to unintended consequences due to the 'junk drawer' nature of this directory. Developers should refrain from adding paths to `autoload_paths` or `eager_load_paths` and use custom folders inside app for code that needs to be eagerly loaded and use `require` or `require_dependency` to explicitly load code from other locations.
* Move background jobs to the 'jobs' branch until fully baked. Not shipping ↵Jeremy Kemper2012-12-211-9/+0
| | | | with Rails 4.0.
* Use Rails to Render Default Index Pageschneems2012-12-101-0/+1
| | | | | | | | | | | | | | | This is an alternative implementation to #7771 thanks to the advice of @spastorino Rails is a dynamic framework that serves a static index.html by default. One of my first questions ever on IRC was solved by simply deleting my public/index.html file. This file is a source of confusion when starting as it over-rides any set "root" in the routes yet it itself is not listed in the routes. By making the page dynamic by default we can eliminate this confusion. This PR moves the static index page to an internal controller/route/view similar to `rails/info`. When someone starts a rails server, if no root is defined, this route will take over and the "dynamic" index page from rails/welcome_controller will be rendered. These routes are only added in development. If a developer defines a root in their routes, it automatically takes precedence over this route and will be rendered, with no deleting of files required. In addition to removing this source of confusion for new devs, we can now use Rails view helpers to build and render this page. While not the primary intent, the added value of "dogfooding" should not be under-estimated. The prior PR #7771 had push-back since it introduced developer facing files. This PR solves all of the same problems, but does not have any new developer facing files (it actually removes one). cc/ @wsouto, @dickeyxxx, @tyre, @ryanb, @josevalim, @maxim, @subdigital, @steveklabnik ATP Railties and Actionpack.
* Job consumer logs to Rails.logger by defaultJeremy Kemper2012-10-261-0/+1
|
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-2/+2
|
* Test that a Rails.queue consumer is automatically started in productionJeremy Kemper2012-10-131-1/+2
|
* Backpedal from class-oriented config.queue. Set an actual queue instance.Jeremy Kemper2012-10-121-2/+2
|
* Fix build for Queue.Arun Agrawal2012-09-171-1/+1
|
* Move queue classes to ActiveSupportSantiago Pastorino2012-09-141-2/+2
|
* Fix failure on middleware/exceptions_testJosé Valim2012-08-231-1/+1
| | | | | | | The reason the test was failing was because when the test invokes `app.config`, the app is loaded and, as `eager_load` is set to true, it disables the dependency loading mechanism, so controllers that are later defined are not loaded.
* Get rid of config.preload_frameworks in favor of config.eager_load_namespacesJosé Valim2012-08-211-1/+1
| | | | | | | The new option allows any Ruby namespace to be registered and set up for eager load. We are effectively exposing the structure existing in Rails since v3.0 for all developers in order to make their applications thread-safe and CoW friendly.
* Allow users to choose when to eager_load the application or not.José Valim2012-08-211-2/+2
| | | | | | | | | | | | | | | | | Previously, the eager load behavior was mostly coupled to config.cache_classes, however this was suboptimal since in some environments a developer may want to cache classes but not necessarily load them all on boot (for example, test env). This pull request also promotes the use of config.eager_load set to true by default in production. In the majority of the cases, this is the behavior you want since it will copy most of your app into memory on boot (which was also the previous behavior). Finally, this fix a long standing Rails bug where it was impossible to access a model in a rake task when Rails was set as thread safe.
* /rails/info/routes path shows routing informationschneems2012-05-241-0/+2
| | | | Will show similar contents to the output of `$ rake routes` in the browser in development. This speeds the time required to generate routes, since the application is already initialized.
* Allow configuring a different queue consumerCarlos Antonio da Silva2012-05-041-2/+2
| | | | | | Also make sure to not use default queue consumer with custom queue implementation. It is up to the new queue implementation to start / shutdown the consumer.
* Use Rails::Queueing::Queue instead of Queue so people can build their own ↵José Valim2012-04-281-1/+1
| | | | consumers around stdlib's Queue
* Initial queue implementationYehuda Katz2012-04-261-0/+7
|
* Remove default match without specified methodJose and Yehuda2012-04-241-1/+1
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* Fix `$rails_rake_task` global variable warning without replacing the value ↵Jonathan Viney2012-01-221-2/+1
| | | | | of $rails_rake_task if it is already set. Fixes #4591.
* Clean up the cache before the request in case we are running in the ↵José Valim2011-12-151-1/+1
| | | | reload_classes_only_on_change schema.
* FileUpdateChecker should be able to handle deleted files.José Valim2011-12-131-4/+3
|
* Clean up FileUpdateChecker API.José Valim2011-12-131-1/+1
|
* Move hooks back to initializers (we need an API that allows hooks to be ↵José Valim2011-12-131-4/+21
| | | | replaced).
* Revert "Provide a unique point for running initializers."José Valim2011-12-131-4/+0
| | | | | | | | | | This reverts commit c2e3ce8d1e1174e66536d59d8d97eb2cc8ce6f25. Conflicts: railties/lib/rails/application/configuration.rb railties/lib/rails/application/finisher.rb railties/lib/rails/engine.rb
* Speed up development by only reloading classes if dependencies files changed.José Valim2011-12-121-7/+7
| | | | | | | | This can be turned off by setting `config.reload_classes_only_on_change` to false. Extensions like Active Record should add their respective files like db/schema.rb and db/structure.sql to `config.watchable_files` if they want their changes to affect classes reloading. Thanks to https://github.com/paneq/active_reload and Pastorino for the inspiration. <3