6 protected $deps = array(
7 'pear.php.net/VersionControl_Git' => 'VersionControl_Git',
8 'pear.twig-project.org/Twig' => 'Twig_Autoloader',
9 'pear.php.net/Date_HumanDiff' => 'Date_HumanDiff',
12 protected $writableDirs;
15 public function __construct()
17 $cfg = $GLOBALS['phorkie']['cfg'];
18 $this->writableDirs = array(
19 'gitdir' => $cfg['gitdir'],
20 'workdir' => $cfg['workdir'],
24 public static function run()
31 public function checkDeps()
33 foreach ($this->deps as $package => $class) {
34 if (!class_exists($class, true)) {
35 $this->fail('PEAR package not installed: ' . $package);
40 public function checkDirs()
42 foreach ($this->writableDirs as $name => $dir) {
44 $this->fail($name . ' directory does not exist at ' . $dir);
46 if (!is_writable($dir)) {
47 $this->fail($name . ' directory is not writable at ' . $dir);
52 public function fail($msg)
54 throw new Exception($msg);