Class: Guard::Foodcritic
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Foodcritic
- Defined in:
- lib/guard/foodcritic.rb,
lib/guard/foodcritic/runner.rb
Defined Under Namespace
Classes: Runner
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Foodcritic
constructor
A new instance of Foodcritic.
- #respond_to?(method_name, include_private = false) ⇒ Boolean
- #run_all ⇒ Object
- #run_on_additions(paths) ⇒ Object
- #run_on_change(paths) ⇒ Object
- #run_on_modifications(paths) ⇒ Object
- #runner ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Foodcritic
Returns a new instance of Foodcritic.
7 8 9 10 11 12 13 14 15 |
# File 'lib/guard/foodcritic.rb', line 7 def initialize( = {}) super @options = { all_on_start: true, cookbook_paths: ['cookbooks'], notification: true }.merge(@options) end |
Instance Method Details
#respond_to?(method_name, include_private = false) ⇒ Boolean
42 43 44 45 46 47 48 |
# File 'lib/guard/foodcritic.rb', line 42 def respond_to?(method_name, include_private = false) if %w(run_on_deletion run_on_change).include? method_name.to_s false else super end end |
#run_all ⇒ Object
25 26 27 28 |
# File 'lib/guard/foodcritic.rb', line 25 def run_all Guard::Compat::UI.info 'Linting all cookbooks' run! @options[:cookbook_paths] end |
#run_on_additions(paths) ⇒ Object
30 31 32 |
# File 'lib/guard/foodcritic.rb', line 30 def run_on_additions(paths) run_paths paths end |
#run_on_change(paths) ⇒ Object
34 35 36 |
# File 'lib/guard/foodcritic.rb', line 34 def run_on_change(paths) run_paths paths end |
#run_on_modifications(paths) ⇒ Object
38 39 40 |
# File 'lib/guard/foodcritic.rb', line 38 def run_on_modifications(paths) run_paths paths end |
#runner ⇒ Object
17 18 19 |
# File 'lib/guard/foodcritic.rb', line 17 def runner @runner ||= Runner.new(@options) end |
#start ⇒ Object
21 22 23 |
# File 'lib/guard/foodcritic.rb', line 21 def start run_all if @options[:all_on_start] end |