0.0
Low commit activity in last 3 years
No release in over a year
Get version from git tags and commits since then and write it to VERSION file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.2.34
~> 5.15
~> 1.16
>= 13.0.6
 Project Readme

Rake::Gitversion

Gem Version Build Status

This gem adds a task 'set_version' to rake, which uses annotated tags and the 'git describe' command to get a version string and save it to a VERSION file. The patch number of the version string is the number of commits since the last version tag. If the git tree is dirty, minor is increased and the version marked as prerelease by adding '.dev'.

Installation

Add this line to your application's Gemfile:

gem 'rake-gitversion'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rake-gitversion

Usage

In your Rakefile:

require 'rake/gitversion'

Add an annotated version tag:

git tag -a -m 'minor' v0.1

Run rake set_version.

Consider adding VERSION to your .gitignore file, but make sure to run to rake set_version after checkout or distribute VERSION file somehow.

In your version.rb, use:

# Version of gem and module
VERSION = begin
  File.read('VERSION')
rescue
  '0.pre'
end.freeze

Development

After checking out the repo, run bundle install to install dependencies. Then, run rake test to run the tests.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/skladd/rake-gitversion.

License

The gem is available as open source under the terms of the MIT License.