Browse Source

minor changes to JsonFile::parseJson for Drivers

Robert Schönthal 12 years ago
parent
commit
0cd453449b

+ 0 - 1
src/Composer/Json/JsonFile.php

@@ -300,7 +300,6 @@ class JsonFile
             return true;
         }
 
-        //throw $result;
         throw new JsonValidationException('JSON file is not valid "'.$file.'"'."\n".$result->getMessage(), $result->getDetails());
     }
 }

+ 0 - 1
src/Composer/Repository/Vcs/GitHubDriver.php

@@ -122,7 +122,6 @@ class GitHubDriver extends VcsDriver
         }
 
         if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
-            //TODO how to get the json file here?
             $this->infoCache[$identifier] = JsonFile::parseJson($res);
         }
 

+ 2 - 3
src/Composer/Repository/Vcs/HgDriver.php

@@ -94,14 +94,13 @@ class HgDriver extends VcsDriver
     public function getComposerInformation($identifier)
     {
         if (!isset($this->infoCache[$identifier])) {
-            $resource = escapeshellarg($identifier);
-            $this->process->execute(sprintf('cd %s && hg cat -r %s composer.json', escapeshellarg($this->tmpDir), $resource), $composer);
+            $this->process->execute(sprintf('cd %s && hg cat -r %s composer.json', escapeshellarg($this->tmpDir), escapeshellarg($identifier)), $composer);
 
             if (!trim($composer)) {
                 return;
             }
 
-            $composer = JsonFile::parseJson($composer, $resource);
+            $composer = JsonFile::parseJson($composer, $identifier);
 
             if (!isset($composer['time'])) {
                 $this->process->execute(sprintf('cd %s && hg log --template "{date|rfc822date}" -r %s', escapeshellarg($this->tmpDir), escapeshellarg($identifier)), $output);

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

@@ -94,7 +94,6 @@ class SvnDriver extends VcsDriver
         $identifier = '/' . trim($identifier, '/') . '/';
 
         if ($res = $this->cache->read($identifier.'.json')) {
-            //TODO how to get the json filename here?
             $this->infoCache[$identifier] = JsonFile::parseJson($res);
         }
 
@@ -117,7 +116,7 @@ class SvnDriver extends VcsDriver
                 throw new TransportException($e->getMessage());
             }
 
-            $composer = JsonFile::parseJson($output, $resource);
+            $composer = JsonFile::parseJson($output, $this->baseUrl . $resource . $rev);
 
             if (!isset($composer['time'])) {
                 $output = $this->execute('svn info', $this->baseUrl . $path . $rev);