class CmAdmin::Generators::InstallRoleGenerator

def create_default_role

def create_default_role
  ::CmRole.create(name: 'Admin')
  CmAdmin.config.cm_admin_models.each do |model|
    model.available_actions.each do |action|
      next if ['custom_action_modal', 'custom_action', 'create', 'update'].include?(action.name)
      ::CmRole.find_by(name: 'Admin').cm_permissions.where(ar_model_name: model.name, action_name: action.name).first_or_create!
    end
  end
  puts "Created default role"
end

def create_migration

def create_migration
  generate 'migration', 'CreateCmRole name:string'
  generate 'migration', 'CreateCmPermission action_name:string action_display_name:string ar_model_name:string scope_name:string cm_role:references'
  rake 'db:migrate'
  puts "Created migration"
end