Skip to content

Commit

Permalink
Merge pull request #31 from coenjacobs/delete-origin-package-directory
Browse files Browse the repository at this point in the history
Delete original package directory
  • Loading branch information
coenjacobs authored Dec 23, 2019
2 parents 44394b2 + ef690d6 commit a5fd932
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Mover.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function movePackage(Package $package)

$this->movedPackages[] = $package->config->name;
}

$this->deletePackageVendorDirectories();
}

/**
Expand Down Expand Up @@ -125,4 +127,17 @@ public function moveFile(Package $package, $autoloader, $file, $path = '')

return $targetFile;
}

/**
* Deletes all the packages that are moved from the /vendor/ directory to
* prevent packages that are prefixed/namespaced from being used or
* influencing the output of the code. They just need to be gone.
*/
protected function deletePackageVendorDirectories()
{
foreach ($this->movedPackages as $movedPackage) {
$packageDir = '/vendor/' . $movedPackage;
$this->filesystem->deleteDir($packageDir);
}
}
}

0 comments on commit a5fd932

Please sign in to comment.