Gitvers
Gitvers is an utility to extract a version number from git tags.
Installation
Add this line to your application's Gemfile:
gem 'gitvers'
And then execute:
$ bundle
Or install it yourself as:
$ gem install gitvers
Usage
$ gitvers help
API
rep = Gitvers::Repository.new(repository_path, :commit => 'master')
puts rep.summary # 1.6.2-34-09938ba (3425)
puts rep.full_version # 1.6.2-34-09938ba
puts rep.short_version # 1.6.2
puts rep.revision_number # 3425
Commit is optional, default to HEAD. When commit is given, it is
used to compute the revision number with git rev-list
.
Known issues
At present gitvers is limited to an exclusive use of git tags, which means it will behave erratically if you have non version git tags.
The command line tool gitvers
can only work on the master branch.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
MIT