Ejemplo n.º 1
0
 private function processExtensionSources(array $sources)
 {
     foreach ($sources as $name => $source) {
         if (empty($name)) {
             continue;
         }
         $result = "mod '{$name}'";
         if (!empty($source)) {
             $result .= ", {$source}";
         }
         $this->archive->queueToFile('puphpet/puppet/Puppetfile', $result);
     }
 }
Ejemplo n.º 2
0
 public function testZipReturnsAZipFileLocation()
 {
     $file1 = ['name' => 'foobar', 'content' => 'file1 content'];
     $file2 = ['name' => 'fizzbuzz', 'content' => 'file2 content'];
     $file3 = ['name' => 'bizzbang', 'content' => 'file3 content'];
     $this->archive->expects($this->exactly(3))->method('file_put_contents');
     $this->archive->expects($this->once())->method('exec');
     $targetDir = '/tmp/foobar';
     $baseDir = 'foobar';
     $this->setAttribute($this->archive, 'targetDir', $targetDir);
     $exec = sprintf('cd "%s" && cd .. && zip -r "%s" "%s" -x */.git[!a]\\*', $targetDir, $targetDir . '.zip', $baseDir);
     $this->archive->expects($this->once())->method('exec')->with($exec);
     $this->archive->queueToFile($file1['name'], $file1['content']);
     $this->archive->queueToFile($file2['name'], $file2['content']);
     $this->archive->queueToFile($file3['name'], $file3['content']);
     $this->archive->write();
     $returned = $this->archive->zip();
     $this->assertEquals($targetDir . '.zip', $returned);
 }
Ejemplo n.º 3
0
 /**
  * @return string
  */
 public function getPuppetModules()
 {
     $this->archive = new Extension\Archive('puphpet/puppet/modules');
     $this->archive->write();
     return $this->archive->zip();
 }