1
0
Fork 0
pull/2004/merge
Jordi Boggiano 2013-06-13 13:28:24 +02:00
parent 6f6228fb1d
commit 8d0b7f278e
53 changed files with 122 additions and 124 deletions

View File

@ -317,7 +317,7 @@ EOF;
}
}
if (preg_match('/\.phar$/', $path)){
if (preg_match('/\.phar$/', $path)) {
$baseDir = "'phar://' . " . $baseDir;
}

View File

@ -66,6 +66,7 @@ class Cache
if ($this->io->isDebug()) {
$this->io->write('Reading '.$this->root . $file.' from cache');
}
return file_get_contents($this->root . $file);
}
@ -80,6 +81,7 @@ class Cache
if ($this->io->isDebug()) {
$this->io->write('Writing '.$this->root . $file.' into cache');
}
return file_put_contents($this->root . $file, $contents);
}
@ -98,6 +100,7 @@ class Cache
if ($this->io->isDebug()) {
$this->io->write('Writing '.$this->root . $file.' into cache');
}
return copy($source, $this->root . $file);
}
@ -116,6 +119,7 @@ class Cache
if ($this->io->isDebug()) {
$this->io->write('Reading '.$this->root . $file.' from cache');
}
return copy($this->root . $file, $target);
}

View File

@ -115,6 +115,7 @@ EOT
$io->write('<info>Found an exact match '.$package->getPrettyString().'.</info>');
} else {
$io->write('<error>Could not find a package matching '.$packageName.'.</error>');
return false;
}

View File

@ -284,6 +284,7 @@ EOT
if ('stash' === $val) {
return 'stash';
}
return $val !== 'false' && (bool) $val;
}
),

View File

@ -14,9 +14,7 @@ namespace Composer\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Composer\Repository\CompositeRepository;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Autoload\AutoloadGenerator;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>

View File

@ -19,8 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Package\CompletePackageInterface;
use Composer\Package\AliasPackage;
use Composer\Factory;
/**

View File

@ -17,7 +17,6 @@ use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\DefaultPolicy;
use Composer\Factory;
use Composer\Package\CompletePackageInterface;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Version\VersionParser;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;

View File

@ -742,7 +742,8 @@ class Installer
return false;
}
private function extractPlatformRequirements($links) {
private function extractPlatformRequirements($links)
{
$platformReqs = array();
foreach ($links as $link) {
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {

View File

@ -15,7 +15,6 @@ namespace Composer\Installer;
use Composer\Composer;
use Composer\Package\Package;
use Composer\IO\IOInterface;
use Composer\Autoload\AutoloadGenerator;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;

View File

@ -140,12 +140,14 @@ class LibraryInstaller implements InstallerInterface
public function getInstallPath(PackageInterface $package)
{
$targetDir = $package->getTargetDir();
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
}
protected function getPackageBasePath(PackageInterface $package)
{
$this->initializeVendorDir();
return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
}

View File

@ -12,8 +12,6 @@
namespace Composer\Package\Archiver;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
use Composer\Util\Filesystem;
use Symfony\Component\Finder;
@ -64,6 +62,7 @@ class ArchivableFilesFinder extends \FilterIterator
foreach ($filters as $filter) {
$exclude = $filter->filter($relativePath, $exclude);
}
return !$exclude;
};

View File

@ -13,8 +13,6 @@
namespace Composer\Package\Archiver;
use Composer\Downloader\DownloadManager;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackage;
use Composer\Util\Filesystem;
@ -60,6 +58,7 @@ class ArchiveManager
public function setOverwriteFiles($overwriteFiles)
{
$this->overwriteFiles = $overwriteFiles;
return $this;
}

View File

@ -12,8 +12,6 @@
namespace Composer\Package\Archiver;
use Composer\Package\PackageInterface;
/**
* @author Till Klampaeckel <till@php.net>
* @author Matthieu Moquet <matthieu@moquet.net>

View File

@ -63,6 +63,7 @@ abstract class BaseExcludeFilter
$exclude = !$negate;
}
}
return $exclude;
}
@ -89,6 +90,7 @@ abstract class BaseExcludeFilter
if ($line) {
return call_user_func($lineParser, $line);
}
return null;
}, $lines),
function ($pattern) {
@ -110,6 +112,7 @@ abstract class BaseExcludeFilter
foreach ($rules as $rule) {
$patterns[] = $this->generatePattern($rule);
}
return $patterns;
}
@ -138,6 +141,7 @@ abstract class BaseExcludeFilter
}
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
return array($pattern . '#', $negate, false);
}
}

View File

@ -64,6 +64,7 @@ class HgExcludeFilter extends BaseExcludeFilter
} else {
$this->patternMode = self::HG_IGNORE_REGEX;
}
return null;
}
@ -85,6 +86,7 @@ class HgExcludeFilter extends BaseExcludeFilter
{
$pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
$pattern = str_replace('[^/]*', '.*', $pattern);
return array($pattern, false, true);
}
@ -99,6 +101,7 @@ class HgExcludeFilter extends BaseExcludeFilter
{
// WTF need to escape the delimiter safely
$pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
return array($pattern, false, true);
}
}

View File

@ -12,9 +12,6 @@
namespace Composer\Package\Archiver;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
/**
* @author Till Klampaeckel <till@php.net>
* @author Nils Adermann <naderman@naderman.de>
@ -43,6 +40,7 @@ class PharArchiver implements ArchiverInterface
$phar = new \PharData($target, null, null, static::$formats[$format]);
$files = new ArchivableFilesFinder($sources, $excludes);
$phar->buildFromIterator($files, $sources);
return $target;
} catch (\UnexpectedValueException $e) {
$message = sprintf("Could not create archive '%s' from '%s': %s",

View File

@ -12,9 +12,6 @@
namespace Composer\Package;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Version\VersionParser;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*/

