Skip to content

Adding autoversioning to a chef cookbook

bluepojo edited this page Oct 9, 2012 · 4 revisions

note: This is instructions for a git repository. Perforce will require some modification.

Add thor-scmversion to the Gemfile:

gem 'thor-scmversion'
$ bundle install

Add thor/scmversion to the Thorfile:

require 'thor/scmversion'
$ bundle exec thor -T

remove your VERSION file from source control

$ git rm VERSION
$ echo VERSION >> .gitignore`
$ git add .gitignore
$ git commit -m "Drop VERSION as it is managed by thor-scmversion now"

git tag your current version

$ git tag 0.0.1
$ git push --tags

Change metadata.rb to read the VERSION file written by thor-scmversion

version IO.read(File.join(File.dirname(__FILE__), 'VERSION')) rescue "0.0.1"

You're done!

Clone this wiki locally