Esempio n. 1
0
 public function AddFile($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;
     }
     JwtUtil::putContent($path, 'New File...');
     $this->generateConfig();
     return array('isSuccess' => true);
 }
Esempio n. 2
0
 public static function log($str)
 {
     JwtUtil::putContent('log.txt', $str);
 }
Esempio 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());
 }