Files
cappuccino/Tests/Manual/CSVImportTest/Jakefile
T
David Richardson 40c5c466c1 Tests: Add CSVImportTest manual application
* AppController.j: Import CSV files through CPOpenPanel into a table built from the header row.
  - Run the panel with a message and an options accessory view, or with neither.
  - Add options for a sheet, several files, a folder, and a delegate that rejects files.
  - Decode each file with a chosen encoding, or with encoding detection.
  - Assign columns to fixed fields in a sheet that shows sample values.

* CSVParser.j: Parse RFC 4180 records with any one-character delimiter, and detect the delimiter.

* main.j, Info.plist, index.html, index-debug.html, Jakefile: Add the application's entry points and build tasks.

* Resources/Samples: Add sample files in several encodings and delimiters, with files for the rejection paths.
2026-11-02 14:54:05 -06:00

96 lines
3.1 KiB
JavaScript

/*
* Jakefile
* CSVImportTest
*
* Created by David Richardson on 2026-11-02.
* Copyright David Richardson 2026.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
const cp = require("child_process");
const path = require("path");
var ENV = process.env,
task = JAKE.task,
FileList = JAKE.FileList,
app = CAPPUCCINO.Jake.applicationtask.app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
projectName = "CSVImportTest";
var buildDir = path.resolve(ENV["BUILD_PATH"] || ENV["CAPP_BUILD"] || "Build");
app (projectName, function(task)
{
ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks";
if (configuration === "Debug")
ENV["OBJJ_INCLUDE_PATHS"] = path.join(ENV["OBJJ_INCLUDE_PATHS"], configuration);
task.setBuildIntermediatesPath(path.join(buildDir, projectName + ".build", configuration));
task.setBuildPath(path.join(buildDir, configuration));
task.setProductName(projectName);
task.setIdentifier("dev.cappuccino." + projectName);
task.setVersion("1.0");
task.setAuthor("David Richardson");
task.setSummary(projectName);
task.setSources(new FileList("**/*.j").exclude(path.join("Build", "**")).exclude(path.join("Frameworks", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g -S --inline-msg-send");
else
task.setCompilerFlags("-O2");
});
task ("default", [projectName], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
configuration = ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
configuration = ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
cp.execFileSync("open", [path.join(buildDir, "Debug", projectName, "index.html")], { stdio: "inherit" });
});
task ("run-release", ["release"], function()
{
cp.execFileSync("open", [path.join(buildDir, "Release", projectName, "index.html")], { stdio: "inherit" });
});
function printResults(configuration)
{
console.log("----------------------------");
console.log(configuration + " app built at path: " + path.join(buildDir, configuration, projectName));
console.log("----------------------------");
}