1
0
Fork 0

minor changes to JsonFile::parseJson for Drivers

pull/862/head
Robert Schönthal 2012-07-03 12:42:29 +02:00
parent e96e06946f
commit 0cd453449b
4 changed files with 3 additions and 7 deletions

1
src/Composer/Json/JsonFile.php Normal file → Executable file
View File

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

1
src/Composer/Repository/Vcs/GitHubDriver.php Normal file → Executable file
View File

@ -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);
}

5
src/Composer/Repository/Vcs/HgDriver.php Normal file → Executable file
View File

@ -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);

3
src/Composer/Repository/Vcs/SvnDriver.php Normal file → Executable file
View File

@ -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);