aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies
Commit message (Collapse)AuthorAgeFilesLines
* Improves compatibility of require_dependency in zeitwerk mode [Closes #36774]Xavier Noria2019-07-281-1/+12
| | | | | | | | | | | | | | | Applications are not supposed to use require_dependency in their own code if running in zeitwerk mode, and require_dependency was initially aliased to require with that use case in mind. However, there are situations in which you cannot control the mode and need to be compatible with both. There, you might need require_dependency in case you are being executed in classic mode. Think about engines that want to support both modes in their parent applications, for example. Furthermore, Rails itself loads helpers using require_dependency. Therefore, we need better compatibility.
* let autoloaded? support modules with overridden names [closes #36757]Xavier Noria2019-07-251-1/+1
|
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* upgrades Zeitwerk to 2.1.4Xavier Noria2019-04-231-2/+7
| | | | | | This commit more or less undoes 9b5401f, restores autoloaded? not to touch the descendants tracker, and autoloaded_constants because it is documented in the guide.
* Auto-correct `Style/RedundantBegin` cop offencesRyuta Kamizono2019-04-121-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | It is newly added at 7b6b10542d5dac2b50f2578143dc5d70120d1146. ``` % be rubocop -a Inspecting 2781 files ...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Offenses: activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:13: C: [Corrected] Style/RedundantBegin: Redundant begin block detected. begin ^^^^^ activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:13:11: C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation. Rails.autoloaders.main.reload ^^^^ activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:16:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:16:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. 2781 files inspected, 6 offenses detected, 6 offenses corrected ```
* improves the reloading disabled error messageXavier Noria2019-04-111-1/+5
| | | | | | | | The original message from Zeitwerk is "can't reload, please call loader.enable_reloading before setup (Zeitwerk::Error)", which is not very informative for Rails programmers. Rails should err with a message worded in terms of its interface.
* depend on Zeitwerk 2.1.0Xavier Noria2019-04-091-11/+2
|
* depend on Zeitwerk 2Xavier Noria2019-04-071-3/+4
|
* fixes eager loading edge case in :zeitwerk modeXavier Noria2019-03-301-7/+13
|
* depend on Zeitwerk 1.4.0Xavier Noria2019-03-191-1/+5
|
* Engines are reloaded in Zeitwerk mode [closes #35618]Xavier Noria2019-03-151-2/+1
|
* Allow autoloader inflectors to be swaped outJean Boussier2019-03-081-4/+0
|
* Let Zeitwerk autoloaders inflect with Active SupportXavier Noria2019-02-231-2/+14
| | | | [Harry Brundage & Xavier Noria]
* simplify AS::Dependencies.verbose=Xavier Noria2019-02-211-1/+1
| | | | Possible thanks to Zeitwerk 1.3.0.
* let Zeitwerk integration unhook AS::DependenciesXavier Noria2019-02-191-0/+5
|
* Implement AS::Dependencies.verbose= compatibility for :zeitwerk modeXavier Noria2019-02-151-0/+5
|
* Replace autoloader accessors with Rails.autoloaders.{main,once}Xavier Noria2019-02-141-6/+4
| | | | | | | | | | | | | | | | Rails.autoloader and Rails.once_autoloader was just tentative API good enough for a first patch. Rails.autoloader is singular and does not convey in its name that there is another autoloader. That might be confusing, for example if you set a logger and miss traces. On the other hand, the name `once_autoloader` is very close to being horrible. Rails.autoloaders.main and Rails.autoloaders.once read better for my taste, and have a nice symmetry. Also, both "main" and "once" are four letters long, short and same length. They are tagged as "rails.main" and "rails.once", respectively. References #35235.
* Refactors a loopXavier Noria2019-02-131-6/+8
| | | | | | | | | I believe the current style does not clearly communicate that we are ignoring non-existing autoload paths altogether. Your eyes may even be looking for an else clause that is easy to miss but that does not exist. With the early `next` and code comment the loop reads better for my taste.
* styleXavier Noria2019-02-121-0/+2
|
* Zeitwerk integrationXavier Noria2019-02-121-0/+71
|
* [Active Support] require_relative => requireAkira Matsuda2017-10-212-2/+2
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-112-0/+2
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-092-0/+2
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-012-2/+2
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Provide a middleware to debug misbehaving locksMatthew Draper2016-06-101-0/+4
| | | | | Only intended to be enabled when in use; by necessity, it sits above any reasonable access control.
* Publish AS::Executor and AS::Reloader APIsMatthew Draper2016-03-021-8/+6
| | | | | | 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.
* Hand off the interlock to the new thread in AC::LiveMatthew Draper2016-02-071-0/+6
| | | | | | Most importantly, the original request thread must yield its share lock while waiting for the live thread to commit -- otherwise a request's base and live threads can deadlock against each other.
* After completing a load, give other threads a chance tooMatthew Draper2016-02-021-3/+3
| | | | | | | | | While we know no user code is running, we should do as much loading as we can. That way, all the threads will then be able to resume running user code together. Otherwise, only the last arriving thread would get to do its load, and would then return to userspace, leaving the others still blocked.
* We need stricter locking before we can unloadMatthew Draper2015-07-201-5/+11
| | | | | | | | | | | | 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.
* Document ShareLock and the InterlockMatthew Draper2015-07-091-6/+2
|
* Rely on the load interlock for non-caching reloads, tooMatthew Draper2015-07-091-0/+10
|
* Soften the lock requirements when eager_load is disabledMatthew Draper2015-07-091-0/+35
| | | | | We don't need to fully disable concurrent requests: just ensure that loads are performed in isolation.
* Avoid unnecessary allocations/callsPablo Herrero2014-11-021-1/+1
|
* remove unnecessary always-nil var from #compactGosha Arinich2013-01-011-1/+1
|
* add :nodoc: to AS::Autoload#extended [ci skip]Francesco Rodriguez2012-09-141-2/+1
|
* Make ActiveSupport::Autoload localJosé Valim2012-08-211-17/+43
| | | | | | | Previously, ActiveSupport::Autoload was global and reserved for usage inside Rails. This pull request makes it local, fixes its test (they were not being run because its file was named wrongly) and make it part of Rails public API.
* remove useless requireJan Xie2012-05-221-1/+0
|
* Improved ActiveSupport::Autoload performance.Pan Thomakos2012-03-111-4/+7
| | | | | | | | `ActiveSupport::Autoload#autoload` performance is improved in the default case where a path is present. Since the full path name is not generated, it isn't necessary to determine the full constant name either. This results in a 3x performance gain and reduces the number of Ruby objects generated. For a full benchmark check [this gist](https://gist.github.com/2020228).
* Replace the placeholder base_hook API with on_load. To specify some code thatwycats2010-03-291-4/+0
| | | | | | | | should run during framework load do: ActiveSupport.on_load(:action_controller) do # Code run in the context of AC::Base end
* Make many parts of Rails lazy. In order to facilitate this,wycats2010-03-071-0/+5
| | | | | | | | | | | | add lazy_load_hooks.rb, which allows us to declare code that should be run at some later time. For instance, this allows us to defer requiring ActiveRecord::Base at boot time purely to apply configuration. Instead, we register a hook that should apply configuration once ActiveRecord::Base is loaded. With these changes, brings down total boot time of a new app to 300ms in production and 400ms in dev. TODO: rename base_hook
* Flip deferrable autoload conventionJoshua Peek2009-12-221-5/+5
|
* Allow autoloads to opt out of eager loadingJoshua Peek2009-12-121-4/+16
|
* Reorganize autoloads:Carlhuda2009-12-021-0/+37
* A new module (ActiveSupport::Autoload) is provide that extends autoloading with new behavior. * All autoloads in modules that have extended ActiveSupport::Autoload will be eagerly required in threadsafe environments * Autoloads can optionally leave off the path if the path is the same as full_constant_name.underscore * It is possible to specify that a group of autoloads live under an additional path. For instance, all of ActionDispatch's middlewares are ActionDispatch::MiddlewareName, but they live under "action_dispatch/middlewares/middleware_name" * It is possible to specify that a group of autoloads are all found at the same path. For instance, a number of exceptions might all be declared there. * One consequence of this is that testing-related constants are not autoloaded. To get the testing helpers for a given component, require "component_name/test_case". For instance, "action_controller/test_case". * test_help.rb, which is automatically required by a Rails application's test helper, requires the test_case.rb for all active components, so this change will not be disruptive in existing or new applications.