Class: PreCommit::Checks::Closure
- Inherits:
-
Plugin
- Object
- Plugin
- PreCommit::Checks::Closure
show all
- Defined in:
- lib/plugins/pre_commit/checks/closure.rb
Constant Summary
collapse
- CLOSURE_PATH =
TODO: add pluginator assets support
File.expand_path("../../../../pre-commit/support/closure/compiler.jar", __FILE__)
Instance Attribute Summary
Attributes inherited from Plugin
#config, #pluginator
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Plugin
#initialize, #name
Class Method Details
.aliases ⇒ Object
9
10
11
|
# File 'lib/plugins/pre_commit/checks/closure.rb', line 9
def self.aliases
[:closure_syntax_check]
end
|
.description ⇒ Object
21
22
23
|
# File 'lib/plugins/pre_commit/checks/closure.rb', line 21
def self.description
"Runs closure compiler to detect errors"
end
|
Instance Method Details
#call(staged_files) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/plugins/pre_commit/checks/closure.rb', line 13
def call(staged_files)
return if staged_files.empty?
js_args = staged_files.map {|arg| "--js #{arg}"}.join(' ')
errors = `java -jar #{CLOSURE_PATH} #{js_args} --js_output_file /tmp/jammit.js 2>&1`.strip
return if errors.empty?
errors
end
|