class Feste::Generators::InstallGenerator

Public Class Methods

next_migration_number(dirname) click to toggle source
# File lib/generators/feste/install_generator.rb, line 13
def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  if ActiveRecord::Base.timestamped_migrations
    [
      Time.now.utc.strftime("%Y%m%d%H%M%S"),
      "%.14d" % next_migration_number
    ].max
  else
    "%.3d" % next_migration_number
  end
end

Public Instance Methods

copy_migration() click to toggle source
# File lib/generators/feste/install_generator.rb, line 25
def copy_migration
  migration_template(
    "install.rb",
    "db/migrate/install_feste.rb",
    migration_version: migration_version
  )
end
migration_version() click to toggle source
# File lib/generators/feste/install_generator.rb, line 33
def migration_version
  if ActiveRecord::VERSION::MAJOR >= 5
    "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
  end
end