galek/git-repository-tags

This package is abandoned and no longer maintained. No replacement package was suggested.

Get tags and version of your git repository

v1.1.2 2017-10-18 15:39 UTC

This package is not auto-updated.

Last update: 2020-01-21 19:14:07 UTC


README

Build Status Total Downloads Latest Stable Version License Monthly Downloads

Package Installation

The best way to install Git Repository Tags is using Composer:

$ composer require galek/git-repository-tags

Basic usage:

$directory = __DIR__ . '/..'; // where we have directory `.git`, not end with `/` or `\`
$versionPrefix = 'v'; // prefix for version, default is v, so v1.0.0
$currentBranchVersion = true; // true|false , return version by HEAD of branch
$gitTags = new \Galek\GitRepositoryTags\GitRepositoryTags($directory, $versionPrefix, $currentBranchVersion);

// gets informations:

$tags = $gitTags->tags; // array of everyone tags
$versions = $gitTags->versions; // array of everyone tags with our version prefix
$latestVersion = $git->tags->latestVersion; // string, get full name of latest version

Nette usage:

config.neon

extensions: 
    gitTags: Galek\GitRepositoryTags\DI\GitRepositoryTagsExtension

gitTags:
	directory: %appDir%/..
	versionPrefix: 'v'
	byCurrentBranch: true

Presenter

class BasePresenter extends Presenter
{
    /** @var \Galek\GitRepositoryTags\GitRepositoryTags @inject */
    public $gitTags;
    
    public function renderDefault()
    {
        $this->template->version = $this->gitTags->latestVersion;
        $this->template->currentVersion = $this->gitTags->currentVersion;
    }
}