Skip to content

Commit

Permalink
Fix bugs in Phing Packages in combination with PEAR Error handling BS
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Jan 16, 2010
1 parent 1cf273e commit 47c29d5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
8 changes: 6 additions & 2 deletions Pearanha/Phing/PearanhaChannelTask.php
Expand Up @@ -31,7 +31,11 @@ public function setChannel($channel)

public function main()
{
$runner = new Pearanha_Runner_PearRunner($this->pearConfigFile);
$runner->run(array(__FILE__, 'channel-discover', $this->channel));
try {
$runner = new Pearanha_Runner_PearRunner($this->pearConfigFile);
$runner->run(array(__FILE__, 'channel-discover', $this->channel));
} catch(Exception $e) {
$this->log($e->getMessage());
}
}
}
8 changes: 6 additions & 2 deletions Pearanha/Phing/PearanhaPackageTask.php
Expand Up @@ -31,7 +31,11 @@ public function setPackageName($packageName)

public function main()
{
$runner = new Pearanha_Runner_PearRunner($this->pearConfigFile);
$runner->run(array(__FILE__, 'install', $this->packageName));
try {
$runner = new Pearanha_Runner_PearRunner($this->pearConfigFile);
$runner->run(array(__FILE__, 'install', $this->packageName));
} catch(Exception $e) {
$this->log($e->getMessage());
}
}
}
12 changes: 5 additions & 7 deletions Pearanha/Runner/PearRunner.php
Expand Up @@ -93,7 +93,7 @@ public function run($argv)

$ui = PEAR_Command::getFrontendObject();
$ui->setConfig($config);
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, "throwException"));
if (ini_get('safe_mode')) {
$ui->outputData('WARNING: running in safe mode requires that all files created ' .
'be the same uid as the current script. PHP reports this script is uid: ' .
Expand Down Expand Up @@ -213,12 +213,6 @@ public function run($argv)
if ($ok === false) {
PEAR::raiseError("unknown command `$command'");
}

if (PEAR::isError($ok)) {
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
PEAR::raiseError($ok);
}

}

private function usage($error = null, $helpsubject = null)
Expand Down Expand Up @@ -298,4 +292,8 @@ private function cmdHelp($command)
return "Command '$command' is not valid, try '$progname help'";
}

public function throwException($message)
{
throw new Exception($message);
}
}
4 changes: 2 additions & 2 deletions pearfarm.spec
Expand Up @@ -6,9 +6,9 @@ $spec = Pearfarm_PackageSpec::create(array(Pearfarm_PackageSpec::OPT_BASEDIR =>
->setChannel('beberlei.pearfarm.org')
->setSummary('Simple Wrapper for an application-Level PEAR installer')
->setDescription('Simple Wrapper for an application-Level PEAR installer')
->setReleaseVersion('0.1.0')
->setReleaseVersion('0.1.1')
->setReleaseStability('alpha')
->setApiVersion('0.1.0')
->setApiVersion('0.1.1')
->setApiStability('alpha')
->setLicense(Pearfarm_PackageSpec::LICENSE_BSD)
->setNotes('Next release, now with two phing tasks for channel registering and package installation.')
Expand Down

0 comments on commit 47c29d5

Please sign in to comment.