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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT