Beispiel #1
0
 public function createPackage($in = null)
 {
     $this->writePackageFile();
     if (!is_null($in)) {
         pantr::mkdirs($in);
     }
     $pkgFile = $this->options[self::OPT_BASEDIR] . DIRECTORY_SEPARATOR . 'package.xml';
     pantr::create_pear_package($pkgFile, $in);
 }
Beispiel #2
0
         pantr::rm($self->peardir);
     });
 });
 // preparation
 $self->peardir = __DIR__ . '/../../../tmp/pear';
 pantr::silent(function () use(&$self) {
     pantr::mkdirs($self->peardir);
 });
 $self->peardir = realpath($self->peardir);
 $self->repo = new Repository($self->peardir);
 $self->repo->create();
 it('should create a new repository if there is none', function ($self) {
     // in case it has already been created we just delete it
     pantr::silent(function () use($self) {
         pantr::rm($self->peardir);
         pantr::mkdirs($self->peardir);
     });
     theFile($self->peardir . '/.pearrc')->shouldNotExist();
     $repo = new Repository($self->peardir);
     theValueOf($repo->exists())->shouldBe(false);
     $repo->create();
     theValueOf($repo->exists())->shouldBeTrue();
     theFile($self->peardir . '/.pearrc')->shouldExist();
 });
 it('should discover a channel', function ($self) {
     $discovery = function () use($self) {
         $self->repo->discoverChannel('pear.pagosoft.com');
     };
     evaluating($discovery)->shouldProduceOutput("Adding Channel \"pear.pagosoft.com\" succeeded\n" . "Discovery of channel \"pear.pagosoft.com\" succeeded\n");
 });
 it('should install a package', function ($self) {
Beispiel #3
0
 public static function copy($src, $target, $vars = null)
 {
     // read content and modify it
     $package = file_get_contents($src);
     if (!is_null($vars)) {
         if (is_callable($vars)) {
             $package = $vars($package);
         } else {
             foreach ($vars as $k => $v) {
                 $package = str_replace('##' . $k . '##', $v, $package);
             }
         }
     }
     // make path from pattern
     $target = fileNameTransform($src, $target);
     if (!is_dir(dirname($target))) {
         pantr::mkdirs(dirname($target));
     }
     pantr::writeAction('copy', $src . ' to ' . $target);
     file_put_contents($target, $package);
 }