Browse Source

Merge remote-tracking branch 'github-composer/master' into plugins

* github-composer/master:
  Make sure directories we are downloading to are empty
  Fix parsing of trunk in SvnDriver, fixes composer/satis#88
  Fix file layout in unit tests
  Fix parse error thrown in PHP5.5+
Nils Adermann 11 years ago
parent
commit
786ea2929b

+ 4 - 3
src/Composer/Autoload/AutoloadGenerator.php

@@ -460,9 +460,10 @@ REGISTER_AUTOLOAD;
 REGISTER_LOADER;
 
         if ($useIncludeFiles) {
-            $file .= <<<INCLUDE_FILES
-        foreach (require __DIR__ . '/autoload_files.php' as \$file) {
-            require \$file;
+            $file .= <<<'INCLUDE_FILES'
+        $includeFiles = require __DIR__ . '/autoload_files.php';
+        foreach ($includeFiles as $file) {
+            require $file;
         }
 
 

+ 1 - 0
src/Composer/Downloader/FileDownloader.php

@@ -85,6 +85,7 @@ class FileDownloader implements DownloaderInterface
             throw new \InvalidArgumentException('The given package is missing url information');
         }
 
+        $this->filesystem->removeDirectory($path);
         $this->filesystem->ensureDirectoryExists($path);
 
         $fileName = $this->getFileName($package, $path);

+ 7 - 1
src/Composer/Repository/Vcs/SvnDriver.php

@@ -193,7 +193,13 @@ class SvnDriver extends VcsDriver
         if (null === $this->branches) {
             $this->branches = array();
 
-            $output = $this->execute('svn ls --verbose', $this->baseUrl . '/');
+            if (false === strpos($this->trunkPath, '/')) {
+                $trunkParent = $this->baseUrl . '/';
+            } else {
+                $trunkParent = $this->baseUrl . '/' . dirname($this->trunkPath) . '/';
+            }
+
+            $output = $this->execute('svn ls --verbose', $trunkParent);
             if ($output) {
                 foreach ($this->process->splitLines($output) as $line) {
                     $line = trim($line);

+ 2 - 1
tests/Composer/Test/Autoload/Fixtures/autoload_real_files_by_dependency.php

@@ -38,7 +38,8 @@ class ComposerAutoloaderInitFilesAutoloadOrder
 
         $loader->register(true);
 
-        foreach (require __DIR__ . '/autoload_files.php' as $file) {
+        $includeFiles = require __DIR__ . '/autoload_files.php';
+        foreach ($includeFiles as $file) {
             require $file;
         }
 

+ 2 - 1
tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php

@@ -38,7 +38,8 @@ class ComposerAutoloaderInitFilesAutoload
 
         $loader->register(true);
 
-        foreach (require __DIR__ . '/autoload_files.php' as $file) {
+        $includeFiles = require __DIR__ . '/autoload_files.php';
+        foreach ($includeFiles as $file) {
             require $file;
         }
 

+ 2 - 1
tests/Composer/Test/Autoload/Fixtures/autoload_real_target_dir.php

@@ -40,7 +40,8 @@ class ComposerAutoloaderInitTargetDir
 
         $loader->register(true);
 
-        foreach (require __DIR__ . '/autoload_files.php' as $file) {
+        $includeFiles = require __DIR__ . '/autoload_files.php';
+        foreach ($includeFiles as $file) {
             require $file;
         }