galek / git-repository-tags
Get tags and version of your git repository
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >= 7.0
- nette/di: ^2.4|^3.0
- nette/finder: ^2.4|^3.0
- nette/safe-stream: ^2.3
Requires (Dev)
- nette/tester: ^2.0
README
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; } }