Class: JavascriptLintRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/javascript_lint/javascript_lint_runner.rb

Instance Method Summary collapse

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

#executeObject



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

Returns:

  • (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

#nameObject



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

Returns:

  • (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