您将 Rails 应用程序的版本号存储在哪里? [英] Where do you store your Rails Application's version number?
问题描述
在对我们的 rails 应用程序进行版本控制时,我们使用了出色的语义版本控制 范例.我遇到的一个问题是最好将这个数字存储在哪里?我已经看到它存储在 /lib
、environment.rb
等中.
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?
推荐答案
我真的不认为有任何约定.我想这完全是关于你觉得很自然的事情.
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
通过添加:
VERSION = '1.0.0'
无论您选择哪个选项(从上面) - VERSION 常量都将在应用程序初始化时设置.
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.
lib
文件夹听起来有点奇怪,因为这个文件夹是用来存储可重用的模块.
The lib
-folder does sound a bit strange though, as this folder is meant to store re-usable modules.
这篇关于您将 Rails 应用程序的版本号存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!