ClearIce::addCommands(array('command' => 'rollback', 'long' => 'default-schema', 'has_value' => true, 'help' => 'reverse only migrations in this default-schema')); ClearIce::addOptions(array('short' => 'y', 'long' => 'home', 'help' => 'specifies where the yentu configurations are found', 'has_value' => true), array('short' => 'v', 'long' => 'verbose', 'help' => 'set level of verbosity. high, mid, low and none', 'has_value' => true)); ClearIce::addOptions(array('long' => 'details', 'help' => 'show details of all migrations.', 'command' => 'status')); ClearIce::setDescription("Yentu Database Migrations\nVersion " . Yentu::getVersion()); ClearIce::setFootnote("Report bugs to jainooson@gmail.com"); ClearIce::setUsage("[command] [options]"); ClearIce::addHelp(); ClearIce::setStrict(true); $options = ClearIce::parse(); if (isset($options['verbose'])) { ClearIce::setOutputLevel($options['verbose']); } try { if (isset($options['__command__'])) { if (isset($options['home'])) { Yentu::setDefaultHome($options['home']); } $class = "\\yentu\\commands\\" . ucfirst($options['__command__']); unset($options['__command__']); Config::readPath(Yentu::getPath('config'), 'yentu'); $command = new $class(); $command->run($options); } else { ClearIce::output(ClearIce::getHelpMessage()); } } catch (\yentu\exceptions\CommandException $e) { ClearIce::resetOutputLevel(); ClearIce::error("Error! " . $e->getMessage() . "\n"); } catch (\ntentan\atiaa\exceptions\DatabaseDriverException $e) { ClearIce::resetOutputLevel(); ClearIce::error("Database driver failed: " . $e->getMessage() . "\n");
protected function setupStreams() { vfsStream::setup('home'); \yentu\Yentu::setDefaultHome(vfsStream::url('home/yentu')); \clearice\ClearIce::setStreamUrl('output', vfsStream::url('home/output.txt')); }
/** * @expectedException \yentu\exceptions\CommandException */ public function testExistingDb() { $this->pdo->query('CREATE TABLE yentu_history(dummy INTEGER)'); $initCommand = new \yentu\commands\Init(); \yentu\Yentu::setDefaultHome(vfsStream::url("home/yentu")); $initCommand->run(array('driver' => $GLOBALS['DRIVER'], 'host' => $GLOBALS['DB_HOST'], 'dbname' => $GLOBALS['DB_NAME'], 'user' => $GLOBALS['DB_USER'], 'password' => $GLOBALS['DB_PASSWORD'], 'file' => $GLOBALS['DB_FILE'])); }