module Devise::Generators::ViewPathTemplates

def copy_views

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

def plural_scope

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

def target_path

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

def view_directory(name, _target_path = nil)

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