I previously had some scripts of this form:
class Thing
def do_things
...
end
end
if __FILE__ == $0
Thing.new.do_things
end
I invoked them with rails runner. They were working well on Heroku with Rails 5.1. When I upgraded to rails 5.2, they no longer ran on Heroku (silently exiting with the block not being executed). But they do still execute in my dev environment (Ubuntu).
I run them using the relative path to the script (e.g. rails runner scripts/thing.rb)
Rails 5.2
Heroku
__FILE__: the absolute path to the script (/app/scripts/thing.rb)$0: the filename (thing.rb)
Dev Environment (ubuntu)
Both contain just the filename.
Rails 5.1
In both environments, both contain just the filename.