Class: TwoFactorAuth::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



15
16
17
# File 'lib/generators/two_factor_auth/install_generator.rb', line 15

def self.next_migration_number(path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#add_routeObject



19
20
21
# File 'lib/generators/two_factor_auth/install_generator.rb', line 19

def add_route
  route "two_factor_auth_for :users"
end

#copy_initializerObject



27
28
29
# File 'lib/generators/two_factor_auth/install_generator.rb', line 27

def copy_initializer
  copy_file "initializer.rb", "config/initializers/two_factor_auth.rb"
end

#copy_migrationObject



23
24
25
# File 'lib/generators/two_factor_auth/install_generator.rb', line 23

def copy_migration
  migration_template "migration.rb", "db/migrate/create_two_factor_auth_registrations.rb"
end

#show_readmeObject



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

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