On 11/11/2011 15:25, Chad Perrin wrote: > On Sat, Nov 12, 2011 at 05:53:46AM +0900, Jeremy Bopp wrote: >> >> The trick with both of these schemes is to keep the internal version >> information in sync with the gem version. How you do that depends on >> how you build your gem, but generally speaking, you have two fairly >> decent options. >> >> The first is to define your constant in a minimal version.rb file and >> then load that to get the version when building your gem. The other is >> to generate the version.rb file based on some other specification of the >> version when you build the gem. > > Do you have any specific examples in mind for how to accomplish each of > those approaches -- something fairly standard or well-defined -- so I > would not have to reinvent a wheel someone else has probably already > figured out? In lib/my_library/version.rb or something similar: module MyLibrary VERSION = '1.2.3' end In mylibrary.gemspec: $: << 'lib' require 'my_library/version' ... s.version = MyLibrary::VERSION ... In your executable: require 'my_library/version' puts MyLibrary::VERSION -Jeremy