Skip to content

Commit

Permalink
Merge pull request #20 from vinted/fix/rails_7_1_changes
Browse files Browse the repository at this point in the history
Adjust checks to changes in rails 7.1
  • Loading branch information
maarsvin authored Sep 11, 2024
2 parents 65716f5 + 5d33de5 commit d58b028
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pronto-rails_migrations (0.14.4)
pronto-rails_migrations (0.15.0)
faraday (>= 1.10.3)
multipart-post (>= 2.1.1)
pronto (>= 0.11.1)
Expand Down
6 changes: 3 additions & 3 deletions lib/pronto/rails_migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ def bad_structure_sql_messages

structure_sql = File.read(patch.new_file_full_path)
inserts = structure_sql.split("\n").grep(/\('\d+'\)/)
unordered_inserts = (inserts.sort != inserts)
unordered_inserts = (inserts.sort.reverse != inserts)

*all_but_tail, tail = inserts
bad_semicolons = all_but_tail.any? { |line| line.end_with?(';') } || !tail.end_with?(';')

bad_ending = structure_sql[-4, 4] !~ /[^\n]\n\n\n/
bad_ending = structure_sql[-2, 2] !~ /[^\n]\n/

messages = []

Expand All @@ -59,7 +59,7 @@ def bad_structure_sql_messages
'last insert must end with semicolon (`;`).'
)
end
messages << message(patch, '`db/structure.sql` must end with 2 empty lines.') if bad_ending
messages << message(patch, '`db/structure.sql` must end without extra empty lines.') if bad_ending

messages
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pronto/rails_migrations/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Pronto
RAILS_MIGRATIONS_VERSION = '0.14.4'
RAILS_MIGRATIONS_VERSION = '0.15.0'
end

0 comments on commit d58b028

Please sign in to comment.