aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/deprecation
Commit message (Collapse)AuthorAgeFilesLines
* Return back "/" to the end of RAILS_GEM_ROOTbogdanvlviv2018-04-201-1/+1
| | | | | | | | | | | - The "/" was removed in 40bdbce191ad90dfea43dad51fac5c4726b89392 during refactoring. It may cause regression since looks like was added intentionaly because it is possible that a name of any another gem can start with /rails/, so slash was added to ensure that it is "rails" gem. I would like to backport this to `5-2-stable` too. - Use `__dir__` instead of `__FILE__`. Follow up #29176.
* Correct ActiveSupport::Deprecation::Behavior#behavior= documentationJohn Fragoulis2018-02-231-1/+1
| | | | | The callback parameters need to reflect changes after https://github.com/rails/rails/pull/28800
* Enable autocorrect for `Lint/EndAlignment` copKoichi ITO2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
* Preserve original method visibility when deprecating a methodJordan Brough2017-12-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes `deprecate` so that it preserves method visibility (like it did previously when it was utilizing `alias_method_chain`). When Module#prepend replaced alias_method_chain in a982a42 it caused deprecated methods to always become public. `alias_method_chain` had this bit of code: https://github.com/rails/rails/blob/v5.0.6/activesupport/lib/active_support/core_ext/module/aliasing.rb#L40-L47 which preserved method visibility. Without this fix, a workaround would be: ```ruby class C8 private def new_method end def old_method end deprecate :old_method, :new_method # workaround: instance_method(:old_method).owner.send(:private, :old_method) end ``` Because the visibility needs to be fixed on the Module prepended by MethodWrapper.
* Formatting fix for example codeT.J. Schuck2017-11-282-2/+2
| | | | | | | | | | | | | | | | Just cleaning up the formatting of the example code here to format an inline bit of commentary as a comment. Before: ![](https://monosnap.com/file/Clso8IQGOWHU3o6cStbY5NaMPx3ysP.png) After: ![](https://monosnap.com/file/QdbKKvLAeiQ0RucppVYETvaWEstnOI.png) [ci skip]
* [ci skip] Fix documentation for deprecation method_wrappersIgnat Zakrevsky2017-11-271-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seems like version with class methods doesn't work. ```ruby require "active_support/deprecation.rb" module Fred extend self def aaa; end def bbb; end def ccc; end def ddd; end def eee; end end ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') Fred.aaa Fred.bbb Fred.ccc ``` # produces nothing vs ```ruby require "active_support/deprecation.rb" class Fred def aaa; end def bbb; end def ccc; end def ddd; end def eee; end end ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') Fred.new.aaa Fred.new.bbb Fred.new.ccc ``` produces ``` DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.2 (called from <main> at deprications.rb:15) DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.2 (use zzz instead) (called from <main> at deprications.rb:16) DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.2 (use Bar#ccc instead) (called from <main> at deprications.rb:17) ```
* Deprecate ActiveSupport::Inflector#acronym_regexNick LaMuro2017-10-282-3/+4
| | | | | | | | | To be removed in Rails 6.0 (default for the deprecate helper). Code moved around as well for the ActiveSupport::Deprecation modules, since it was dependent on ActiveSupport::Inflector being loaded for it to work. By "lazy loading" the Inflector code from within the Deprecation code, we can require ActiveSupport::Deprecation from ActiveSupport::Inflector and not get a circular dependency issue.
* [Active Support] require_relative => requireAkira Matsuda2017-10-215-9/+9
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-116-0/+6
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-096-0/+6
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-015-9/+9
|
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Send deprecation horizon and gem name as arguments to deprecation heavier ↵Willem van Bergen2017-04-192-9/+22
| | | | handler, and make sure they are used for the ActiveSupport::Notifications message.
* Add AS::Deprecation::DeprecatedConstantAccessorDominic Cleal2017-03-221-0/+50
| | | | | | | An alternative to DeprecatedConstantProxy which works more transparently with exceptions because it returns the object that the new constant refers to rather than a proxy. This is then compatible with `rescue OldException`.
* Remove redundant namespaces from sample code of `deprecated_method_warning` ↵kenta-s2017-02-151-3/+3
| | | | [ci skip]
* Fix the return of `deprecate_methods` in doc [ci skip]kenta-s2017-02-141-1/+1
|
* Change ActionView ERB Handler from Erubis to ErubiJeremy Evans2017-01-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Erubi offers the following advantages for Rails: * Works with ruby's --enable-frozen-string-literal option * Has 88% smaller memory footprint * Does no freedom patching (Erubis adds a method to Kernel) * Has simpler internals (1 file, <150 lines of code) * Has an open development model (Erubis doesn't have a public source control repository or bug tracker) * Is not dead (Erubis hasn't been updated since 2011) Erubi is a simplified fork of Erubis that contains just the parts that are generally needed (which includes the parts that Rails uses). The only intentional difference in behavior is that it does not include support for <%=== tags for debug output. That could be added to the ActionView ERB handler if it is desired. The Erubis template handler remains in a deprecated state so that code that accesses it directly does not break. It can be removed after Rails 5.1.
* Correct caller tracking in delegated deprecation methodsMatthew Draper2016-10-031-0/+13
|
* applies remaining conventions across the projectXavier Noria2016-08-061-2/+2
|
* modernizes hash syntax in activesupportXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-065-9/+9
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* systematic revision of =~ usage in ASXavier Noria2016-07-221-1/+2
| | | | | Where appropriate prefer the more concise Regexp#match?, String#include?, String#start_with?, and String#end_with?
* `behaviour` --> `behavior`Jon Moss2016-05-271-1/+1
| | | | http://edgeguides.rubyonrails.org/api_documentation_guidelines.html#english
* Pass over all Rails 5 warnings, to make sure:Vipul A M2016-04-121-1/+0
| | | | | | | | | | - we are ending sentences properly - fixing of space issues - fixed continuity issues in some sentences. Reverts https://github.com/rails/rails/commit/8fc97d198ef31c1d7a4b9b849b96fc08a667fb02 . This change reverts making sure we add '.' at end of deprecation sentences. This is to keep sentences within Rails itself consistent and with a '.' at the end.
* :bomb: run the test @rafaelfranca :angry:Rafael Mendonça França2016-02-241-1/+1
|
* Ignore callstacks from Ruby stdlib in deprecationRafael Mendonça França2016-02-241-4/+12
| | | | Fixes #22982.
* Converting backtrace to strings before calling set_backtraceTony Novak2016-02-101-1/+1
| | | | Fixes #23058
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-02-071-2/+2
|\
| * [ci skip] Fix one more typoPrathamesh Sonpatki2016-01-301-1/+1
| | | | | | | | - Followup of https://github.com/rails/docrails/commit/10bc49710b7205a6172c3e072b3c77114fefd952
| * [ci skip] Fix typoyui-knk2016-01-271-1/+1
| |
* | Fix nodoc to internal class error document some of themVipul A M2016-01-251-0/+2
|/ | | | | | | [ci skip] Fixes #20808 [Vipul A M & Julio Lopez]
* Update deprecation_horizon to 5.1 from 5.0 [ci skip]Ryuta Kamizono2016-01-141-3/+3
|
* Fix deprecation message when frame doesn't have absolute_pathRafael Mendonça França2015-11-031-1/+1
| | | | | | When a frame is an eval block without filename argument there is no absolute_path so the previous implementation would fail because `nil` doesn't responds to `start_with?`.
* Fix bug where custom deprecators are not used.Brandon Dunne2015-10-141-12/+36
| | | | | | | | | | | | Add tests for ActiveSupport::Deprecation.deprecate_methods Modify ActiveSupport::Testing::Deprecation to allow a custom deprecator Leverage ActiveSupport::Testing::Deprecation assert_deprecated Update documentation for ActiveSupport::Deprecation.deprecate_methods Use cases: Using the default deprecator => "removed from Rails X.Y" Passing a custom deprecator in the options hash => "removed from MyGem next-release" Deprecating methods directly from custom deprecator => "removed from MyGem next-release"
* Only prepend a single module when defining deprecation wrappers.Charles Oliver Nutter2015-10-131-4/+4
| | | | | I could not find any reason why each method got its own prepended module here, and all tests appear to pass with my change.
* Documentation typoAkira Matsuda2015-09-201-1/+1
| | | | [ci skip]
* use `caller_locations` instead of `caller`Aaron Patterson2015-08-242-3/+14
| | | | | We have `caller_locations`, so we don't need to parse the strings in the callstack.
* A few documentation tweaks [ci skip]Robin Dupret2015-06-072-4/+4
| | | | [Robin Dupret & Shunsuke Aida]
* Merge pull request #20286 from davydovanton/doc-deprecation-behaviorAbdelkader Boudih2015-05-251-0/+12
|\ | | | | Add documentation for Deprecation::Behavior module
| * [skip ci] Add documentation for Deprecation::Behavior moduleAnton Davydov2015-05-251-0/+12
| |
* | s/contstant/constant re #20282 [ci skip]Zachary Scott2015-05-241-2/+2
| |
* | [skip ci] Add documentation for DeprecatedConstantProxy#classAnton Davydov2015-05-241-0/+5
|/
* Tiny documentation edits [ci skip]Robin Dupret2015-05-041-14/+16
| | | | | | * Fix a few typos * Wrap lines to 80 chars * Use `+` instead of `<tt>`
* [ci skip] Rework docs, add examples on deprecation proxiesNick Cox2015-04-241-22/+38
|
* Deprecate alias_method_chain in favour of Module#prependKir Shatrov2015-03-221-3/+5
| | | …as discussed #19413
* Do not check only for the Rails constantRafael Mendonça França2015-01-021-1/+1
| | | | | This constant may be define for auxiliar gems like rails-html-sanitizer and these methods call will fail.
* renames the :abort deprecation behaviour to :raiseXavier Noria2013-08-131-2/+2
| | | | That is a better name, thanks @jeremy.
* defines a new :abort deprecation behaviour that raisesXavier Noria2013-08-131-5/+18
| | | | See the CHANGELONG message in the patch for further details.
* Fix typos in deprecation proxy docs [ci skip]Carlos Antonio da Silva2013-04-301-3/+3
|
* Update activesupport/lib/active_support/deprecation/proxy_wrappers.rbClaudio B.2012-12-071-1/+1
| | | Fix a typo in rdoc (*expect* for *except*)