From 2561cd4eac870b584c29bd2e4dd1ae4f5289c552 Mon Sep 17 00:00:00 2001 From: Fred Wu Date: Thu, 23 Dec 2010 16:13:05 +0800 Subject: [PATCH] Use an instance variale when removing the temp directories otherwise the `create_haml_views` method gets called twice. --- lib/generators/devise/views_generator.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/generators/devise/views_generator.rb b/lib/generators/devise/views_generator.rb index 9da0d5fa..0e11d54c 100644 --- a/lib/generators/devise/views_generator.rb +++ b/lib/generators/devise/views_generator.rb @@ -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