Created
February 15, 2011 10:33
-
-
Save eliaskg/827371 to your computer and use it in GitHub Desktop.
The optimal jakefile
This file contains hidden or 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
| /* | |
| * Jakefile | |
| * YourApp | |
| * | |
| * Created by Elias Klughammer on February 14, 2011. | |
| * Copyright 2011, yourapp.com All rights reserved. | |
| */ | |
| var ENV = require("system").env, | |
| FILE = require("file"), | |
| JAKE = require("jake"), | |
| task = JAKE.task, | |
| FileList = JAKE.FileList, | |
| app = require("cappuccino/jake").app, | |
| configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", | |
| OS = require("os"); | |
| app ("YourApp", function(task) | |
| { | |
| task.setBuildIntermediatesPath(FILE.join("Build", "YourApp.build", configuration)); | |
| task.setBuildPath(FILE.join("Build", configuration)); | |
| task.setProductName("YourApp"); | |
| task.setIdentifier("com.yourapp.YourApp"); | |
| task.setVersion("1.0"); | |
| task.setAuthor("Your Name"); | |
| task.setEmail("info @nospam@ yourapp.com"); | |
| task.setSummary("YourApp"); | |
| task.setSources((new FileList("**/*.j")).exclude(FILE.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"); | |
| }); | |
| function printResults(configuration) | |
| { | |
| print("----------------------------") | |
| print(configuration+" app built at path: "+FILE.join("Build", configuration, "YourApp")); | |
| print("----------------------------") | |
| } | |
| task ("default", ["YourApp"], 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() | |
| { | |
| OS.system(["open", FILE.join("Build", "Debug", "YourApp", "index.html")]); | |
| }); | |
| task ("run-release", ["release"], function() | |
| { | |
| OS.system(["open", FILE.join("Build", "Release", "YourApp", "index.html")]); | |
| }); | |
| task ("deploy", ["release"], function() | |
| { | |
| FILE.mkdirs(FILE.join("Build", "Deployment", "YourApp")); | |
| OS.system(["press", "-f", FILE.join("Build", "Release", "YourApp"), FILE.join("Build", "Deployment", "YourApp")]); | |
| printResults("Deployment") | |
| }); | |
| task ("press", ["release"], function() | |
| { | |
| FILE.mkdirs(FILE.join("Build", "Press", "YourApp")); | |
| OS.system(["press", "-f", FILE.join("Build", "Release", "YourApp"), FILE.join("Build", "Press", "YourApp")]); | |
| }); | |
| task ("flatten", ["press"], function() | |
| { | |
| FILE.mkdirs(FILE.join("Build", "Flatten", "YourApp")); | |
| OS.system(["flatten", "-f", "--verbose", "--split", "3", "-c", "closure-compiler", FILE.join("Build", "Press", "YourApp"), FILE.join("Build", "Flatten", "YourApp")]); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment