Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., CTO at artsy.net, fun at playplay.io, NYC

Email Twitter LinkedIn Github

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.

namespace :stuff do

  require 'logger'

  desc 'Run stuff/things.rb'
  task :things => :environment do
    file = File.join(Rails.root, 'stuff', 'things.rb')
    puts "Runnng #{file}"
    load(file) if File.exist?(file)
  end

end

You can run heroku rake stuff:things.