1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Use an instance variale when removing the temp directories otherwise the create_haml_views method gets called twice.

This commit is contained in:
Fred Wu 2010-12-23 16:13:05 +08:00 committed by José Valim
parent 146090f86e
commit 2561cd4eac

View file

@ -64,7 +64,7 @@ module Devise
def create_and_copy_haml_views
directory haml_tmp_root, "app/views/#{scope || :devise}"
FileUtils.rm_rf(haml_tmp_root)
FileUtils.rm_rf(@haml_tmp_root)
end
def create_and_copy_slim_views
@ -73,7 +73,7 @@ module Devise
directory slim_tmp_root, "app/views/#{scope || :devise}"
FileUtils.rm_rf(haml_tmp_root)
FileUtils.rm_rf(@haml_tmp_root)
FileUtils.rm_rf(slim_tmp_root)
end
@ -81,12 +81,12 @@ module Devise
def create_haml_views
require 'tmpdir'
html_root = "#{self.class.source_root}/devise"
haml_tmp_root = Dir.mktmpdir("devise-haml.")
html_root = "#{self.class.source_root}/devise"
@haml_tmp_root = Dir.mktmpdir("devise-haml.")
Dir["#{html_root}/**/*"].each do |path|
relative_path = path.sub(html_root, "")
source_path = (haml_tmp_root + relative_path).sub(/erb$/, "haml")
source_path = (@haml_tmp_root + relative_path).sub(/erb$/, "haml")
if File.directory?(path)
FileUtils.mkdir_p(source_path)
@ -95,7 +95,7 @@ module Devise
end
end
haml_tmp_root
@haml_tmp_root
end
alias :haml_tmp_root :create_haml_views