예제 #1
0
 /**
  * Tests whether getting and setting the template name works.
  *
  * @return void
  */
 public function testTemplate()
 {
     $this->assertSame(array('default'), $this->fixture->getTemplates());
     DocBlox_Core_Abstract::config()->templates->test = new Zend_Config(array());
     DocBlox_Core_Abstract::config()->templates->test2 = new Zend_Config(array());
     $this->fixture->setTemplates('test');
     $this->assertEquals(array('test'), $this->fixture->getTemplates());
     $this->fixture->setTemplates(array('test', 'test2'));
     $this->assertEquals(array('test', 'test2'), $this->fixture->getTemplates());
 }
예제 #2
0
파일: Docblox.php 프로젝트: toxygene/pants
 /**
  * Execute the task
  *
  * @return Docblox
  * @throw BuildException
  */
 public function execute()
 {
     if (!class_exists('Parser')) {
         if (!$this->getLibraryPath()) {
             throw new BuildException('No Docblox library path set');
         }
         $libraryPath = $this->filterProperties($this->getLibraryPath());
         set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
         require_once 'markdown.php';
         $autoloader = new StandardAutoloader();
         $autoloader->registerPrefix('Zend', "{$libraryPath}/Zend")->registerPrefix('DocBlox', "{$libraryPath}/DocBlox")->setFallbackAutoloader(true)->register();
     }
     $parser = new Parser();
     ParserAbstract::$event_dispatcher = new sfEventDispatcher();
     if ($this->getForce()) {
         $parser->setForced($this->getForce());
     }
     if ($this->getMarkers()) {
         $parser->setMarkers($this->getMarkers());
     }
     if ($this->getTitle()) {
         $parser->setTitle($this->filterProperties($this->getTitle()));
     }
     if ($this->getValidate()) {
         $parser->setValidate($this->getValidate());
     }
     $files = new Files();
     foreach ($this->getFiles() as $file) {
         $files->addFile($this->filterProperties($file));
     }
     $xml = $parser->parseFiles($files);
     $transformer = new Transformer();
     $transformer->setSource($xml);
     if ($this->getParsePrivate()) {
         $transformer->setParseprivate($this->getParsePrivate());
     }
     if ($this->getTarget()) {
         $transformer->setTarget($this->filterProperties($this->getTarget()));
     }
     if ($this->getThemesPath()) {
         $transformer->setThemesPath($this->filterProperties($this->getThemesPath()));
     } else {
         $transformer->setThemesPath(CoreAbstract::config()->paths->themes);
     }
     if ($this->getTemplates()) {
         $transformer->setTemplates($this->getTemplates());
     } else {
         $transformer->setTemplates(CoreAbstract::config()->transformations->template->name);
     }
     $transformer->execute();
     return $this;
 }
예제 #3
0
 /**
  * Task entry point
  * @see Task::main()
  */
 public function main()
 {
     if (empty($this->destDir)) {
         throw new BuildException("You must supply the 'destdir' attribute", $this->getLocation());
     }
     if (empty($this->filesets)) {
         throw new BuildException("You have not specified any files to include (<fileset>)", $this->getLocation());
     }
     $this->initializeDocBlox();
     $xml = $this->parseFiles();
     $this->log("Transforming...", Project::MSG_VERBOSE);
     $transformer = new DocBlox_Transformer();
     $transformer->setTemplatesPath(DocBlox_Core_Abstract::config()->paths->templates);
     $transformer->setTemplates(DocBlox_Core_Abstract::config()->transformations->template->name);
     $transformer->setSource($xml);
     $transformer->setTarget($this->destDir->getAbsolutePath());
     $transformer->execute();
 }
예제 #4
0
파일: Transform.php 프로젝트: hjr3/Docblox
 /**
  * Executes the transformation process.
  *
  * @throws Zend_Console_Getopt_Exception
  *
  * @return void
  */
 public function execute()
 {
     // initialize timer
     $timer = microtime(true);
     // initialize transformer
     $transformer = new DocBlox_Transformer();
     $transformer->setTarget($this->getTarget());
     $transformer->setSource($this->getSource());
     $transformer->setTemplates($this->getTemplate());
     // enable verbose mode if the flag was set
     if ($this->getVerbose()) {
         $transformer->setLogLevel(DocBlox_Core_Log::DEBUG);
     }
     if ($this->getQuiet()) {
         $transformer->setLogLevel(DocBlox_Core_Log::QUIET);
     }
     // start the transformation process
     if (!$this->getQuiet()) {
         echo 'Starting transformation of files (this could take a while depending upon the size of your project)' . PHP_EOL;
     }
     $transformer->execute();
     if (!$this->getQuiet()) {
         echo 'Finished transformation in ' . round(microtime(true) - $timer, 2) . ' seconds' . PHP_EOL;
     }
 }
예제 #5
0
 /**
  * Executes the transformation process.
  *
  * @throws Zend_Console_Getopt_Exception
  *
  * @return void
  */
 public function execute()
 {
     // initialize timer
     $timer = microtime(true);
     // initialize transformer
     $transformer = new DocBlox_Transformer();
     $transformer->setThemesPath(DocBlox_Core_Abstract::config()->paths->themes);
     $transformer->setTarget($this->getTarget());
     $transformer->setSource($this->getSource());
     $transformer->setTemplates($this->getTemplate());
     $transformer->setParseprivate($this->getParseprivate());
     // add links to external docs
     $external_class_documentation = DocBlox_Core_Abstract::config()->getArrayFromPath('transformer/external-class-documentation');
     $external_class_documentation = !is_numeric(current(array_keys($external_class_documentation))) ? $external_class_documentation = array($external_class_documentation) : $external_class_documentation;
     /** @var DocBlox_Core_Config $doc */
     foreach ($external_class_documentation as $doc) {
         if (empty($doc)) {
             continue;
         }
         $transformer->setExternalClassDoc((string) $doc['prefix'], (string) $doc['uri']);
     }
     // start the transformation process
     if (!$this->getQuiet()) {
         echo 'Starting transformation of files (this could take a while depending upon the size of your project)' . PHP_EOL;
     }
     $transformer->execute();
     if (!$this->getQuiet()) {
         echo 'Finished transformation in ' . round(microtime(true) - $timer, 2) . ' seconds' . PHP_EOL;
     }
 }