1 require 'rails_generator'
3 module GeneratorBaseExtension
4 def self.included(base)
6 alias_method_chain :existing_migrations, :extensions
7 alias_method_chain :current_migration_number, :extensions
11 def existing_migrations_with_extensions(file_name)
12 Dir.glob("#{destination_path(@migration_directory)}/[0-9]*_*.rb").grep(/[0-9]+_#{file_name}.rb$/)
15 def current_migration_number_with_extensions
16 Dir.glob("#{destination_path(@migration_directory)}/[0-9]*.rb").inject(0) do |max, file_path|
17 n = File.basename(file_path).split('_', 2).first.to_i
18 if n > max then n else max end
23 Rails::Generator::Commands::Base.class_eval { include Radiant::GeneratorBaseExtension }