Search code examples
ruby-on-railsversioningsemantic-versioning

Where do you store your Rails Application's version number?


We use the wonderful semantic versioning paradigm when versioning our rails app. One question I had was where is it best to store this number? I've seen it stored in /lib, environment.rb, etc.

Just wondering what people thought as to best practices?


Solution

  • I don't really think there's any convention for this. I guess it's all about what seems natural to you.

    Some places the version number can be placed are in:

    • config/environment.rb
    • config/application.rb
    • config/initializers/version.rb

    by adding:

    VERSION = '1.0.0'
    

    Regardless of which option you choose (from above) - the VERSION constant will be set at the initialization of the app.

    For my blog I just update the footer of my layout - as the version number isn't used anywhere else.

    The lib-folder does sound a bit strange though, as this folder is meant to store re-usable modules.