If you are using a
VERSION-file to give your new (or old) cool
software tool a version, you maybe also want to display it in the footer
of the website or in the
help command option of your CLI.
Instead of writing stuff like this
you could use version_reader
(written by me) which reads the
VERSION-file and does all the
stripping and formatting for you.
Version Reader is just a small wrapper around the
Let’s do a short example. Imagine that your
VERSION-file is in
with the content
0.4.2\n. Load the version with the following code:
Now, you can display a nicely formatted version
If you don’t like this output, just write a flavor to add a different one. There is already a Rails-flavor which adds some additional output formats:
Check the Readme for more details.
By the way, if you add this Gem in the
Gemfile of your Rails-Application,
it will automatically define
MyApp::Application.version with a
Rails-flavored instance of