コード例 #1
0
ファイル: Migration.php プロジェクト: natedrake/fast-forward
 /**
  * Prepares the database when it is still unversioned.
  *
  * @return bool True when a migration happened
  */
 private function fromUnversioned()
 {
     $this->out->writeln('Updating database from unknown version');
     // There's already a bookmark table, but no settings yet.
     // Basically the state of the project as this was written.
     $sql = '
             CREATE TABLE IF NOT EXISTS "setting" (
               "key" text NOT NULL,
               "value" text NOT NULL
             )';
     DBA::execute($sql);
     return true;
 }
コード例 #2
0
ファイル: SymfonyStyle.php プロジェクト: a53ali/CakePhP
 /**
  * {@inheritdoc}
  */
 public function writeln($messages, $type = self::OUTPUT_NORMAL)
 {
     parent::writeln($messages, $type);
     $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
 }
コード例 #3
0
 /**
  * Interacts with the user to retrieve task configurations.
  *
  * @param OutputStyle $io
  */
 private function interactForTaskConfigurations(OutputStyle $io)
 {
     $io->writeln(' Add tasks:');
     $addTask = true;
     while ($addTask) {
         $taskQuestion = new Question('Search for a task');
         $taskQuestion->setAutocompleterValues($this->getAvailableTasks());
         $taskQuestion->setValidator(function ($answer) {
             if (class_exists($answer) === false && class_exists('Accompli\\Task\\' . $answer) === true) {
                 $answer = 'Accompli\\Task\\' . $answer;
             }
             if (class_exists($answer) === false || in_array(TaskInterface::class, class_implements($answer)) === false) {
                 throw new InvalidArgumentException(sprintf('The task "%s" does not exist.', $answer));
             }
             return $answer;
         });
         $task = $io->askQuestion($taskQuestion);
         $taskConfiguration = array_merge(array('class' => $task), $this->getTaskConfigurationParameters($task));
         $this->configuration['events']['subscribers'][] = $taskConfiguration;
         $addTask = $io->confirm('Add another task?');
     }
 }
コード例 #4
0
 /**
  * Display repository.
  *
  * @param OutputStyle $outputStyle Console output style.
  * @return ConfigurationDebugCommand $this
  */
 protected function displayRepository(OutputStyle $outputStyle)
 {
     $outputStyle->section('Repository:');
     $outputStyle->writeln(' -> ' . sprintf('%s with %s record(s).', get_class($this->repository), $this->repository->count()));
     return $this;
 }
コード例 #5
0
ファイル: Bookmark.php プロジェクト: natedrake/fast-forward
 /**
  * @param Client      $client
  * @param OutputStyle $output
  *
  * @throws \Exception
  */
 public function run($client, OutputStyle $output)
 {
     $this->hit_count++;
     $output->success("Running '" . $this->shortcut . "' for the " . $client->ordinal($this->hit_count) . ' time.');
     $command = $client->getSettings()->parseIdentifiers($this->command);
     switch (OS::getType()) {
         case OS::LINUX:
             $output->writeln('cmd:' . $command);
             break;
         case OS::WINDOWS:
             file_put_contents($client->getBatchPath(), $command);
             break;
     }
     $this->save();
 }