Skip to content
Snippets Groups Projects

Release 0.3.0

Merged Daniel Hürtgen requested to merge develop into master
Compare and
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
+ 10
1
@@ -43,6 +43,9 @@ class Installer extends LibraryInstaller
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$isInstalled = parent::isInstalled($repo, $package);
if (!$isInstalled) {
return $isInstalled;
}
$sourceStandards = $this->getSourceStandards($package);
$destinationStandards = $this->getDestinationStandards($repo);
@@ -100,11 +103,14 @@ class Installer extends LibraryInstaller
$filesystem = new SymfonyFilesystem();
$sourceStandards = $this->getSourceStandards($package);
$destStandardsBasePath = $this->getPHPCodeSnifferStandardsBasePath($repo);
$this->io->writeError(' Installing PHP-CodeSniffer Standards:', false);
foreach ($sourceStandards as $sourceStandard) {
$this->io->writeError(sprintf(' <info>%s</info>', $sourceStandard->getName()));
$sourcePath = $sourceStandard->getPath();
$destPath = $destStandardsBasePath . DIRECTORY_SEPARATOR . $sourceStandard->getName();
$filesystem->mirror($sourcePath, $destPath, null, array('override' => $override));
}
$this->io->writeError('');
}
/**
@@ -116,14 +122,17 @@ class Installer extends LibraryInstaller
{
$sourceStandards = $this->getSourceStandards($package);
$destinationStandards = $this->getDestinationStandards($repo);
$this->io->writeError(' Removing PHP-CodeSniffer Standards:', false);
foreach ($sourceStandards as $sourceStandard) {
if (!$destinationStandards->hasStandard($sourceStandard)) {
continue;
}
$this->io->writeError(sprintf(' <info>%s</info>', $sourceStandard->getName()));
$destinationStandard = $destinationStandards->getStandard($sourceStandard);
$this->filesystem->removeDirectory($destinationStandard->getPath());
}
$this->io->writeError('');
}
/**
@@ -160,7 +169,7 @@ class Installer extends LibraryInstaller
protected function compareStandards(Standard $source, Standard $destination)
{
return $source->getName() === $destination->getName()
&& sha1($source->getRuleSetXmlPath()) === sha1($destination->getRuleSetXmlPath());
&& sha1_file($source->getRuleSetXmlPath()) === sha1_file($destination->getRuleSetXmlPath());
}
/**