Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Created Jan 4, 2017
Embed
What would you like to do?
task :run_gist => :environment do
url = ENV['url']
raise "usage: rake run_gist url=https://gist.github.com/asdfasdfasdfasdf" 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'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment