Automatically update outdated init.rb files for Rails installations.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@710 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2008-01-07 02:38:19 +00:00
parent 7a1ebe0c17
commit edde33847b
1 changed files with 13 additions and 0 deletions

View File

@ -29,3 +29,16 @@ if defined?(ActionView::TemplateHandler)
else
require 'haml/template/patch'
end
# Update init.rb to the current version
# if it's out of date.
#
# We can probably remove this as of v1.9,
# because the new init file is sufficiently flexible
# to not need updating.
rails_init_file = File.join(RAILS_ROOT, 'vendor', 'plugins', 'haml', 'init.rb')
haml_init_file = File.join(File.dirname(__FILE__), '..', '..', 'init.rb')
if File.exists?(rails_init_file)
require 'fileutils'
FileUtils.cp(haml_init_file, rails_init_file) unless FileUtils.cmp(rails_init_file, haml_init_file)
end