public function install($version = 'stable', array $options = array()) { $this->logger->quiet(); $this->disable(); $this->logger->setLevel(4); $installer = new ExtensionInstaller($this->logger); $path = $this->meta->getPath(); $name = $this->meta->getName(); // Install local extension if (file_exists($path)) { $this->logger->info("===> Installing {$name} extension..."); $this->logger->debug("Extension path {$path}"); $xml = $installer->runInstall($name, $path, $options); } else { chdir(dirname($path)); $xml = $installer->installFromPecl($name, $version, $options); } // try to rebuild meta from xml, which is more accurate right now if (file_exists($xml)) { $this->logger->warning("===> Switching to xml extension meta"); $this->meta = new ExtensionMetaXml($xml); } $ini = $this->meta->getIniFile() . '.disabled'; $this->logger->info("===> Creating config file {$ini}"); // create extension config file if (file_exists($ini)) { $lines = file($ini); foreach ($lines as &$line) { if (preg_match('#^;\\s*((?:zend_)?extension\\s*=.*)#', $line, $regs)) { $line = $regs[1]; } } file_put_contents($ini, join('', $lines)); } else { if ($this->meta->isZend()) { $makefile = file_get_contents("{$path}/Makefile"); preg_match('/EXTENSION\\_DIR\\s=\\s(.*)/', $makefile, $regs); $content = "zend_extension={$regs[1]}/"; } else { $content = "extension="; } file_put_contents($ini, $content . $this->meta->getSourceFile()); $this->logger->debug("{$ini} is created."); } $this->logger->info("===> Enabling extension..."); $this->enable(); $this->logger->info("Done."); return $path; }
<?php $loader = (require "vendor/autoload.php"); require "tests/model_helpers.php"; mb_internal_encoding('UTF-8'); error_reporting(E_ALL); $loader->add(null, 'tests'); $loader->add(null, 'tests/src'); use LazyRecord\Schema\SchemaGenerator; use LazyRecord\ConfigLoader; use CLIFramework\Logger; $config = ConfigLoader::getInstance(); $config->loadFromSymbol(true); $config->initForBuild(); $logger = new Logger(); $logger->quiet(); $logger->info("Building schema class files..."); // build schema class files $schemas = array(new \AuthorBooks\Model\AddressSchema(), new \AuthorBooks\Model\AuthorBookSchema(), new \AuthorBooks\Model\AuthorSchema(), new \AuthorBooks\Model\BookSchema(), new \AuthorBooks\Model\PublisherSchema(), new \AuthorBooks\Model\TagSchema(), new \MetricApp\Model\MetricValueSchema(), new \PageApp\Model\PageSchema(), new \StoreApp\Model\StoreSchema(), new \TestApp\Model\EdmSchema(), new \TestApp\Model\IDNumberSchema(), new \TestApp\Model\NameSchema(), new \TestApp\Model\PostSchema(), new \TestApp\Model\TableSchema(), new \TestApp\Model\UserSchema(), new \TestApp\Model\WineCategorySchema(), new \TestApp\Model\WineSchema()); $g = new \LazyRecord\Schema\SchemaGenerator($config, $logger); $g->setForceUpdate(true); $g->generate($schemas, true); // $logger->info("Starting tests...");