Example #1
0
    /**
     * Creates the distribution artifact.
     *
     * @param \Generator $emoteGenerator Contains a generator which will yield objects
     *     of type GbsLogistics\Emotes\EmoteBundle\Entity\Emote .
     * @return ReleaseArtifact
     */
    public function generateArtifact(\Generator $emoteGenerator)
    {
        $zipDir = 'GoonfleetEmotes.AdiumEmoticonSet';
        $outputFilename = tempnam(sys_get_temp_dir(), $this->getNamespace());
        $zip = new \ZipArchive();
        if (!$zip->open($outputFilename)) {
            throw new \RuntimeException(sprintf('Can\'t open file %s for writing', $outputFilename));
        }
        $zip->addEmptyDir($zipDir);
        $plist = <<<PLISTHEADER
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdiumSetVersion</key>
<integer>1</integer>
<key>Emoticons</key>
<dict>
PLISTHEADER;
        foreach ($emoteGenerator as $emote) {
            $plist .= $this->getPlistEntry($emote);
            $zip->addFile($this->dataStorage->getImageSourcePath($emote->getPath()), $zipDir . '/' . $emote->getPath());
        }
        $plist .= '</dict></dict></plist>';
        $zip->addFromString($zipDir . '/Emoticons.plist', $plist);
        $zip->close();
        $artifact = new ReleaseArtifact();
        $artifact->setNamespace($this->getNamespace());
        $artifact->setPath($outputFilename);
        $artifact->setName($this->getNamespace());
        return $artifact;
    }
Example #2
0
    /**
     * Creates the distribution artifact.
     *
     * @param \Generator $emoteGenerator Contains a generator which will yield objects
     *     of type GbsLogistics\Emotes\EmoteBundle\Entity\Emote .
     * @return ReleaseArtifact
     */
    public function generateArtifact(\Generator $emoteGenerator)
    {
        $zipDir = $this->getNamespace();
        $outputFilename = tempnam(sys_get_temp_dir(), $this->getNamespace());
        $zip = new \ZipArchive();
        if (!$zip->open($outputFilename)) {
            throw new \RuntimeException(sprintf('Can\'t open file %s for writing', $outputFilename));
        }
        $zip->addEmptyDir($zipDir);
        $header = $this->generateHeader();
        $themeFile = sprintf(<<<EOTXT
Name=%s
Description=%s
Icon=%s
Author=%s

[default]

EOTXT
, $header->getName(), $header->getDescription(), $header->getIcon(), $header->getAuthor());
        /** @var Emote $emote */
        foreach ($emoteGenerator as $emote) {
            $themeFile .= $this->generateEmoteEntry($emote);
            $zip->addFile($this->dataStorage->getImageSourcePath($emote->getPath()), $zipDir . '/' . $emote->getPath());
        }
        $zip->addFromString($zipDir . '/theme', $themeFile);
        $zip->close();
        $artifact = new ReleaseArtifact();
        $artifact->setNamespace($this->getNamespace());
        $artifact->setPath($outputFilename);
        $artifact->setName($this->getName());
        return $artifact;
    }
 /**
  * Disposes of a distribution artifact.
  *
  * @param ReleaseArtifact $artifact
  * @return void
  */
 public function dispose(ReleaseArtifact $artifact)
 {
     unlink($artifact->getPath());
 }
Example #4
0
 /**
  * Publishes a release to a publicly available destination.
  *
  * @param ReleaseArtifact $artifact
  * @return PublishedRelease
  */
 public function publish(ReleaseArtifact $artifact)
 {
     $results = $this->s3Client->putObject($artifact->getNamespace() . '.zip', $artifact->getPath());
     return new PublishedRelease($artifact->getName(), $results->get('ObjectURL'));
 }
Example #5
0
 public function publish(ReleaseArtifact $artifact)
 {
     return new PublishedRelease($artifact->getName(), 'nowhere');
 }
 /**
  * @param ReleaseArtifact $artifact
  * @return PublishedRelease
  */
 public function publish(ReleaseArtifact $artifact)
 {
     $releaseFilename = $this->dataStorage->getDistDirectory($artifact->getNamespace()) . DIRECTORY_SEPARATOR . date('YmdHis') . '.zip';
     copy($artifact->getPath(), $releaseFilename);
     return new PublishedRelease($artifact->getName(), realpath($releaseFilename));
 }