示例#1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $scanner = new \GitScan\GitRepoScanner();
     $paths = $input->getArgument('path');
     if (count($paths) != 1) {
         $output->writeln('<error>Expected only one root path</error>');
         return;
     }
     $gitRepos = $scanner->scan($paths);
     $output->writeln(\GitScan\CheckoutDocument::create($paths[0])->importRepos($gitRepos)->toJson());
 }
示例#2
0
 /**
  * @param string $path path to a directory or JSON file
  * @return CheckoutDocument
  */
 protected function getCheckoutDocument($path)
 {
     if (is_dir($path)) {
         $scanner = new \GitScan\GitRepoScanner();
         $gitRepos = $scanner->scan($path);
         return CheckoutDocument::create($path)->importRepos($gitRepos);
     } else {
         $json = file_get_contents($path);
         return CheckoutDocument::create(NULL)->importJson($json);
     }
 }