Esempio n. 1
0
 public function validateDirectory($path, $flags = self::MUST_EXIST)
 {
     $errorDetail = NULL;
     if (!empty($path)) {
         $dir = Dir::factoryTS($path);
         // workaround file
         if (self::RESOLVE_RELATIVE && !Dir::isAbsolutePath((string) $dir) && !$dir->isRelative()) {
             $dir = new Dir('.' . DIRECTORY_SEPARATOR . $dir);
         }
         $dir->resolvePath();
         if (!($flags & self::MUST_EXIST) || $dir->exists()) {
             return $dir;
         } else {
             $errorDetail = ' It must exist!';
         }
     }
     throw $this->exitException(sprintf("Directory from path: '%s' cannot be found.%s", $path, $errorDetail));
 }
Esempio n. 2
0
        throw $parsingException;
    }
    $toRun = array();
    foreach ($report as $event) {
        if ($event->event === 'test' && ($event->status === 'fail' || $event->status === 'error')) {
            $testFQN = $event->suite;
            $file = Code::mapClassToFile($testFQN, $root->sub('tests/'));
            $file->getDirectory()->resolvePath();
            $toRun[(string) $file] = (string) $file;
        }
    }
    $toRun = array_filter($toRun);
    $output->writeln(count($toRun) . ' tests have failed');
    $root->getFile('to-run.json')->writeContents($jsonc->stringify($toRun));
});
$createCommand('tests:to-run', array(), function ($input, $output, $command) {
    $jsonc = JSONConverter::create();
    $root = Dir::factoryTS(__DIR__)->sub('../');
    $toRun = (array) $jsonc->parseFile($root->getFile('to-run.json'));
    $leftToRun = array();
    foreach ($toRun as $filename) {
        $leftToRun[] = $filename;
        $output->writeln('phpunit ' . $filename);
    }
    $ret = 200;
    do {
        passthru('phpunit ' . array_pop($leftToRun), $ret);
    } while ($ret === 0 && count($leftToRun) > 0);
    $root->getFile('to-run.json')->writeContents($jsonc->stringify($leftToRun));
    $output->writeln('<comment>reduced to: ' . count($leftToRun) . ' tests.</comment>');
});
Esempio n. 3
0
if (!$conf['downloadDir'] || !$conf['targetDir']) {
    print 'Bitte unbedingt die Variablen downloadDir und targetDir in ' . $configFile . ' anpassen!';
    exit;
}
$reload = isset($_GET['reload']);
$update = isset($_GET['update']);
$scan = isset($_GET['scan']);
$client = new Client($conf['serienLoaderURL']);
$log = NULL;
$episodes = array();
if ($reload) {
    $organizer = new DownloadsOrganizer(new Dir($conf['downloadDir']), new Dir($conf['targetDir']), $client, new JDownloaderRPC($conf['jdownloader']['host'], $conf['jdownloader']['port']), $subtitlesManager = NULL, $log = new BufferLogger());
    $organizer->setHosterPrio($conf['hosterPrio']);
    $episodes = $organizer->organize();
} elseif ($update) {
    $root = Dir::factoryTS(__DIR__)->sub('../../../../')->resolvePath();
    $finder = new \Symfony\Component\Process\ExecutableFinder();
    $process = \Psc\System\Console\Process::build($finder->find('composer'))->addOption('working-dir', mb_substr($root, 0, -1))->addOption('prefer-dist')->addOption('v')->addArgument('update')->end();
    $process->run();
    $log = "Running self-update. \n";
    $log .= "run: " . $process->getCommandline() . "\n";
    $log .= $process->getOutput() . "\n";
    $log .= $process->getErrorOutput() . "\n";
} elseif ($scan) {
    $xbmc = new XBMC($conf['xbmc']['username'], $conf['xbmc']['password'], $conf['xbmc']['port']);
    $log = 'Forcing XBMC to scan. Response: ';
    $log .= $xbmc->scan();
} else {
    $episodes = $client->getEpisodes();
    $log = 'nothing was updated. Hit reload';
}