开发者

Detect rails 2 app

I need to detect rack apps and rails 2 apps by simply inspecting the files in a project.

I've been able to do 开发者_开发问答this for rack apps by checking for the existence of a config.ru file. Is there something similar I could check for in a rails 2 app?


From Phusion Passeger documentation: Phusion Passenger checks whether the virtual host is a Rails application by checking whether the following file exists:

dirname(DocumentRoot) + "/config/environment.rb"

This file exists also for rails 3 projects if that is a problem :/.


In config/environment.rb you can look for RAILS_GEM_VERSION = '2.x.x'

In Gemfile.lock for rails (2.x.x)

In Gemfile for gem 'rails', '2.x.x'


The file config/environment.rb should have a statement which mentions the required version of rails, e.g.:

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