Exemplo n.º 1
0
 public function IsFileExist($mode, $directoryName, $fileName, $ext)
 {
     if (!JwtUtil::endsWith($fileName, $ext)) {
         $fileName .= $ext;
     }
     $path = $this->rootPath;
     switch ($mode) {
         case "Base":
             $path .= "Scripts/Base/" . $fileName;
             break;
         case "Layouts":
             $path .= "Scripts/Layouts/{$directoryName}/{$fileName}";
             break;
         case "Components":
             $path .= "Scripts/Directives/{$directoryName}/{$fileName}";
             break;
         case "Widgets":
             $path .= "Scripts/Components/{$directoryName}/{$fileName}";
             break;
         case "Modules":
             $path .= "Scripts/Modules/{$directoryName}/{$fileName}";
             break;
     }
     return array('exist' => JwtUtil::fileExists($path));
 }
Exemplo n.º 2
0
 public static function rename($pathx, $newName, $oldName)
 {
     $path = $pathx . $oldName;
     if (!JwtUtil::folderExists($path)) {
         return;
     }
     if (JwtUtil::fileExists($path . "/" . $oldName . ".html")) {
         rename($path . "/" . $oldName . ".html", $path . "/" . $newName . ".html");
         //unlink($path ."/". $oldName . ".html");
     }
     if (JwtUtil::fileExists($path . "/" . $oldName . "Ctrl.js")) {
         rename($path . "/" . $oldName . "Ctrl.js", $path . "/" . $newName . "Ctrl.js");
         //unlink($path ."/". $oldName . "Ctrl.js");
     }
     if (JwtUtil::fileExists($path . "/" . $oldName . "Svc.js")) {
         rename($path . "/" . $oldName . "Svc.js", $path . "/" . $newName . "Svc.js");
         //unlink($path ."/". $oldName . "Svc.js");
     }
     if (JwtUtil::fileExists($path . "/" . $oldName . ".css")) {
         rename($path . "/" . $oldName . ".css", $path . "/" . $newName . ".css");
         //unlink($path ."/". $oldName . ".css");
     }
     rename($path, $pathx . $newName);
 }
Exemplo n.º 3
0
 private function genAppDirectives()
 {
     $dir = JwtUtil::getSubDirectories($this->root . "Scripts/Directives");
     $import1 = new StringBuilder();
     $builder = new StringBuilder();
     foreach ($dir as $item) {
         $import1->appendFormat("import %s from 'Scripts/Directives/%s/%s.js';", $item, $item, $item);
         $import1->appendLine();
         $builder->appendFormat(".directive('%s', %s.builder)", $item, $item);
         $builder->appendLine();
         if (JwtUtil::fileExists(sprintf($this->root . "Scripts/Directives/%s/%s.css", $item, $item))) {
             $this->componentsCSS->appendFormat("@import '../Scripts/Directives/%s/%s.css';", $item, $item);
             $this->componentsCSS->appendLine();
         }
     }
     $res = new StringBuilder();
     $res->append($import1->toString());
     $res->appendLine();
     $res->appendLine();
     $res->appendFormat("var moduleName='%s.Directives';", $this->app->Name);
     $res->appendLine();
     $res->appendLine();
     $res->append("angular.module(moduleName, [])");
     $res->appendLine();
     $res->append($builder->toString());
     $res->append(";");
     $res->appendLine();
     $res->appendLine();
     $res->append("export default moduleName;");
     JwtUtil::putContent($this->root . "Scripts/app.directives.js", $res->toString());
 }