public function getHead(Version $version) { if ($version->getName() == 'dev-trunk') { $head = new Reference('trunk'); } elseif (substr($version->getName(), 0, 4) == 'dev-') { $head = new Reference(substr($version->getName(), 4)); } else { $head = new Reference($version->getName(), Reference::TAG); } return $head; }
/** * Returns the upload path for a specific version. Adds * a suffix if the path already exists (can happen with a * full deploy) * * @param \Webcreate\Conveyor\Repository\Version $version * @return string */ public function getUploadPath(Version $version) { $basepath = $this->transporter->getPath(); if (null === $this->uploadPath) { $suffix = ''; $count = 0; do { $releasePath = 'releases/' . $version->getName() . '-' . substr($version->getBuild(), 0, 6) . $suffix; $suffix = '_' . ++$count; } while ($this->transporter->exists($basepath . '/' . $releasePath)); $this->uploadPath = $releasePath; } return $this->uploadPath; }