Skip to content

Commit

Permalink
源码安装时不删除test文件夹
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed May 27, 2017
1 parent 4c6e1eb commit 1be326e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/ThinkFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

namespace think\composer;

use Composer\Package\PackageInterface;
use Composer\Installer\LibraryInstaller;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;

class ThinkFramework extends LibraryInstaller
{
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
if ($this->composer->getPackage()->getType() == 'project' && $package->getInstallationSource() != 'source') {
//remove tests dir
$this->filesystem->removeDirectory($this->getInstallPath($package) . DIRECTORY_SEPARATOR . 'tests');
}
}

/**
* {@inheritDoc}
*/
Expand All @@ -31,19 +40,10 @@ public function getInstallPath(PackageInterface $package)
return 'thinkphp';
}

public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
if ($this->composer->getPackage()->getType() == 'project') {
//remove tests dir
$this->filesystem->removeDirectory($this->getInstallPath($package) . DIRECTORY_SEPARATOR . 'tests');
}
}

public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
parent::update($repo, $initial, $target);
if ($this->composer->getPackage()->getType() == 'project') {
if ($this->composer->getPackage()->getType() == 'project' && $target->getInstallationSource() != 'source') {
//remove tests dir
$this->filesystem->removeDirectory($this->getInstallPath($target) . DIRECTORY_SEPARATOR . 'tests');
}
Expand Down

0 comments on commit 1be326e

Please sign in to comment.