Class: AuthProvider::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/auth_provider/install_generator.rb', line 23

def self.next_migration_number(dirname)
  if defined? ActiveRecord::Generators::Base
    ActiveRecord::Generators::Base.next_migration_number(dirname)
  elsif defined? ActiveRecord::Migration
    next_migration_number = current_migration_number(dirname) + 1
    ActiveRecord::Migration.next_migration_number(next_migration_number)
  else
    fail "Can't find a implementation of next_migration_number"
  end
end

Instance Method Details

#copy_initializer_fileObject



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

def copy_initializer_file
  template "auth_provider.rb", "config/initializers/auth_provider.rb"
end

#copy_migration_fileObject



11
12
13
# File 'lib/generators/auth_provider/install_generator.rb', line 11

def copy_migration_file
  migration_template "create_auth_provider_tables.rb", "db/migrate/create_auth_provider_tables.rb"
end

#mount_engineObject



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

def mount_engine
  route "mount AuthProvider::Engine => '/oauth'"
end