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



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

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



31
32
33
# File 'lib/generators/devise/install_generator.rb', line 31

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

#rails_4?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/generators/devise/install_generator.rb', line 39

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

#show_readmeObject



35
36
37
# File 'lib/generators/devise/install_generator.rb', line 35

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