.

JCSSManagerCompressJSClosureCommand Class Reference

Inheritance diagram for JCSSManagerCompressJSClosureCommand:
JCSSManagerCompressBaseCommand CommandDelegate ICommand IAction ISerializable

List of all members.

Protected Member Functions

  compress ($in_files, $out_file, &$files_to_unlink)
  COmpress given files.
  get_db_type ()
  Returns type of compressed file.
  run_closure ($in_files, $out_file)
  Invoke Closure Compiler.

Detailed Description

Definition at line 4 of file compress.js.cmd.php.


Member Function Documentation

JCSSManagerCompressJSClosureCommand::compress ( in_files,
out_file,
&$  files_to_unlink  
) [protected]

COmpress given files.

Returns:
Status

Reimplemented from JCSSManagerCompressBaseCommand.

Definition at line 10 of file compress.js.cmd.php.

00010                                                                              {
00011                 $ret = new Status();
00012                 if (count($in_files) > 0) {
00013                         $ret->merge($this->run_closure($in_files, $out_file));
00014                 }
00015                 
00016                 return $ret;
00017         }
JCSSManagerCompressJSClosureCommand::get_db_type (  )  [protected]

Returns type of compressed file.

Returns:
string One of TYPE_X constants

Reimplemented from JCSSManagerCompressBaseCommand.

Definition at line 24 of file compress.js.cmd.php.

00024                                          {
00025                 return JCSSManager::TYPE_JS;
00026         }
JCSSManagerCompressJSClosureCommand::run_closure ( in_files,
out_file  
) [protected]

Invoke Closure Compiler.

Parameters:
array  $in_files
string  $out_file
Returns:
Status

Definition at line 35 of file compress.js.cmd.php.

00035                                                              {
00036                 $ret = new Status();
00037                 
00038                 $module_dir = Load::get_module_dir('jcssmanager');
00039                 $options = '';
00040                 $options .= ' --charset=' . GyroLocale::get_charset();
00041                 $options .= ' --compilation_level=SIMPLE_OPTIMIZATIONS'; // WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS
00042                 $options .= ' --third_party=1';
00043                 $options .= ' --warning_level=QUIET'; //  QUIET, DEFAULT, VERBOSE 
00044                 foreach($in_files as $file) {
00045                         if (substr($file, 0, 1) !== '/') {
00046                                 $file = Config::get_value(Config::URL_ABSPATH) . $file;
00047                         }                       
00048                         $options .= ' --js=' . $file;
00049                 }
00050                 $options .= ' --js_output_file=' . $out_file;
00051                 $cmd = 'java -jar ' . $module_dir . '3rdparty/closure/compiler.jar' . $options;
00052                 
00053                 Load::commands('generics/execute.shell');
00054                 $shell = new ExecuteShellCommand($cmd);
00055                 $ret->merge($shell->execute());
00056                 
00057                 return $ret;            
00058         } 

The documentation for this class was generated from the following file: