Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/2a464020c54c0ff28350 to your computer and use it in GitHub Desktop.
Save wtnabe/2a464020c54c0ff28350 to your computer and use it in GitHub Desktop.
rake dependencies for starting server outside ruby ( e.g. PythonSimpleHTTPServer ) and cleanup
require "rake/testtask"
Rake::TestTask.new do |t|
t.description = nil
t.pattern = 'spec/**/*_spec.rb'
end
desc 'start server and do spec and cleanup'
task :spec => :test do
Process.kill(:INT, @pid)
end
task :test => :start_server
task :start_server do
@pid = spawn('python', '-m', 'SimpleHTTPServer', :out => '/dev/null', :err => [:child, :out])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment