示例#1
0
 /**
  * Build generators
  *
  * @param State|State $state
  */
 public function build(State $state)
 {
     $model = $state->getModel('module');
     if ($this->config->getBare()) {
         $data = file_get_contents(SCAFFOLD_ROOT . "/data/template/src/Module.bare.php");
     } else {
         $data = file_get_contents(SCAFFOLD_ROOT . "/data/template/src/Module.php");
     }
     $data = str_replace('__NAMESPACE_PLACEHOLDER__', ucfirst($this->config->getModule()), $data);
     $data = substr($data, 7);
     $model->setGenerator(new RawGenerator($data));
 }
 /**
  * @param Config $config
  */
 public function __construct(Config $config)
 {
     $this->addBuilder(new Module\ModuleBuilder($config));
     $this->addBuilder(new Module\ConfigBuilder($config, 'config/module.config.php'));
     $this->addBuilder(new Module\ConfigBuilder($config, 'config/service.config.php'));
     $this->addBuilder(new Module\ConfigBuilder($config, 'config/router.config.php'));
     $this->addBuilder(new Module\ConfigBuilder($config, 'config/navigation.config.php'));
     $this->addBuilder(new Module\ConfigBuilder($config, 'config/auth.config.php'));
     $this->addBuilder(new Module\ConfigBuilder($config, 'config/assetic.config.php'));
     $this->addBuilder(new Module\TestBuilder($config, 'test/bootstrap.php'));
     $this->addBuilder(new Module\TestBuilder($config, 'test/TestConfig.php.dist'));
     if ($config->getBare()) {
         $this->addBuilder(new Module\RootBuilder($config, 'Module.php'));
         $this->addBuilder(new Module\RootBuilder($config, 'phpunit.xml'));
         $this->addBuilder(new Module\RootBuilder($config, 'composer.json'));
         $this->addBuilder(new Module\RootBuilder($config, '.gitignore'));
     } else {
         $this->addBuilder(new Module\TestBuilder($config, 'test/phpunit.xml'));
     }
 }