コード例 #1
0
ファイル: GitVersionCollection.php プロジェクト: bopo/website
 public function addFromTags($filter = null)
 {
     $tags = array_filter(explode("\n", $this->execute(array('tag'))));
     $versions = array_filter($tags, $this->filter);
     if (null !== $filter) {
         if (!$filter instanceof \Closure) {
             $regexes = array();
             foreach ((array) $filter as $f) {
                 $regexes[] = Glob::toRegex($f);
             }
             $filter = function ($version) use($regexes) {
                 foreach ($regexes as $regex) {
                     if (preg_match($regex, $version)) {
                         return true;
                     }
                 }
                 return false;
             };
         }
         $versions = array_filter($versions, $filter);
     }
     usort($versions, $this->sorter);
     foreach ($versions as $version) {
         $version = new Version($version);
         $version->setFrozen(true);
         $this->add($version);
     }
     return $this;
 }
コード例 #2
0
ファイル: Project.php プロジェクト: codebubb/web_ssh
 protected function renderVersion(Version $version, $previous, $callback = null, $force = false)
 {
     if (null === $this->renderer) {
         throw new \LogicException('You must set a renderer.');
     }
     $frozen = $version->isFrozen() && $this->renderer->isRendered($this) && $this->version === file_get_contents($this->getBuildDir() . '/PROJECT_VERSION');
     if ($force && !$frozen) {
         $this->flushDir($this->getBuildDir());
     }
     if ($previous && !$this->renderer->isRendered($this)) {
         $this->seedCache($previous, $this->getBuildDir());
     }
     $diff = $this->renderer->render($this, $callback);
     if (null !== $callback) {
         call_user_func($callback, Message::RENDER_VERSION_FINISHED, $diff);
     }
 }