class Recorder::InstallGenerator

Installs Recorder in a rails app.

Public Class Methods

next_migration_number(dirname) click to toggle source
# File lib/generators/recorder/install_generator.rb, line 43
def self.next_migration_number(dirname)
  ::ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Public Instance Methods

create_migration_file() click to toggle source
# File lib/generators/recorder/install_generator.rb, line 36
def create_migration_file
  add_or_skip_recorder_migration('create_recorder_revisions')
  add_or_skip_recorder_migration('add_number_column_to_recorder_revisions') if options.with_number_column?
  add_or_skip_recorder_migration('add_index_by_user_id_to_recorder_revisions') if options.with_index_by_user_id?
  add_or_skip_recorder_migration('add_partitions_to_recorder_revisions') if options.with_partitions?
end

Protected Instance Methods

add_or_skip_recorder_migration(template) click to toggle source
# File lib/generators/recorder/install_generator.rb, line 49
def add_or_skip_recorder_migration(template)
  migration_dir = File.expand_path('db/migrate')
  if self.class.migration_exists?(migration_dir, template)
    ::Kernel.warn "Migration already exists: #{template}"
  else
    migration_template "#{template}.rb", "db/migrate/#{template}.rb"
  end
end