README.md in as_deprecation_tracker-1.0.0 vs README.md in as_deprecation_tracker-1.1.0
- old
+ new
@@ -48,12 +48,15 @@
This will generate `config/as_deprecation_whitelist.yaml` with a list of
specific instances of deprecated calls which can be committed. Subsequent `rake
test` runs will then automatically raise errors for new occurrences.
Re-run tests with `AS_DEPRECATION_RECORD=yes` to append new instances to the
-existing configuration file, if you wish to whitelist rather than fix them.
+existing whitelist file, if you wish to permit rather than fix them.
+Use `AS_DEPRECATION_WHITELIST=~/rails_engine` to set a different root directory
+or whitelist file to update, e.g. for a Rails engine.
+
### Whitelist configuration
The whitelist may be broad, permitting any call causing a particular
deprecation message or be precise, only permitting known calls identified by
their backtrace. With broad whitelists, more instances of the same deprecated
@@ -69,21 +72,31 @@
- message: "Deprecated call to X, use Y instead"
- message: "Deprecated call to Z"
callstack: "app/models/foo.rb:23:in `example_method'"
```
-Accepted keys are `message`, matching the exact deprecation message and
-`callstack`, a string or an array forming the backtrace of the deprecation.
-If an array is given for the callstack, all entries must match the caller.
+Accepted keys are:
+* `message`, matching the exact deprecation message
+* `callstack`, a string or an array forming the backtrace of the deprecation.
+ If an array is given for the callstack, all entries must match the caller.
+* `engine`, a Rails `engine_name` string, matching any call within the engine
+
The callstack will match on as much data as is provided - if only a file is
given, any matching deprecation within the file will be whitelisted. The line
number and method specification may be given for more specificity. The line
number may vary by up to ten lines from the recorded number by default (see
`line_tolerance` to tune). Usually the filename and method name are sufficient
to match the caller without needing line numbers.
+Additional whitelist files may be placed below the root of each Rails engine
+and will be loaded at startup in addition to the main Rails root config file.
+
+Entries can be added programmatically by calling
+`ASDeprecationTracker.whitelist.add(message: ...)` with any of the supported
+keys above supplied as keyword arguments.
+
### Configuration
Use an initializer to change ASDT's behaviour at startup:
```ruby
@@ -99,10 +112,10 @@
differ from the deprecated call (defaults to 10)
* `register_behavior` controls whether to change the AS::Deprecation behavior
to ASDeprecationTracker::Receiver at startup, may be disabled to use multiple
behaviors (defaults to true)
* `whitelist_file` to customise the location of the whitelist YAML file
- (defaults to `config/as_deprecation_whitelist.yaml` beneath the Rails root)
+ (defaults to `config/as_deprecation_whitelist.yaml`)
## License
-Copyright (c) 2016 Dominic Cleal. Distributed under the MIT license.
+Copyright (c) 2016-2017 Dominic Cleal. Distributed under the MIT license.