/** * * Main action: parse the classes and write documentation. * * @param string $class Start parsing with this class and recursively * descend. * * @return void * */ protected function _exec($class = null) { $begin = time(); if (!$class) { $class = 'Solar'; } // get the source dir $this->_source = $this->_options['source']; if (!$this->_source) { // get the directory where this class is stored $this->_source = Solar_Dir::name(__FILE__, 2); } // start parsing $this->_outln("Parsing source files from '{$this->_source}' ... "); $ref = Solar::factory('Solar_Docs_Apiref'); $ref->addFiles($this->_source, $class); // are we only linting the sources? if ($this->_options['lint']) { $this->_outln('Done.'); return; } // get the target API dir $class_dir = $this->_options['class_dir']; if ($class_dir) { $this->_class_dir = Solar_Dir::fix($class_dir); } // do we have a class dir? if (!$this->_class_dir) { throw $this->_exception('ERR_NO_CLASS_DIR'); } // get the target package dir (if any) $package_dir = $this->_options['package_dir']; if ($package_dir) { $this->_package_dir = Solar_Dir::fix($package_dir); } // do we have a package dir? if (!$this->_package_dir) { throw $this->_exception('ERR_NO_PACKAGE_DIR'); } // get the docbook dir $docbook_dir = $this->_options['docbook_dir']; if ($docbook_dir) { $this->_docbook_dir = Solar_Dir::fix($docbook_dir); } // import the class data $this->api = $ref->api; ksort($this->api); // import the package data $this->packages = $ref->packages; ksort($this->packages); // write out the package pages $this->_outln(); $this->writePackages(); // write out the class pages $this->_outln(); $this->writeClasses(); // time note $time = time() - $begin; $this->_outln("Wiki docs written in {$time} seconds."); // convert to docbook? if ($this->_docbook_dir) { $this->_outln(); $cli = Solar::factory('Solar_Cli_MakeDocbook'); $argv = array("--class-dir={$this->_class_dir}", "--package-dir={$this->_package_dir}", "--docbook-dir={$this->_docbook_dir}", $class); $cli->exec($argv); $this->_outln(); $time = time() - $begin; $this->_outln("All docs written and converted in {$time} seconds."); } }
/** * * Main action: parse the classes and write documentation. * * @param string $class Start parsing with this class and recursively * descend. * * @return void * */ protected function _exec($class = null) { $begin = time(); if (!$class) { $class = 'Solar'; } // get the source dir $this->_source = $this->_options['source']; if (!$this->_source) { // get the directory where this class is stored $this->_source = Solar_Dir::name(__FILE__, 2); } // start parsing $this->_outln("Parsing source files from '{$this->_source}' ... "); $ref = Solar::factory('Solar_Docs_Apiref'); $ref->addFiles($this->_source, $class); // are we only linting the sources? if ($this->_options['lint']) { $this->_outln('Done.'); return; } // get the target API dir $class_dir = $this->_options['class_dir']; if ($class_dir) { $this->_class_dir = Solar_Dir::fix($class_dir); } // do we have a class dir? if (!$this->_class_dir) { throw $this->_exception('ERR_NO_CLASS_DIR'); } // get the target package dir (if any) $package_dir = $this->_options['package_dir']; if ($package_dir) { $this->_package_dir = Solar_Dir::fix($package_dir); } // do we have a package dir? if (!$this->_package_dir) { throw $this->_exception('ERR_NO_PACKAGE_DIR'); } // import the class data $this->api = $ref->api; ksort($this->api); // import the package data $this->packages = $ref->packages; ksort($this->packages); // write out the package pages $this->_outln(); $this->writePackages(); // write out the class pages $this->_outln(); $this->writeClasses(); // done! $this->_outln(); $time = time() - $begin; $this->_outln("Docs completed in {$time} seconds."); }