/**
  * Overrides WordlessPreprocessor::process_file()
  */
 protected function process_file($file_path, $result_path, $temp_path)
 {
     $this->validate_executable_or_die($this->preference("sprockets.ruby_path"));
     // On cache miss, we build the JS file from scratch
     $pb = new ProcessBuilder(array($this->preference("sprockets.ruby_path"), Wordless::join_paths(dirname(__FILE__), "sprockets_preprocessor.rb")));
     // Fix for MAMP environments, see http://goo.gl/S5KFe for details
     $pb->setEnv("DYLD_LIBRARY_PATH", "");
     $pb->add(Wordless::theme_static_javascripts_path());
     $pb->add(Wordless::theme_javascripts_path());
     $pb->add($file_path);
     $proc = $pb->getProcess();
     $code = $proc->run();
     if ($code != 0) {
         $this->die_with_error($proc->getErrorOutput());
     }
     return $proc->getOutput();
 }
Exemplo n.º 2
0
 /**
  * Overrides WordlessPreprocessor::process_file()
  */
 protected function process_file($file_path, $temp_path)
 {
     $this->validate_executable_or_throw($this->preference("js.ruby_path"));
     // On cache miss, we build the JS file from scratch
     $pb = new ProcessBuilder(array($this->preference("js.ruby_path"), Wordless::join_paths(dirname(__FILE__), "sprockets_preprocessor.rb"), "compile"));
     // Fix for MAMP environments, see http://goo.gl/S5KFe for details
     $pb->setEnv("DYLD_LIBRARY_PATH", "");
     $pb->add($file_path);
     $pb->add("--paths");
     $pb->add(Wordless::theme_static_javascripts_path());
     $pb->add(Wordless::theme_javascripts_path());
     if ($this->preference("js.yui_compress")) {
         $pb->add("--compress");
     }
     if ($this->preference("js.yui_munge")) {
         $pb->add("--munge");
     }
     $proc = $pb->getProcess();
     $code = $proc->run();
     if ($code != 0) {
         throw new WordlessCompileException("Failed to run the following command: " . $proc->getCommandLine(), $proc->getErrorOutput());
     }
     return $proc->getOutput();
 }