Example #1
0
 public function getOutput()
 {
     return $this->output ?: File::generateFilepath('dispatcher', getcwd());
 }
Example #2
0
 public function writeTo($file)
 {
     return File::write($file, $this->GetCode());
 }
Example #3
0
 public function __construct(Configuration $config, Watch $watcher)
 {
     $this->config = $config;
     $collections = new Generate\Collections((array) $config->getModelPath(), $this);
     $this->fixPath($collections);
     $target = $config->getLoader();
     $namespace = "ActiveMongo2\\Namspace" . uniqid(true);
     $rnd = uniqid();
     $valns = $collections->getValidatorNS();
     $validator = $collections->getValidator();
     class_exists("agpmedia\\FileUtil\\File");
     // preload class
     $args = compact('docs', 'namespace', 'mapper', 'indexes', 'self', 'collections', 'valns', 'rnd', 'validator');
     $code = Template\Templates::get('documents')->render($args, true);
     if (strlen($code) >= 1024 * 1024) {
         File::write($target, $code);
     } else {
         File::write($target, FixCode::fix($code));
     }
     $this->writeFileWatch($watcher, $collections);
 }
Example #4
0
 public static function Save()
 {
     $i = 0;
     foreach (self::$path as $ns => $file) {
         if (!self::$isDirty[$ns]) {
             continue;
         }
         self::$isDirty[$ns] = false;
         zFile::dumpArray($file, array("version" => self::CACHE_VERSION, "data" => self::$data[$ns]));
         $i++;
     }
     return $i;
 }
Example #5
0
 public function __construct($loader = '')
 {
     $this->loader = $loader ?: File::generateFilepath('activemongo2', getcwd());
     $this->cache = new Cache\Cache();
 }