Class: Devise::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/devise/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_initializerObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/devise/install_generator.rb', line 16

def copy_initializer
  unless options[:orm]
    raise MissingORMError, <<-ERROR.strip_heredoc
    An ORM must be set to install Devise in your application.

    Be sure to have an ORM like Active Record or Mongoid loaded in your
    app or configure your own at `config/application.rb`.

      config.generators do |g|
        g.orm :your_orm_gem
      end
    ERROR
  end

  template "devise.rb", "config/initializers/devise.rb"
end

#copy_localeObject



33
34
35
# File 'lib/generators/devise/install_generator.rb', line 33

def copy_locale
  copy_file "../../../config/locales/en.yml", "config/locales/devise.en.yml"
end

#rails_4?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/generators/devise/install_generator.rb', line 41

def rails_4?
  Rails::VERSION::MAJOR == 4
end

#show_readmeObject



37
38
39
# File 'lib/generators/devise/install_generator.rb', line 37

def show_readme
  readme "README" if behavior == :invoke
end