Class: Guard::Reek
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Reek
- Defined in:
- lib/guard/reek.rb,
lib/guard/reek/runner.rb
Overview
Guard::Reek class, it implements an guard for reek task
Defined Under Namespace
Classes: Runner
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Reek
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 = {}) ⇒ Reek
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!
17 18 19 20 21 22 23 |
# File 'lib/guard/reek.rb', line 17 def initialize( = {}) super = { all_on_start: true, run_all: true }.merge() @runner = [:runner] || Runner.new() @ui = [:ui] || UI end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/guard/reek.rb', line 8 def end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
8 9 10 |
# File 'lib/guard/reek.rb', line 8 def runner @runner end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
8 9 10 |
# File 'lib/guard/reek.rb', line 8 def ui @ui 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/…
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/guard/reek.rb', line 59 def run_all if [:run_all] ui.info('Guard::Reek is running on all files') runner.run else ui.info('Guard::Reek is not allowed to run on all files') end rescue throw :task_has_failed end |
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
76 77 78 79 80 |
# File 'lib/guard/reek.rb', line 76 def run_on_additions(paths) runner.run paths rescue throw :task_has_failed end |
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
88 89 90 91 92 |
# File 'lib/guard/reek.rb', line 88 def run_on_modifications(paths) runner.run paths rescue throw :task_has_failed end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
30 31 32 33 34 |
# File 'lib/guard/reek.rb', line 30 def start runner.run if [:all_on_start] rescue throw :task_has_failed end |