Class: Jscompiler::Commands::Closure

Inherits:
Base
  • Object
show all
Defined in:
lib/jscompiler/commands/closure.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#comments_regexp, compile_group, #debug_file_path, #execute, #generate_temp_file, #group, #initialize, #output_file_path, #prepare_arguments, #prepare_command, #sanitize, #save_or_delete_temp_file, #temp_file_path

Constructor Details

This class inherits a constructor from Jscompiler::Commands::Base

Instance Method Details

#argsObject



33
34
35
36
37
38
39
# File 'lib/jscompiler/commands/closure.rb', line 33

def args 
  [
    ["--js", temp_file_path],
    ["--js_output_file", output_file_path],
    ["--warning_level", Jscompiler::Config.compiler["warning_level"] || "DEFAULT"] 
  ]
end

#compiler_pathObject



29
30
31
# File 'lib/jscompiler/commands/closure.rb', line 29

def compiler_path
  File.expand_path(File.join(File.dirname(__FILE__), "../../../vendor/closure/compiler.jar"))
end

#runObject



41
42
43
44
45
# File 'lib/jscompiler/commands/closure.rb', line 41

def run
  generate_temp_file
  execute(prepare_command("java -jar #{compiler_path}", args))
  save_or_delete_temp_file
end