Ejemplo n.º 1
0
 /**
  *
  */
 public function visit(PEAR_PackageProjector_Package $package)
 {
     $handler = PEAR_PackageProjector::singleton()->getMessageHandler();
     //
     $dir = $package->getPackageDirectory();
     $fullpath = realpath($dir . '/' . $this->path);
     //
     if (true === $this->_getAttr('ignore')) {
         $handler->buildMessage(5, "Add attribute 'ignore' of [{$this->path}]... yes", true);
         if (is_dir($fullpath)) {
             $package->addIgnore($fullpath . DIRECTORY_SEPARATOR . '*');
         } else {
             $package->addIgnore($fullpath);
         }
     }
     //
     $role = $this->_getAttr('role');
     if (!is_null($role)) {
         $handler->buildMessage(5, "Add attribute 'role' of [{$this->path}]... {$role}", true);
         if (is_dir($fullpath)) {
             $package->addDirectoryRole($this->path, $role);
         } else {
             $package->addExceptions($this->path, $role);
         }
     }
     //
     $platform = $this->_getAttr('platform');
     if (!is_null($platform)) {
         $handler->buildMessage(5, "Add attribute 'platform' of [{$this->path}]... {$platform}", true);
         $package->addPlatformExceptions($this->path, $platform);
     }
     //
     $install = $this->_getAttr('install');
     if (!is_null($install)) {
         $handler->buildMessage(5, "Add attribute 'install' of [{$this->path}]... {$install}", true);
         $package->addInstallAs($this->path, $install);
         $package->addInstallExceptions($this->path, '/');
     }
     //
     $replace = $this->_getAttr('replace');
     if (is_array($replace)) {
         foreach ($replace as $type => $value) {
             foreach ($value as $from => $to) {
                 $handler->buildMessage(5, "Add attribute 'replace' of [{$this->path}]... {$from} => {$type}::{$to}", true);
                 $package->addReplacement($this->path, $type, $from, $to);
             }
         }
     }
 }