Class: Guard::ErbLint
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::ErbLint
- Defined in:
- lib/guard/erb_lint.rb,
lib/guard/erb_lint/options.rb
Defined Under Namespace
Modules: Options
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ErbLint
constructor
Initializes a Guard plugin.
- #run(*args) ⇒ Object
-
#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 = {}) ⇒ ErbLint
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!
19 20 21 22 |
# File 'lib/guard/erb_lint.rb', line 19 def initialize( = {}) @options = Guard::ErbLint::Options.with_defaults().with_indifferent_access super end |
Instance Method Details
#run(*args) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/guard/erb_lint.rb', line 68 def run(*args) cli = ERBLint::CLI.new Compat::UI.info("Running ERBLint with args #{args.join(", ")}") cli.run(args) end |
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
42 43 44 45 46 |
# File 'lib/guard/erb_lint.rb', line 42 def run_all run("--lint-all") rescue StandardError throw(:task_has_failed) end |
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
54 55 56 |
# File 'lib/guard/erb_lint.rb', line 54 def run_on_additions(paths) run_all_or_block { run(*paths) } end |
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
64 65 66 |
# File 'lib/guard/erb_lint.rb', line 64 def run_on_modifications(paths) run_all_or_block { run(*paths) } end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
29 30 31 32 33 34 |
# File 'lib/guard/erb_lint.rb', line 29 def start Compat::UI.info("Guard::ERBLint initialized") run_all if @options[:all_on_start] rescue StandardError throw(:task_has_failed) end |