--0016e6dd8d7088995f04b17ecc46 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 11, 2011 at 2:28 PM, Chad Perrin <code / apotheon.net> wrote: > How do I specify and access a gem's version number within the code of the > gem itself? For example: > > 1. I write a library. > 2. I write a command line utility that uses that library. > 3. The utility uses OptionParser, with a --version option. > 4. I package the things up inside a gem. > > What's the best way to specify the version number and give the code > executed when the --version argument is supplied the ability to access > that version number? > > -- > Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] > Just use your git hash: # assumes file is in root/lib/gem_name.rb module GemName VERSION git --git-dir {File.dirname __FILE__}/../.git" rev-parse origin/master` end ;)~ --0016e6dd8d7088995f04b17ecc46--