Skip to content

Commit

Permalink
Refactor to updatable: true.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseleite committed Nov 6, 2024
1 parent 109317a commit bdfce39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/StarterKits/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ function () {
*/
public function removeStarterKit(): self
{
if ($this->isAddon() || $this->disableCleanup) {
if ($this->isUpdatable() || $this->disableCleanup) {
return $this;
}

Expand Down Expand Up @@ -589,7 +589,7 @@ protected function completeInstall(): self
*/
protected function removeRepository(): self
{
if ($this->isAddon() || $this->fromLocalRepo || ! $this->url) {
if ($this->isUpdatable() || $this->fromLocalRepo || ! $this->url) {
return $this;
}

Expand Down Expand Up @@ -684,10 +684,10 @@ protected function config(?string $key = null): mixed
}

/**
* Should starter kit be treated as a regular addon, and live on for future composer updates, etc?
* Should starter kit be treated as an updatable package, and live on for future composer updates, etc?
*/
protected function isAddon(): bool
protected function isUpdatable(): bool
{
return (bool) $this->config('addon');
return (bool) $this->config('updatable');
}
}
12 changes: 6 additions & 6 deletions tests/StarterKits/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ public function it_restores_existing_repositories_after_successful_install()
}

#[Test]
public function it_installs_as_living_addon_with_custom_config()
public function it_installs_as_living_package_with_custom_config()
{
$this->setConfig([
'addon' => true, // With `addon: true`, kit should live on as composer updatable addon
'updatable' => true, // With `updatable: true`, kit should live on as composer updatable package
'export_paths' => [
'copied.md',
],
Expand All @@ -227,18 +227,18 @@ public function it_installs_as_living_addon_with_custom_config()
$this->assertFileExists(base_path('copied.md'));
$this->assertComposerJsonDoesntHave('repositories');

// Keep addon around
// Keep package around
$this->assertFileExists($this->kitVendorPath());

// But ensure we still delete backup composer.json, which is only used for error handling purposes
$this->assertFileDoesNotExist(base_path('composer.json.bak'));
}

#[Test]
public function it_leaves_custom_repository_for_living_addon()
public function it_leaves_custom_repository_for_living_packages_that_need_it()
{
$this->setConfig([
'addon' => true, // With `addon: true`, kit should live on as composer updatable addon
'updatable' => true, // With `updatable: true`, kit should live on as composer updatable package
'export_paths' => [
'copied.md',
],
Expand All @@ -256,7 +256,7 @@ public function it_leaves_custom_repository_for_living_addon()

$this->assertFileExists(base_path('copied.md'));

// Keep addon around
// Keep package around
$this->assertFileExists($this->kitVendorPath());

// As well as custom repository, which will be needed for composer updates, if it was needed for install
Expand Down

0 comments on commit bdfce39

Please sign in to comment.