/** * @covers ::commandExist */ public function test_commandExist_true() { // When $exists = Interaction::commandExist('ls'); // Then $this->assertTrue($exists); }
private function getGitVersion($fileOrDir) { $newestVersion = '0.0.0'; $currentDir = getcwd(); $gitCommand = 'git tag'; if (!Interaction::commandExist('git')) { return $newestVersion; } if (Str::endsWith($fileOrDir, 'php')) { $dir = dirname($fileOrDir); } else { $dir = $fileOrDir; } $dir = realpath($dir); chdir($dir); exec($gitCommand, $output); foreach ($output as $version) { if (version_compare($newestVersion, $version) === -1) { $newestVersion = $version; } } chdir($currentDir); return $newestVersion; }