Class: Guard::Codespell
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Codespell
- Defined in:
- lib/guard/codespell.rb
Overview
Service that runs the codespell tool inside guard. Based on an example from the guard documentation github.com/guard/guard/wiki/Create-a-guard
Instance Attribute Summary collapse
-
#codespell ⇒ Object
readonly
Returns the value of attribute codespell.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Codespell
constructor
Initializes a Guard plugin.
-
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
-
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
-
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
-
#start ⇒ Object
Called once when Guard starts.
Constructor Details
#initialize(options = {}) ⇒ Codespell
Initializes a Guard plugin. Don’t do any work here, especially as Guard plugins get initialized even if they are not in an active group!
18 19 20 21 |
# File 'lib/guard/codespell.rb', line 18 def initialize( = {}) super @codespell = codespell_installed? end |
Instance Attribute Details
#codespell ⇒ Object (readonly)
Returns the value of attribute codespell.
9 10 11 |
# File 'lib/guard/codespell.rb', line 9 def codespell @codespell end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/guard/codespell.rb', line 9 def @options end |
Instance Method Details
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
36 37 38 39 40 41 |
# File 'lib/guard/codespell.rb', line 36 def run_all return warn_codespell_missing unless codespell return run_codespell(changed_files) if [:only_git_changes] run_codespell end |
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
48 49 50 51 52 |
# File 'lib/guard/codespell.rb', line 48 def run_on_additions(paths) return warn_codespell_missing unless codespell run_codespell(paths) end |
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
59 60 61 62 63 |
# File 'lib/guard/codespell.rb', line 59 def run_on_modifications(paths) return warn_codespell_missing unless codespell run_codespell(paths) end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
27 28 29 |
# File 'lib/guard/codespell.rb', line 27 def start run_all if [:all_on_start] end |