module Devise::I18n::ViewPathTemplates

def copy_views

def copy_views
  if options[:views]
    options[:views].each { |directory| view_directory(directory.to_sym) }
  else
    view_directory :confirmations
    view_directory :passwords
    view_directory :registrations
    view_directory :sessions
    view_directory :unlocks
  end
end

def default_target_path

def default_target_path
  @default_target_path ||= "app/views/#{plural_scope || :devise}"
end

def plural_scope

def plural_scope
  @plural_scope ||= scope.presence && scope.underscore.pluralize
end

def view_directory(name, target_path = nil)

def view_directory(name, target_path = nil)
  directory name.to_s, target_path || "#{default_target_path}/#{name}" do |content|
    if scope
      content.gsub "devise/shared", "#{plural_scope}/shared"
    else
      content
    end
  end
end