Class: JavascriptLintRunner
- Inherits:
-
Object
- Object
- JavascriptLintRunner
- Defined in:
- lib/tasks/javascript_lint/javascript_lint_runner.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(binary, dir, filter) ⇒ JavascriptLintRunner
constructor
A new instance of JavascriptLintRunner.
- #is_configured?(all_files) ⇒ Boolean
- #name ⇒ Object
- #should_run?(modified_files) ⇒ Boolean
Constructor Details
#initialize(binary, dir, filter) ⇒ JavascriptLintRunner
Returns a new instance of JavascriptLintRunner.
3 4 5 6 7 8 |
# File 'lib/tasks/javascript_lint/javascript_lint_runner.rb', line 3 def initialize(binary, dir, filter) @binary = binary @config = dir + '/jsl.conf' @dir = dir @filter = filter end |
Instance Method Details
#execute ⇒ Object
14 15 16 |
# File 'lib/tasks/javascript_lint/javascript_lint_runner.rb', line 14 def execute return `#{@binary} -conf "#{@config}" -nologo -nofilelisting 2>&1` end |
#is_configured?(all_files) ⇒ Boolean
18 19 20 |
# File 'lib/tasks/javascript_lint/javascript_lint_runner.rb', line 18 def is_configured?(all_files) return all_files.include?(@config) end |
#name ⇒ Object
10 11 12 |
# File 'lib/tasks/javascript_lint/javascript_lint_runner.rb', line 10 def name return 'Javascript Lint' end |
#should_run?(modified_files) ⇒ Boolean
22 23 24 |
# File 'lib/tasks/javascript_lint/javascript_lint_runner.rb', line 22 def should_run?(modified_files) return !(modified_files.detect { |file| @filter.filter(file) }).nil? || modified_files.include?(@config) end |