Specify gem version in environment.rb

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4111 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 a09b202e
......@@ -13,12 +13,22 @@
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
else
require 'rubygems'
required_version = '<%= Rails::VERSION::STRING %>'
rails_gem = Gem.cache.search('rails', "=#{required_version}").first
unless rails_gem
STDERR.puts "Cannot find gem for Rails =#{required_version}. Install missing gem or change config/boot.rb."
if !defined?(RAILS_GEM_VERSION) && File.read(File.dirname(__FILE__) + '/environment.rb') =~ /RAILS_GEM_VERSION = '([\d.]+)'/
RAILS_GEM_VERSION = $1
end
if defined?(RAILS_GEM_VERSION)
rails_gem = Gem.cache.search('rails', "=#{RAILS_GEM_VERSION}").first
if rails_gem
require rails_gem.full_gem_path + '/lib/initializer'
else
STDERR.puts "Cannot find gem for Rails =#{RAILS_GEM_VERSION}. Install missing gem or change config/boot.rb."
end
else
require 'initializer'
end
require rails_gem.full_gem_path + '/lib/initializer'
end
Rails::Initializer.run(:set_load_path)
Rails::Initializer.run(:set_load_path)
\ No newline at end of file
......@@ -4,6 +4,9 @@
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING %>'
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
......
......@@ -43,8 +43,8 @@ def manifest
m.template "configs/apache.conf", "public/.htaccess"
# Environments
m.template "environments/boot.rb", "config/boot.rb"
m.file "environments/environment.rb", "config/environment.rb"
m.file "environments/boot.rb", "config/boot.rb"
m.template "environments/environment.rb", "config/environment.rb"
m.file "environments/production.rb", "config/environments/production.rb"
m.file "environments/development.rb", "config/environments/development.rb"
m.file "environments/test.rb", "config/environments/test.rb"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册