Sha256: 394c50ac36bca271e0fc5fdd45ae6b2381c9f9d4e91ec5f40443530da6e35e30
Contents?: true
Size: 1.39 KB
Versions: 15
Compression:
Stored size: 1.39 KB
Contents
class G5Authenticatable::InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) # Required for Rails::Generators::Migrations def self.next_migration_number(dirname) next_migration_number = current_migration_number(dirname) + 1 ActiveRecord::Migration.next_migration_number(next_migration_number) end def mount_engine route "mount G5Authenticatable::Engine => '/g5_auth'" end def create_initializer template 'initializer.rb', 'config/initializers/g5_authenticatable.rb' end def create_users_migration copy_migration('create_g5_authenticatable_users') end def users_contact_info_migration copy_migration('add_g5_authenticatable_users_contact_info') end def create_roles_migration copy_migration('create_g5_authenticatable_roles') end def include_authorization inject_into_file 'app/controllers/application_controller.rb', after: "class ApplicationController < ActionController::Base\n" do " include G5Authenticatable::Authorization\n" end end def create_application_policy template 'application_policy.rb', 'app/policies/application_policy.rb' end def create_403_error_page template '403.html', 'public/403.html' end private def copy_migration(name) migration_template "migrate/#{name}.rb", "db/migrate/#{name}.rb" end end
Version data entries
15 entries across 15 versions & 1 rubygems