Class: SCSSLint::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- SCSSLint::RakeTask
- Defined in:
- lib/scss_lint/rake_task.rb
Overview
Provide task for invoking scss-lint via Rake.
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the task (default ‘scss-lint’).
Instance Method Summary collapse
-
#initialize(*args, &task_block) ⇒ RakeTask
constructor
A new instance of RakeTask.
- #run_task ⇒ Object
Constructor Details
#initialize(*args, &task_block) ⇒ RakeTask
Returns a new instance of RakeTask.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/scss_lint/rake_task.rb', line 14 def initialize(*args, &task_block) @name = args.shift || :scss_lint desc 'Run scss-lint' unless ::Rake.application.last_comment task(name, *args) do |_, task_args| if task_block task_block.call(*[self, task_args].slice(0, task_block.arity)) end run_task end end |
Instance Attribute Details
#name ⇒ Object
The name of the task (default ‘scss-lint’)
12 13 14 |
# File 'lib/scss_lint/rake_task.rb', line 12 def name @name end |
Instance Method Details
#run_task ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/scss_lint/rake_task.rb', line 27 def run_task # Lazy load so task doesn't impact load time of Rakefile require 'scss_lint' require 'scss_lint/cli' CLI.new.run([]) rescue SystemExit => ex if ex.status == CLI::EXIT_CODES[:data] abort('scss-lint found lints') elsif ex.status != 0 abort('scss-lint failed with an error') end end |