зеркало из https://github.com/github/guard.git
Add a sentence about the new signature of Guard::Plugin#initialize
Родитель
d6c879bdd8
Коммит
3d99e39689
|
@ -4,13 +4,18 @@ _This is a WIP, please not edit. Thanks, [@rymai](https://github.com/rymai)._
|
|||
|
||||
### `Guard::Guard` deprecated in favor of `Guard::Plugin`
|
||||
|
||||
To remove the confusion between Guard and its many plugins (guard-rspec, guard-pow, guard-livereload etc.), `Guard::Guard` is renamed `Guard::Plugin`. `Guard::Guard` is deprecated so if you're a plugin maintainer, in your next major release you should make your plugin inherit from `Guard::Plugin` instead of `Guard::Guard`.
|
||||
To remove the confusion between Guard and its many plugins (guard-rspec, guard-pow, guard-livereload etc.), `Guard::Guard` is renamed `Guard::Plugin`. `Guard::Guard` is deprecated so if you're a plugin maintainer, in your next (major) release **that will depend on Guard ~> 2.0** you must make your plugin inherit from `Guard::Plugin` instead of `Guard::Guard`.
|
||||
|
||||
For instance, for guard-bundler:
|
||||
Also, please be sure to change the `#initialize` signature from `#initialize(watchers = [], options = {})` to `#initialize(options = {})` (watchers are now passed in the `options` argument directly).
|
||||
|
||||
For instance, for guard-rspec:
|
||||
```ruby
|
||||
module Guard
|
||||
class Bundler < Guard
|
||||
# implementation
|
||||
class RSpec < Guard
|
||||
def initialize(watchers = [], options = {})
|
||||
super
|
||||
# rest of the implementation...
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
@ -20,7 +25,10 @@ should become:
|
|||
```ruby
|
||||
module Guard
|
||||
class Bundler < Plugin
|
||||
# implementation
|
||||
def initialize(options = {})
|
||||
super
|
||||
# rest of the implementation...
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
```
|
Загрузка…
Ссылка в новой задаче