Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve backtrace locations on error #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/seed-fu/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ def run_file(filename)
ActiveRecord::Base.transaction do
open(filename) do |file|
chunked_ruby = ''
file.each_line do |line|
line_number = 1
file.each_line.with_index do |line, index|
if line == "# BREAK EVAL\n"
eval(chunked_ruby)
eval(chunked_ruby, binding, filename, line_number)
chunked_ruby = ''
line_number = index + 2
else
chunked_ruby << line
end
end
eval(chunked_ruby) unless chunked_ruby == ''
eval(chunked_ruby, binding, filename, line_number) unless chunked_ruby == ''
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does eval automatically send the caller's binding? If not it might be best to to pass nil for binding.

Also if you do file.lineno you shouldn't need to track line_number as you do above.

end
end
end
Expand Down