Sha256: d4434cb87dfaf67cce69541892fd6aba76b587de8f65adf3f71ab4677862a047
Contents?: true
Size: 804 Bytes
Versions: 2
Compression:
Stored size: 804 Bytes
Contents
require 'rails_generator' module Radiant module GeneratorBaseExtension def self.included(base) base.class_eval %{ alias_method_chain :existing_migrations, :extensions alias_method_chain :current_migration_number, :extensions } end def existing_migrations_with_extensions(file_name) Dir.glob("#{destination_path(@migration_directory)}/[0-9]*_*.rb").grep(/[0-9]+_#{file_name}.rb$/) end def current_migration_number_with_extensions Dir.glob("#{destination_path(@migration_directory)}/[0-9]*.rb").inject(0) do |max, file_path| n = File.basename(file_path).split('_', 2).first.to_i if n > max then n else max end end end end end Rails::Generator::Commands::Base.class_eval { include Radiant::GeneratorBaseExtension }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.6.1 | lib/plugins/extension_patches/lib/generator_base_extension.rb |
radiant-0.6.0 | lib/plugins/extension_patches/lib/generator_base_extension.rb |