Exemple #1
0
 /**
  * Create the initial configuration for our project
  *
  * @param Event $event
  */
 public static function createInitialConfig(Event $event)
 {
     $installer = new Installer();
     $io = $event->getIO();
     // check if parameters.yml exists
     $rootDir = realpath(__DIR__ . '/../../../../');
     if (file_exists($rootDir . '/app/config/parameters.yml')) {
         $io->write($installer->getDecoratedMessage('Skipping creating the initial config as parameters.yml already exists', 'info', $io->isDecorated()));
     } else {
         $information = $installer->extractInformationFromPath($rootDir);
         // ask all the information we need
         $config = array();
         $config['client'] = $installer->ask($io, 'client name', $information['client']);
         $config['project'] = $installer->ask($io, 'project name', $information['project']);
         $config['database_name'] = substr($config['client'], 0, 8) . '_' . substr($config['project'], 0, 7);
         $config['database_user'] = $config['database_name'];
         if ($information['is_local']) {
             // this is the ip-address of our Vagrantbox
             $config['database_host'] = '10.11.12.13';
             $config['database_user'] = '******';
             $config['database_password'] = '******';
         }
         $config['secret'] = md5(uniqid());
         // create the database if requested
         if ($installer->askConfirmation($io, 'Should I create the database?')) {
             passthru('mysqladmin create ' . $config['database_name']);
         }
         // alter the Capfile if requested
         $capfilePath = $rootDir . '/Capfile';
         if (file_exists($capfilePath)) {
             if ($installer->askConfirmation($io, 'Should I alter the Capfile?')) {
                 $installer->updateCapfile($capfilePath, $config);
             }
         }
         // alter the dist file if requested
         $parameterYmlDistPath = $rootDir . '/app/config/parameters.yml.dist';
         if (file_exists($parameterYmlDistPath)) {
             if ($installer->askConfirmation($io, 'Should I alter parameters.yml.dist?')) {
                 $installer->updateYmlFile($parameterYmlDistPath, $config);
             }
         }
     }
 }
Exemple #2
0
 public function testNotDecoratedMessage()
 {
     $this->assertEquals('I wont be wrapped in an errortag.', $this->installer->getDecoratedMessage('I wont be wrapped in an errortag.', 'error', false));
 }