Skip to content

Commit

Permalink
Fixing the regex used for detecting that a generator template was a m…
Browse files Browse the repository at this point in the history
…igration (it didn't include final '.erb'). Related to the issue refineryGH-1885 about bad revisions numbering
  • Loading branch information
brenes committed Aug 17, 2012
1 parent 19de862 commit 5ed4652
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/lib/refinery/extension_generation.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def extension_path_for(path, extension, apply_tmp = true)
if options[:namespace].present? || options[:extension].present? if options[:namespace].present? || options[:extension].present?
# Increment the migration file leading number # Increment the migration file leading number
# Only relevant for nested or namespaced extensions, where a previous migration exists # Only relevant for nested or namespaced extensions, where a previous migration exists
if %r{/migrate/\d+\w*.rb\z} === path if %r{/migrate/\d+.*\.rb.erb\z} === path
if last_migration = Dir["#{destination_pathname.join(path.split(File::SEPARATOR)[0..-2].join(File::SEPARATOR), '*.rb')}"].sort.last if last_migration = Dir["#{destination_pathname.join(path.split(File::SEPARATOR)[0..-2].join(File::SEPARATOR), '*.rb')}"].sort.last
path.gsub!(%r{\d+_}) { |m| "#{last_migration.match(%r{migrate/(\d+)_})[1].to_i + 1}_" } path.gsub!(%r{\d+_}) { |m| "#{last_migration.match(%r{migrate/(\d+)_})[1].to_i + 1}_" }
end end
Expand Down

0 comments on commit 5ed4652

Please sign in to comment.