Beispiel #1
0
 private function getMakers()
 {
     $makers_path = "../skt/_makers/";
     $makers = array();
     if (!($makers = scandir($makers_path))) {
         throw new Exception("Nao foi possivel realizar a leitura do diretorio de makers");
     }
     foreach ($makers as $maker) {
         if ($maker != "." && $maker != "..") {
             $_name = null;
             $_description = null;
             $_example = null;
             $_params = null;
             $_position = null;
             $help_file = $makers_path . $maker . "/help.php";
             if (file_exists($help_file)) {
                 include_once $help_file;
                 $mk = new Maker();
                 $mk->setName($_name);
                 $mk->setDescription($_description);
                 $mk->setExample($_example);
                 $mk->setParams($_params);
                 $mk->setPath($maker);
                 $position = Maker::registerId($_position);
                 $mk->setId($position);
                 $this->makers[$position] = $mk;
             }
         }
     }
     ksort($this->makers);
 }
Beispiel #2
0
 public function remake($files = array())
 {
     $files = array_merge($files, $this->files_need_update());
     $files = array_keys(array_flip($files));
     if (!$this->mutex->acquire()) {
         return false;
     }
     $maker = new Maker($this);
     foreach ($this->files as $name => $file) {
         if ($file->type() == CROSSLINK && !in_array($nme, $files)) {
             $files[] = $name;
         }
     }
     if ($files) {
         $files = $maker->update($files);
     }
     $this->errors = $maker->errors();
     // those that have failed to make will be deleted
     foreach ($this->errors as $name => $error) {
         $file = $this->files[$name];
         if ($file) {
             if ($file->is_target()) {
                 $file->delete($this->path());
             }
         } else {
             $path = $this->project_path . $name;
             if (file_exists($path)) {
                 unlink($path);
             }
         }
     }
     foreach ($files as $name) {
         if (!isset($this->errors[$name])) {
             if (!isset($this->files[$name])) {
                 continue;
             }
             $file = $this->files[$name];
             if ($file->is_target()) {
                 $file->set_last_made_time($this->path());
             }
         }
     }
     $this->modified = true;
     // should not remake when saving. otherwise infinite loop
     $this->save_project();
     $this->mutex->release();
     return true;
 }