Skip to content

Commit

Permalink
fixing version management
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 3, 2017
1 parent 73cf89d commit e5d6f90
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/components/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ public function renderFile()

public function renderRelease()
{
if ($this->branch) {
return implode('-', [$this->release, $this->branch, substr($this->hash, 0, 7)]);
if ($this->release === 'dev') {
return implode('-', [$this->release, $this->getBranch(), substr($this->hash, 0, 7)]);
} else {
return $this->release;
}
}

public function getBranch()
{
return $this->branch ?: 'master';
}

public function update($release)
{
$this->load();
Expand All @@ -87,20 +92,20 @@ public function save()
$this->getFile()->write($this->renderFile() . "\n");
}

public function setRelease($release = null, $branch = null)
public function setRelease($release = null, $branch = '')
{
$this->setBranch($branch);
$this->release = $this->getRelease($release);
$this->setBranch($branch, $this->release);
}

public function getRelease($release = null)
{
return $release ?: $this->release ?: 'dev';
}

public function setBranch($branch)
public function setBranch($branch, $release = null)
{
if (isset($branch)) {
if (isset($branch) && $release !== 'dev') {
$this->branch = $branch;
}
}
Expand Down

0 comments on commit e5d6f90

Please sign in to comment.