module Rails::Generators::Migration::ClassMethods

def current_migration_number(dirname)

def current_migration_number(dirname)
  migration_lookup_at(dirname).collect do |file|
    File.basename(file).split("_").first.to_i
  end.max.to_i
end

def migration_exists?(dirname, file_name)

def migration_exists?(dirname, file_name)
  migration_lookup_at(dirname).grep(/\d+_#{file_name}.rb$/).first
end

def migration_lookup_at(dirname)

:nodoc:
def migration_lookup_at(dirname)
  Dir.glob("#{dirname}/[0-9]*_*.rb")
end

def next_migration_number(dirname)

def next_migration_number(dirname)
  raise NotImplementedError
end