require 'fileutils' #Compile all the *.js files into one file BUILD_PATH = '../../../products/drivers/browser.js' task :build do out = "/* THIS IS AN AUTOGENETARED FILE, DO NOT EDIT THIS */\n" Dir["./vendor/*.js"].each do |js| code = File.read(js) out << code out << "\n" end Dir["*.js"].each do |js| code = File.read(js) out << code out << "\n" end Dir.chdir File.dirname(__FILE__) do FileUtils.rm_f BUILD_PATH FileUtils.mkdir_p File.dirname(BUILD_PATH) File.write BUILD_PATH, out end end