Skip to content

Commit

Permalink
Make the archived repo warning harder to miss
Browse files Browse the repository at this point in the history
  • Loading branch information
snim2 committed May 30, 2024
1 parent 41259e1 commit b038b8e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/Git/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public function check_is_archived_github_repository($repository)
$json = json_decode($raw_json);
curl_close($curl);
if (!is_null($json) && property_exists($json, 'archived') && $json->archived) {
echo "WARNING: GitHub repo is archived. This dependency should be replaced before the repo is removed.\n";
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
echo "!! WARNING: GitHub repo is archived. This dependency !!\n";
echo "!! should be replaced before the repo is removed. !!\n";
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
}
}

Expand Down
14 changes: 13 additions & 1 deletion tests/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@ private function getWhippetLock(/* string */ $hash, array $dependencyMap)
return $whippetLock;
}

private function getArchivedWarning()
{
$warning = <<<'EOT'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING: GitHub repo is archived. This dependency !!
!! should be replaced before the repo is removed. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

EOT;
return $warning;
}

private function getGit($isRepo, $cloneRepo, $checkout, $isArchived = false)
{
$archived_warning = "WARNING: GitHub repo is archived. This dependency should be replaced before the repo is removed.\n";
$archived_warning = $this->getArchivedWarning();

$git = $this->getMockBuilder('\\Dxw\\Whippet\\Git\\Git')
->disableOriginalConstructor()
Expand Down
20 changes: 16 additions & 4 deletions tests/dependencies/installer_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,15 @@ public function testInstallArchiveRepo()
$this->assertFalse($result->isErr());
$expectedOutput = <<<'EOT'
[Adding themes/my-theme]
WARNING: GitHub repo is archived. This dependency should be replaced before the repo is removed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING: GitHub repo is archived. This dependency !!
!! should be replaced before the repo is removed. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
git clone output
WARNING: GitHub repo is archived. This dependency should be replaced before the repo is removed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING: GitHub repo is archived. This dependency !!
!! should be replaced before the repo is removed. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
git checkout output


Expand Down Expand Up @@ -563,9 +569,15 @@ public function testInstallSingleAlreadyClonedAndArchived()
$output = ob_get_clean();
$expectedOutput = <<<'EOT'
[Adding plugins/my-plugin]
WARNING: GitHub repo is archived. This dependency should be replaced before the repo is removed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING: GitHub repo is archived. This dependency !!
!! should be replaced before the repo is removed. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
git clone output
WARNING: GitHub repo is archived. This dependency should be replaced before the repo is removed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! WARNING: GitHub repo is archived. This dependency !!
!! should be replaced before the repo is removed. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
git checkout output


Expand Down

0 comments on commit b038b8e

Please sign in to comment.