Beispiel #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $id = $this->argument('id');
     /** @var Commit $commit */
     $commit = Commit::query()->where('id', '=', $id)->get()->first();
     if (empty($commit)) {
         $this->getOutput()->writeln('<error>Cant find commit with id:' . $id . '</error>');
         return;
     }
     $commit->delete();
 }
Beispiel #2
0
 /**
  * @param int $id
  * @return \Illuminate\Contracts\Routing\ResponseFactory
  * @throws \Exception
  */
 public function viewLog($id)
 {
     $commit = Commit::query()->where('id', '=', $id)->get()->first();
     if (empty($commit)) {
         throw new \Exception('Invalid commit id: ' . $id);
     }
     /** @var Commit $commit */
     $lines = [];
     $lines = $this->getLogLines($commit, $lines);
     return view('log', ['commit' => $commit, 'lines' => $lines]);
 }
Beispiel #3
0
 /**
  * Execute the console command.
  * @throws \Exception
  */
 public function handle()
 {
     $id = $this->option('id');
     /** @var Commit $commit */
     $query = Commit::query();
     $query = $query->where('id', '=', $id);
     $commit = $query->get()->first();
     if (empty($commit)) {
         $this->getOutput()->writeln('<error>Cant find commit:' . $id . '</error>');
         return;
     }
     $checker = new \App\Ci\Checker\ScheduledChecker();
     /** @var OutputStyle $output */
     $output = $this->getOutput();
     $checker->check($commit, new PsrHandler(new ConsoleLogger($output)));
 }
Beispiel #4
0
 /**
  * @inheritdoc
  */
 public function handle()
 {
     // older than 10 days
     $builder = Commit::query();
     $builder->where('end_time', '<', time() - self::DAYS * 24 * 3600);
     $builder->where('end_time', '!=', '0');
     $commits = $builder->get();
     /** @var Commit $commit */
     foreach ($commits as $commit) {
         if ($this->option('dry-run')) {
             $this->comment('Remove:' . $commit->id);
             continue;
         }
         $this->info('Remove:' . $commit->id);
         $commit->delete();
     }
 }
Beispiel #5
0
 /**
  * Execute the console command
  *
  * @return mixed
  */
 public function handle()
 {
     /** @var Commit $inProgressCommit */
     $inProgressCommit = Commit::query()->where('status', '=', Commit::STATUS_IN_PROGRESS)->get()->first();
     if (!empty($inProgressCommit)) {
         $this->getOutput()->writeln('Already check commit: ' . $inProgressCommit->hash);
         return;
     }
     /** @var Commit $commit */
     $commit = Commit::query()->where('status', '=', Commit::STATUS_PENDING)->get()->first();
     if (empty($commit)) {
         $this->getOutput()->writeln('Done');
         return;
     }
     $checker = new \App\Ci\Checker\ScheduledChecker();
     $checker->check($commit);
 }
Beispiel #6
0
 /**
  * @inheritdoc
  */
 public function handle()
 {
     // older than 10 days
     $builder = Commit::query();
     $builder->where('end_time', '<', time() - self::DAYS * 24 * 3600);
     $builder->where('end_time', '!=', '0');
     $commits = $builder->get();
     /** @var Commit $commit */
     foreach ($commits as $commit) {
         $file = $commit->getLogFilePath();
         if ($this->option('dry-run')) {
             $this->comment('Remove:' . $file);
             continue;
         }
         if (is_file($file)) {
             $this->info('Remove:' . $file);
             unlink($file);
         }
     }
 }