/* * Jakefile * test * * Created by aparajita on March 7, 2011. * Copyright 2011, Victory-Heart Productions All rights reserved. */ var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path"), task = JAKE.task, FileList = JAKE.FileList, app = CAPPUCCINO.Jake.applicationtask.app, configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug"; app ("test", function(task) { task.setBuildIntermediatesPath(path.join("Build", "test.build", configuration)); task.setBuildPath(path.join("Build", configuration)); task.setProductName("test"); task.setIdentifier("com.aparajitaworld.test"); task.setVersion("1.0"); task.setAuthor("Victory-Heart Productions"); task.setEmail("feedback @nospam@ yourcompany.com"); task.setSummary("test"); task.setSources((new FileList("**/*.j")).exclude(path.join("Build", "**"))); task.setResources(new FileList("Resources/**")); task.setIndexFilePath("index.html"); task.setInfoPlistPath("Info.plist"); if (configuration === "Debug") task.setCompilerFlags("-DDEBUG -g"); else task.setCompilerFlags("-O"); }); task ("default", ["test"], function() { printResults(configuration); }); task ("build", ["default"]); task ("debug", function() { ENV["CONFIGURATION"] = "Debug"; JAKE.subjake(["."], "build", ENV); }); task ("release", function() { ENV["CONFIGURATION"] = "Release"; JAKE.subjake(["."], "build", ENV); }); task ("run", ["debug"], function() { cp.execSync(["open", path.join("Build", "Debug", "test", "index.html")].join(" "), { stdio: "inherit" }); }); task ("run-release", ["release"], function() { cp.execSync(["open", path.join("Build", "Release", "test", "index.html")].join(" "), { stdio: "inherit" }); }); task ("deploy", ["release"], function() { fs.mkdirSync(path.join("Build", "Deployment", "test"), { recursive: true }); cp.execSync(["press", "-f", path.join("Build", "Release", "test"), path.join("Build", "Deployment", "test")].join(" "), { stdio: "inherit" }); printResults("Deployment") }); task ("desktop", ["release"], function() { fs.mkdirSync(path.join("Build", "Desktop", "test"), { recursive: true }); require("@objj/nativehost").buildNativeHost(path.join("Build", "Release", "test"), path.join("Build", "Desktop", "test", "test.app")); printResults("Desktop") }); task ("run-desktop", ["desktop"], function() { cp.execSync([path.join("Build", "Desktop", "test", "test.app", "Contents", "MacOS", "NativeHost"), "-i"].join(" "), { stdio: "inherit" }); }); function printResults(configuration) { console.log("----------------------------"); console.log(configuration+" app built at path: "+path.join("Build", configuration, "test")); console.log("----------------------------"); }