Ruby-on-rails 如何找出现有 Rails 应用程序构建在哪个 Rails 版本上?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12979343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find out which rails version an existing rails application is built on?
提问by John
In general, the question I have is the question in the title:
一般来说,我的问题是标题中的问题:
How do I find out which rails version an existing rails application is built on?
如何找出现有 Rails 应用程序构建在哪个 Rails 版本上?
More specifically for my purposes, I would like to know how to find out in the case when there is no gemfile (I'm relatively new to rails and used to seeing the rails version in the gemfile with all the rails 3 apps, but am not sure for older versions.)
更具体地说,为了我的目的,我想知道如何在没有 gemfile 的情况下找出答案(我对 rails 比较陌生,并且习惯于在带有所有 rails 3 应用程序的 gemfile 中查看 rails 版本,但是我不确定旧版本。)
采纳答案by Raghu
rake gemswill print out what gems, dependencies, and versions are installed, frozen, etc.
rake gems将打印出安装、冻结等的 gem、依赖项和版本。
If you are using bundler than you can use bundle showto list all the gems that your app is using.
如果您使用的是 bundler,那么您可以bundle show用来列出您的应用程序正在使用的所有 gem。
回答by conorliv
Use the command: rake about. This command will output the following info plus more (hence the ellipsis:
使用命令:rake about。此命令将输出以下信息以及更多信息(因此省略号:
About your application's environment
Rails version 4.2.0
Ruby version 2.2.2-p95 (x86_64-darwin14)
RubyGems version 2.4.6
...
回答by Adrien Coquio
In my project rake gemsdo not display the rails version but it's display at the top of the environment.rbfile :
在我的项目中rake gems不显示 rails 版本,但它显示在environment.rb文件的顶部:
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION

