Created
January 4, 2017 19:35
-
-
Save peterkeen/67513dc3949d291862a8ab0b0f6ba647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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