Skip to content

Instantly share code, notes, and snippets.

Created Jan 4, 2017
What would you like to do?
task :run_gist => :environment do
url = ENV['url']
raise "usage: rake run_gist url=" unless url.present?
dir = Dir.mktmpdir
system("git clone #{url} #{dir}")
Dir.chdir(dir) do
raise "Gist does not have a script.rb file to execute" unless File.exists?('script.rb')
$0 = 'script.rb'
Kernel.load 'script.rb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment