namespace :teatime do

desc 'Generates test_helper and Teafile with default settings'
task :init do
  template_root = File.expand_path File.join('..', 'templates'), __FILE__

  test_root = File.join('test', 'javascripts')
  FileUtils.mkdir_p test_root

  test_helper = File.join('test', 'javascripts', 'test_helper.js')
  teafile = 'Teafile'

  if !File.exist?(test_helper)
    FileUtils.cp File.join(template_root, 'test_helper.js'), test_helper 
    puts "created #{test_helper.inspect}"
  end

  if !File.exist?(teafile)
    FileUtils.cp File.join(template_root, 'Teafile'), teafile 
    puts "created #{teafile.inspect}"
  end
end

desc 'Serves the testsuite'
task :serve do
  require 'teatime/server'

  Teatime::Server.run!
end

end