Class: RakeAudit::Generators::InstallGenerator

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

Overview

Scaffolds RakeAudit into a host Rails application.

rails generate rake_audit:install

Running the generator copies a commented-out initializer to config/initializers/rake_audit.rb and writes a timestamped migration to db/migrate that creates the rake_task_executions table. The migration is produced through migration_template so the host’s schema version and migration numbering are respected.

Instance Method Summary collapse

Instance Method Details

#create_initializervoid

This method returns an undefined value.

Copy the pre-filled, fully commented initializer into the host app.



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

def create_initializer
  template 'initializer.rb', 'config/initializers/rake_audit.rb'
end

#create_migration_filevoid

This method returns an undefined value.

Generate the timestamped migration that creates the audit table.



34
35
36
37
38
39
# File 'lib/generators/rake_audit/install_generator.rb', line 34

def create_migration_file
  migration_template(
    'create_rake_task_executions.rb',
    'db/migrate/create_rake_task_executions.rb'
  )
end