Class: Roleable::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



17
18
19
# File 'lib/generators/roleable/install/install_generator.rb', line 17

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

Instance Method Details

#generate_installObject



10
11
12
13
14
15
# File 'lib/generators/roleable/install/install_generator.rb', line 10

def generate_install
  copy_file 'role.rb', 'app/models/role.rb'
  copy_file 'applied_role.rb', 'app/models/applied_role.rb'
  copy_file 'initializer.rb', 'config/initializers/roleable.rb'
  migration_template 'migration.rb', 'db/migrate/roleable_create_roles_and_applied_roles.rb'
end