Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Created January 4, 2017 19:35
Show Gist options
  • Save peterkeen/67513dc3949d291862a8ab0b0f6ba647 to your computer and use it in GitHub Desktop.
Save peterkeen/67513dc3949d291862a8ab0b0f6ba647 to your computer and use it in GitHub Desktop.
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