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

前端 未结 8 1746
终归单人心
终归单人心 2021-01-30 05:41

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 /l

8条回答
  •  深忆病人
    2021-01-30 06:00

    Use rake task for automation control via rake, for exampe: https://gist.github.com/muxcmux/1805946

    And then in config/initializers/version.rb: module SiteInfo class Application

    def self.version
      "v#{self.read_version}"
    end
    
    def self.read_version
      begin
        File.read 'VERSION'
      rescue
        raise "VERSION file not found or unreadable."
      end
    end
    

提交回复
热议问题