Let’s say you have some Ruby file that you want to run on Heroku. For example, I have stuff\things.rb. The easiest way to run the file on Heroku seems to inspire ourselves from db:seeds an write a Rake task in lib/tasks/stuff_things.rake.
You can run
heroku rake stuff:things.