Exemple #1
0
 /**
  * Job constructor.
  *
  * @param Console $console Console
  */
 public function __construct(Console $console)
 {
     static $kite, $composer;
     $this->console = $console;
     $this->offsetSet('job', $this);
     $this->offsetSet('config', $console->getConfig());
     if (!$kite) {
         $kite = array('path' => $path = dirname(__DIR__), 'dir' => $console->getFilesystem()->findShortestPath(getcwd(), $path));
     }
     $this->offsetSet('kite', $kite);
     parent::__construct($this);
     if (!$composer) {
         $composer = $this->factory->createTask('Netresearch\\Kite\\Service\\Composer', $this);
     }
     $this->offsetSet('composer', $composer);
 }
Exemple #2
0
 /**
  * Initialize the environment
  *
  * @param InputInterface  $input  Input
  * @param OutputInterface $output Output
  *
  * @return void
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->console->setApplication($this->getApplication())->setInput($input)->setOutput($output);
     if (!$input->getOption('no-debug-file') && ($debugDir = $input->getOption('debug-dir'))) {
         $this->console->getFilesystem()->ensureDirectoryExists($debugDir);
         // keep max 20 logs
         $files = glob($debugDir . '/*');
         while (count($files) > 19) {
             $this->console->getFilesystem()->remove(array_shift($files));
         }
         $logFile = date('YmdHis');
         $debugOutput = new Output(fopen(rtrim($debugDir, '\\/') . '/' . $logFile, 'w'), Output::VERBOSITY_VERY_VERBOSE, true);
         $this->console->setDebugOutput($debugOutput);
         $debugOutput->setTerminalDimensions($this->getApplication()->getTerminalDimensions());
         $debugOutput->writeln($this->getHelper('formatter')->formatBlock(implode(' ', $_SERVER['argv']), 'fg=black;bg=white', true) . "\n");
     }
 }