opsb
opsb

Reputation: 30211

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?

Upvotes: 3

Views: 200

Answers (3)

Stefaan Colman
Stefaan Colman

Reputation: 3705

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'

Upvotes: 1

Joni
Joni

Reputation: 3357

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 :/.

Upvotes: 3

maerics
maerics

Reputation: 156424

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    

Upvotes: 0

Related Questions