Tests: Configure manual test applications with explicit themes and theme tasks

* Tests/Manual/*/Info.plist: Set CPDefaultTheme to Aristo3 across all manual test applications, including those previously overriding to Aristo2.

* Tests/Manual/*/Jakefile: Add an orchestration task to update CPDefaultTheme (e.g., npx jake theme "Aristo3 Dark"). For testing convenience.

* Tests/Manual/*/Jakefile (Narwhal format): Migrate module imports and execution calls to Node equivalents from the capp application template, and remove syntax artifacts.
This commit is contained in:
David Richardson committed 2026-11-03 19:17:05 -06:00
1 parent 5b170d4f6c
commit bf9e158390
314 files changed
+9024 -960

No files matched your search

@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>ArrayControllerInitialSelectionTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>ArrayControllerRemovingFirstTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>ArrayController</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>TestSheet</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>FullOfSheet</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>BindingContentArrayTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>cgcanvascontext</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CGPath</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -106,3 +106,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPAlertTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPAnimatablePropertyContainerTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPAnimationContextTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+72 -21
View File
@@ -6,9 +6,10 @@
* Copyright 2017, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -105,7 +106,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", configuration, projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", configuration, projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -116,7 +117,7 @@ function updateApplicationSize()
if (configuration === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -133,7 +134,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -149,37 +150,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -192,3 +193,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPAnimationTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleVersion</key>
<string>1.0</string>
<key>CPHumanReadableCopyright</key>
+72 -21
View File
@@ -1,6 +1,7 @@
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -97,7 +98,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -108,7 +109,7 @@ function updateApplicationSize()
if (ENV["CONFIGURATION"] === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -125,7 +126,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -141,37 +142,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -184,3 +185,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPBinder-echo-bug</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPBoxCibTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleVersion</key>
<string>1.0</string>
<key>CPHumanReadableCopyright</key>
+1 -1
View File
@@ -5,7 +5,7 @@
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPDefaultTheme</key>
<string>Aristo2</string>
<string>Aristo3</string>
<key>CPBundleName</key>
<string>CPBox</string>
</dict>
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPBrowserTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -89,3 +89,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPButtonBarTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -89,3 +89,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>GridDrawingTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPByteCountFormatter</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPCollectionViewNibTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPColor-CPImage-description</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPColorWellBindings</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPControlPerformClickExceptionTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+72 -21
View File
@@ -6,9 +6,10 @@
* Copyright 2014, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -105,7 +106,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -116,7 +117,7 @@ function updateApplicationSize()
if (ENV["CONFIGURATION"] === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -133,7 +134,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -149,37 +150,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -192,3 +193,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CursorTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+56 -4
View File
@@ -6,10 +6,12 @@
* Copyright 2009, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
task = require("jake").task,
FileList = require("jake").FileList,
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";
@@ -46,3 +48,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPDateFormatterTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -10,5 +10,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPDatePickerTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPDictionaryControllerTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CappDoc</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleDocumentTypes</key>
<array>
<dict>
@@ -6,19 +6,20 @@
* Copyright 2012, Your Company All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
var ENV = process.env,
cp = require("child_process"),
fs = require("fs"),
path = require("path"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
app = CAPPUCCINO.Jake.applicationtask.app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("CappDoc", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CappDoc.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setBuildIntermediatesPath(path.join("Build", "CappDoc.build", configuration));
task.setBuildPath(path.join("Build", configuration));
task.setProductName("CappDoc");
task.setIdentifier("com.yourcompany.CappDoc");
@@ -26,7 +27,7 @@ app ("CappDoc", function(task)
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CappDoc");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setSources((new FileList("**/*.j")).exclude(path.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
@@ -59,38 +60,38 @@ task ("release", function()
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "CappDoc", "index.html")]);
cp.execSync(["open", path.join("Build", "Debug", "CappDoc", "index.html")].join(" "), { stdio: "inherit" });
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CappDoc", "index.html")]);
cp.execSync(["open", path.join("Build", "Release", "CappDoc", "index.html")].join(" "), { stdio: "inherit" });
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CappDoc"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Deployment", "CappDoc")]);
fs.mkdirSync(path.join("Build", "Deployment", "CappDoc"), { recursive: true });
cp.execSync(["press", "-f", path.join("Build", "Release", "CappDoc"), path.join("Build", "Deployment", "CappDoc")].join(" "), { stdio: "inherit" });
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CappDoc"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app"));
fs.mkdirSync(path.join("Build", "Desktop", "CappDoc"), { recursive: true });
require("@objj/nativehost").buildNativeHost(path.join("Build", "Release", "CappDoc"), path.join("Build", "Desktop", "CappDoc", "CappDoc.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app", "Contents", "MacOS", "NativeHost"), "-i"]);
cp.execSync([path.join("Build", "Desktop", "CappDoc", "CappDoc.app", "Contents", "MacOS", "NativeHost"), "-i"].join(" "), { stdio: "inherit" });
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CappDoc"));
print("----------------------------");
console.log("----------------------------");
console.log(configuration+" app built at path: "+path.join("Build", configuration, "CappDoc"));
console.log("----------------------------");
}
task ("clean", function()
@@ -102,3 +103,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CappDoc</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleDocumentTypes</key>
<array>
<dict>
@@ -6,19 +6,20 @@
* Copyright 2012, Your Company All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
var ENV = process.env,
cp = require("child_process"),
fs = require("fs"),
path = require("path"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
app = CAPPUCCINO.Jake.applicationtask.app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("CappDoc", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CappDoc.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setBuildIntermediatesPath(path.join("Build", "CappDoc.build", configuration));
task.setBuildPath(path.join("Build", configuration));
task.setProductName("CappDoc");
task.setIdentifier("com.yourcompany.CappDoc");
@@ -26,7 +27,7 @@ app ("CappDoc", function(task)
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CappDoc");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setSources((new FileList("**/*.j")).exclude(path.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
@@ -59,38 +60,38 @@ task ("release", function()
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "CappDoc", "index.html")]);
cp.execSync(["open", path.join("Build", "Debug", "CappDoc", "index.html")].join(" "), { stdio: "inherit" });
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CappDoc", "index.html")]);
cp.execSync(["open", path.join("Build", "Release", "CappDoc", "index.html")].join(" "), { stdio: "inherit" });
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CappDoc"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Deployment", "CappDoc")]);
fs.mkdirSync(path.join("Build", "Deployment", "CappDoc"), { recursive: true });
cp.execSync(["press", "-f", path.join("Build", "Release", "CappDoc"), path.join("Build", "Deployment", "CappDoc")].join(" "), { stdio: "inherit" });
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CappDoc"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app"));
fs.mkdirSync(path.join("Build", "Desktop", "CappDoc"), { recursive: true });
require("@objj/nativehost").buildNativeHost(path.join("Build", "Release", "CappDoc"), path.join("Build", "Desktop", "CappDoc", "CappDoc.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app", "Contents", "MacOS", "NativeHost"), "-i"]);
cp.execSync([path.join("Build", "Desktop", "CappDoc", "CappDoc.app", "Contents", "MacOS", "NativeHost"), "-i"].join(" "), { stdio: "inherit" });
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CappDoc"));
print("----------------------------");
console.log("----------------------------");
console.log(configuration+" app built at path: "+path.join("Build", configuration, "CappDoc"));
console.log("----------------------------");
}
task ("clean", function()
@@ -102,3 +103,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPFormatterTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPGraphicsTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPImageAndTextViewImageScaling</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleVersion</key>
<string>1.0</string>
<key>CPHumanReadableCopyright</key>
@@ -6,9 +6,10 @@
* Copyright 2020, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -93,7 +94,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", configuration, projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", configuration, projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -104,7 +105,7 @@ function updateApplicationSize()
if (configuration === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -121,7 +122,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -137,37 +138,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -180,3 +181,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPImageViewScaling</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPImageViewTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPImageViewbindingsTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPLanguageModelChatbot</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPLevelIndicator</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
+50
View File
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPTextViewTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPLocalizationTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleVersion</key>
<string>1.0</string>
<key>CPHumanReadableCopyright</key>
+72 -21
View File
@@ -6,9 +6,10 @@
* Copyright 2015, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -105,7 +106,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", configuration, projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", configuration, projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -116,7 +117,7 @@ function updateApplicationSize()
if (configuration === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -133,7 +134,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -149,37 +150,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", configuration, projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -192,3 +193,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>nib2cibAlignmentTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPTextViewTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPMenuCALayerTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPMenuTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>menu-keyequivs</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPMenuRemoveAllTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPMenuTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPMenuTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+50
View File
@@ -101,3 +101,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>outlineview</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
+56 -4
View File
@@ -6,10 +6,12 @@
* Copyright 2010, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
task = require("jake").task,
FileList = require("jake").FileList,
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";
@@ -46,3 +48,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,5 +6,7 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPOutlineViewViewBasedCibTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
</dict>
</plist>
@@ -102,3 +102,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPPanelTest</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleVersion</key>
<string>1.0</string>
<key>CPHumanReadableCopyright</key>
+72 -21
View File
@@ -6,9 +6,10 @@
* Copyright 2014, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -105,7 +106,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -116,7 +117,7 @@ function updateApplicationSize()
if (ENV["CONFIGURATION"] === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -133,7 +134,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -149,37 +150,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -192,3 +193,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
+2
View File
@@ -6,6 +6,8 @@
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPPlatformWindow</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPBundleVersion</key>
<string>1.0</string>
<key>CPHumanReadableCopyright</key>
+72 -21
View File
@@ -6,9 +6,10 @@
* Copyright 2014, Your Company All rights reserved.
*/
var ENV = process.env, cp = require("child_process"), fs = require("fs"), path = require("path");,
FILE = require("file"),
JAKE = require("jake"),
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,
@@ -105,7 +106,7 @@ function updateApplicationSize()
{
console.log("Calculating application file sizes...");
var contents = FILE.read(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
var contents = fs.readFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { encoding: "utf8" }),
format = CFPropertyList.sniffedFormatOfString(contents),
plist = CFPropertyList.propertyListFromString(contents),
totalBytes = {executable:0, data:0, mhtml:0};
@@ -116,7 +117,7 @@ function updateApplicationSize()
if (ENV["CONFIGURATION"] === "Debug")
frameworksDir = path.join(frameworksDir, "Debug");
var frameworks = FILE.list(frameworksDir);
var frameworks = fs.existsSync(frameworksDir) ? fs.readdirSync(frameworksDir) : [];
frameworks.forEach(function(framework)
{
@@ -133,7 +134,7 @@ function updateApplicationSize()
else
themePath = path.join("Frameworks", "Resources", themeName + ".blend");
if (FILE.isDirectory(themePath))
if (fs.existsSync(themePath) && fs.lstatSync(themePath).isDirectory())
addBundleFileSizes(themePath, totalBytes);
// Add sizes for the app
@@ -149,37 +150,37 @@ function updateApplicationSize()
plist.setValueForKey("CPApplicationSize", dict);
FILE.write(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
fs.writeFileSync(path.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { encoding: "utf8" });
}
function addBundleFileSizes(bundlePath, totalBytes)
{
var bundleName = FILE.basename(bundlePath),
var bundleName = path.basename(bundlePath),
environment = bundleName === "Foundation" ? "Objj" : "Browser",
bundlePath = path.join(bundlePath, environment + ".environment");
if (FILE.isDirectory(bundlePath))
if (fs.existsSync(bundlePath) && fs.lstatSync(bundlePath).isDirectory())
{
var filename = bundleName + ".sj",
filePath = new FILE.Path(path.join(bundlePath, filename));
filePath = path.join(bundlePath, filename);
if (filePath.exists())
totalBytes.executable += filePath.size();
if (fs.existsSync(filePath))
totalBytes.executable += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "dataURLs.txt"));
filePath = path.join(bundlePath, "dataURLs.txt");
if (filePath.exists())
totalBytes.data += filePath.size();
if (fs.existsSync(filePath))
totalBytes.data += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLData.txt"));
filePath = path.join(bundlePath, "MHTMLData.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
filePath = new FILE.Path(path.join(bundlePath, "MHTMLPaths.txt"));
filePath = path.join(bundlePath, "MHTMLPaths.txt");
if (filePath.exists())
totalBytes.mhtml += filePath.size();
if (fs.existsSync(filePath))
totalBytes.mhtml += fs.lstatSync(filePath).size;
}
}
@@ -192,3 +193,53 @@ task ("clobber", ["clean"], function()
{
cp.execSync("rm -rf Frameworks", { stdio: "inherit" });
});
/*
Sets the theme this application uses, for example:
npx jake theme Aristo2
npx jake theme "Aristo3 Dark"
The name is written to CPDefaultTheme in Info.plist as given, with its case
kept and &, < and > escaped. Empty the browser cache afterwards, because the
browser keeps the old Info.plist.
Jake runs each word on the command line as a task, in order, and looks a task
up only when it reaches it. So this task declares the theme name as an empty
task, which Jake then runs without effect. A name that is already a task is
refused, because Jake would run that task after this one. So is a name that
starts with ^ or jake:, which Jake reads as a task scope.
*/
JAKE.task ("theme", function()
{
var fs = require("fs"),
path = require("path"),
themeName = process.argv[process.argv.indexOf("theme") + 1],
plistPath = path.join(__dirname, "Info.plist"),
themeKey = /(<key>CPDefaultTheme<\/key>\s*<string>)[^<]*(<\/string>)/;
if (!themeName || !themeName.trim())
throw new Error("Give a theme name, for example: npx jake theme \"Aristo3 Dark\"");
if (/^(\^|jake:)/.test(themeName))
throw new Error("A theme name cannot start with ^ or jake:, which Jake reads as a task scope");
if (JAKE.application().lookup(themeName))
throw new Error(themeName + " is a task in this Jakefile, not a theme name");
var plist = fs.readFileSync(plistPath, "utf8"),
plistValue = themeName.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
if (!themeKey.test(plist))
throw new Error("No CPDefaultTheme key in " + plistPath);
plist = plist.replace(themeKey, function(match, head, tail)
{
return head + plistValue + tail;
});
fs.writeFileSync(plistPath, plist);
JAKE.task(themeName);
console.log("Theme set to " + themeName + " in " + plistPath);
});
@@ -6,6 +6,8 @@
<string>AppController</string>
<key>CPBundleName</key>
<string>CPPlattformWindowMinSize</string>
<key>CPDefaultTheme</key>
<string>Aristo3</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
Loaded 100 of 314 files, more files were not shown because too many files have changed in this diff. Show more