class DeviseMaterialize::InstallGenerator

Public Instance Methods

generate_views() click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 14
def generate_views # rubocop:disable AbcSize
  puts "Generating Views..."
  directory "#{options.view_engine.downcase}/#{options.form_engine}/mailer",
            "app/views/#{scope}/mailer"
  directory "#{options.view_engine.downcase}/#{options.form_engine}/shared",
            "app/views/#{scope}/shared"
  copy_views
  puts "Generating Javascript & Stylesheet..."
  directory "assets", "app/assets/"
  puts "Generating Devise Helper..."
  directory "helpers", "app/helpers"
end

Protected Instance Methods

form_file() click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 67
def form_file
  @form_file ||= options[:form_engine].downcase
end
scope() click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 54
def scope
  @scope ||=
    if namespace.casecmp("devise").zero?
      namespace.downcase.underscore
    else
      namespace.downcase.underscore.pluralize
    end
end
target_path() click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 50
def target_path
  @target_path ||= "app/views/#{scope}"
end
update_views(name) click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 39
def update_views(name)
  directory "#{view_file}/#{form_file}/#{name}",
            "#{target_path}/#{name}" do |content|
    if scope != "devise"
      content.gsub "devise/shared/links", "#{scope}/shared/links"
    else
      content
    end
  end
end
view_file() click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 63
def view_file
  @view_file ||= options[:view_engine].downcase
end

Private Instance Methods

copy_views() click to toggle source
# File lib/generators/devise_materialize/install_generator.rb, line 29
def copy_views
  update_views :confirmations
  update_views :passwords
  update_views :registrations
  update_views :sessions
  update_views :unlocks
end