require "rails/generators" module ActiveAudit class InstallGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) def create_migration_file timestamp = [Time.now.utc.strftime("%Y%m%d%H%M%S"), "_"].join copy_file("install_migration.rb", "db/migrate/#{timestamp if ActiveRecord::Base.timestamped_migrations }create_audits.rb") end def copy_initializer_file copy_file("install_initializer.rb", "config/initializers/active_audit.rb") end def copy_model_file copy_file("install_model.rb", "app/models/audit.rb") end end end