View File

@ -326,4 +326,3 @@ class SvnDriver extends VcsDriver
return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
}
}

View File

@ -12,7 +12,6 @@
namespace Composer\Script;
use Composer\Autoload\AutoloadGenerator;
use Composer\IO\IOInterface;
use Composer\Composer;
use Composer\DependencyResolver\Operation\OperationInterface;

View File

@ -71,7 +71,7 @@ class GitHub
* @param string $originUrl The host this GitHub instance is located at
* @param string $message The reason this authorization is required
* @throws \RuntimeException
* @throws \Composer\Downloader\TransportException|\Exception
* @throws TransportException|\Exception
* @return bool true on success
*/
public function authorizeOAuthInteractively($originUrl, $message = null)

View File

@ -12,7 +12,7 @@
function includeIfExists($file)
{
return file_exists($file)===true ? include $file : false;
return file_exists($file) ? include $file : false;
}
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {

View File

@ -67,6 +67,7 @@ class AutoloadGeneratorTest extends TestCase
->method('getInstallPath')
->will($this->returnCallback(function ($package) use ($that) {
$targetDir = $package->getTargetDir();
return $that->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
}));
$this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
@ -697,6 +698,7 @@ EOF;
->method('getInstallPath')
->will($this->returnCallback(function ($package) use ($vendorDir) {
$targetDir = $package->getTargetDir();
return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
}));

View File

@ -17,7 +17,7 @@ use Composer\Test\TestCase;
class InitCommandTest extends TestCase
{
function testParseValidAuthorString()
public function testParseValidAuthorString()
{
$command = new InitCommand;
$author = $command->parseAuthorString('John Smith <john@example.com>');
@ -25,14 +25,14 @@ class InitCommandTest extends TestCase
$this->assertEquals('john@example.com', $author['email']);
}
function testParseEmptyAuthorString()
public function testParseEmptyAuthorString()
{
$command = new InitCommand;
$this->setExpectedException('InvalidArgumentException');
$command->parseAuthorString('');
}
function testParseAuthorStringWithInvalidEmail()
public function testParseAuthorStringWithInvalidEmail()
{
$command = new InitCommand;
$this->setExpectedException('InvalidArgumentException');

View File

@ -13,9 +13,7 @@
namespace Composer\Test\Package\Archiver;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Package\Archiver;
use Composer\Package\Archiver\ArchiveManager;
use Composer\Package\PackageInterface;
class ArchiveManagerTest extends ArchiverTest

View File

@ -13,7 +13,6 @@
namespace Composer\Test\Package;
use Composer\Package\Locker;
use Composer\Package\CompletePackage;
class LockerTest extends \PHPUnit_Framework_TestCase
{