How to use the infusion.stringTemplate function in infusion

To help you get started, we’ve selected a few infusion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GPII / universal / tests / ProductionConfigTests.js View on Github external
}
            },
            accessTokenRequest: {
                type: "kettle.test.request.http",
                options: {
                    hostname: "flowmanager",
                    path: "/access_token",
                    method: "POST",
                    expectedStatusCode: 200
                }
            },
            lifeCycleRequest: {
                type: "kettle.test.request.http",
                options: {
                    hostname: "flowmanager",
                    path: fluid.stringTemplate("/%gpiiKey/settings/%device", {
                        gpiiKey: gpii.tests.productionConfigTesting.carlaKey,
                        device: encodeURIComponent(JSON.stringify(
                            gpii.tests.productionConfigTesting.device
                        ))}
                    ),
                    headers: {
                        "Authorization": "Bearer token" // set at test run
                    },
                    method: "GET",
                    expectedStatusCode: 200
                }
            },
            putSettingsRequestFailure: { // can't update snapset (readonly)
                type: "kettle.test.request.http",
                options: {
                    hostname: "flowmanager",
github GPII / universal / gpii / node_modules / flowManager / src / Snapshot.js View on Github external
snapshotter.getSolutions = function (matchMaker, event, device, rptmp) {
        var os = fluid.get(device, "OS.id"),
            version = fluid.get(device, "OS.version");
        var fullPath = matchMaker.options.solutionsReporterUrl;
        fullPath = fullPath.indexOf("file://") === 0 ? fullPath.substring(7) : fullPath;

        fullPath = fluid.stringTemplate(fullPath, {
            os: os,
            version: version,
            root: matchMaker.options.root
        });

        fs.readFile(fullPath, 'utf8', function (err, solutions) {
            if (err) {
                fluid.fail("FUCK OFF");
            }
            solutions = JSON.parse(solutions);
            solutions = matchMaker.prefilterSolutions(solutions, device);
            event.fire(solutions, rptmp);
        });
//         var fs = require('fs');

// var path = "C:\\tmp\\testfile.txt";
github GPII / universal / scripts / browserifyTestDependency.js View on Github external
mkdirp(browserifyDir, function () {
                var browserifyCommandTemplate = "node " + universalPath + "/node_modules/browserify/bin/cmd.js -s %module " + universalPath + "/node_modules/%moduleScript -o " + browserifyDir + "/%outputFile";

                var browserifyHttpCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "http",
                    moduleScript: "http-browserify/index.js",
                    outputFile: "http.js"
                });
                var browserifyHttpsCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "https",
                    moduleScript: "https-browserify/index.js",
                    outputFile: "https.js"
                });
                var browserifyUrlModuleCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "urlModule",
                    moduleScript: "url/url.js",
                    outputFile: "urlModule.js"
                });

                // execute browserify commands
                exec(browserifyHttpCommand);
                exec(browserifyHttpsCommand);
                exec(browserifyUrlModuleCommand);
            });
        });
github GPII / universal / scripts / browserifyTestDependency.js View on Github external
mkdirp(browserifyDir, function () {
                var browserifyCommandTemplate = "node " + universalPath + "/node_modules/browserify/bin/cmd.js -s %module " + universalPath + "/node_modules/%moduleScript -o " + browserifyDir + "/%outputFile";

                var browserifyHttpCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "http",
                    moduleScript: "http-browserify/index.js",
                    outputFile: "http.js"
                });
                var browserifyHttpsCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "https",
                    moduleScript: "https-browserify/index.js",
                    outputFile: "https.js"
                });
                var browserifyUrlModuleCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "urlModule",
                    moduleScript: "url/url.js",
                    outputFile: "urlModule.js"
                });

                // execute browserify commands
                exec(browserifyHttpCommand);
                exec(browserifyHttpsCommand);
                exec(browserifyUrlModuleCommand);
            });
        });
github GPII / universal / scripts / browserifyTestDependency.js View on Github external
mkdirp(browserifyDir, function () {
                var browserifyCommandTemplate = "node " + universalPath + "/node_modules/browserify/bin/cmd.js -s %module " + universalPath + "/node_modules/%moduleScript -o " + browserifyDir + "/%outputFile";

                var browserifyHttpCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "http",
                    moduleScript: "http-browserify/index.js",
                    outputFile: "http.js"
                });
                var browserifyHttpsCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "https",
                    moduleScript: "https-browserify/index.js",
                    outputFile: "https.js"
                });
                var browserifyUrlModuleCommand = fluid.stringTemplate(browserifyCommandTemplate, {
                    module: "urlModule",
                    moduleScript: "url/url.js",
                    outputFile: "urlModule.js"
                });

                // execute browserify commands
github GPII / universal / gpii / node_modules / launchHandler / src / LaunchHandler.js View on Github external
gpii.launchHandler.exec = function (launchHandler) {
		//if pid is set, we want to kill a running process:
		if (launchHandler.pid && launchHandler.termMap && launchHandler.termMap.pid) {
			var pid = fluid.stringTemplate(launchHandler.pid, launchHandler.termMap);
			console.log("Killing process with pid: "+pid);
			process.kill(pid);
			//TODO Error handling based on whether kill was successful
		} else if (launchHandler.command) {
			//if no pid is set, we expect at least command is set
			var spawnedProcess = child_process.spawn(launchHandler.command, launchHandler.args, launchHandler.options);
			console.log("Ran command "+launchHandler.command+" and got pid "+spawnedProcess.pid);
			return { 
				//TODO: error handling!
				//statusCode: 200,
				termMap: { 
					pid: spawnedProcess.pid
				},
				process: spawnedProcess
			};
		} else {
github GPII / universal / gpii / node_modules / gpiiFramework / dataSource.js View on Github external
var map = fluid.copy(termMap);
        map = fluid.transform(map, function (entry) {
            var encode = false;
            if (entry.indexOf(eUC) === 0) {
                encode = true;
                entry = entry.substring(eUC.length);
            }
            if (entry.charAt(0) === "%") {
                entry = fluid.get(directModel, entry.substring(1));
            }
            if (encode) {
                entry = encodeURIComponent(entry);
            }
            return entry;
        });
        var replaced = fluid.stringTemplate(url, map);
        replaced = expand(replaced);
        return replaced;
    };
github GPII / universal / gpii / node_modules / journal / src / Journal.js View on Github external
gpii.journal.journals.handleRequest = function (journal, request) {
    journal.readJournals();
    var links = fluid.transform(journal.journalFiles, function (journalFile) {
        var terms = {
            journalUrl: journal.dateToRestoreUrl(journalFile.createTime),
            journalTime: new Date(journalFile.createTime).toLocaleString(),
            crashedString: journalFile.closed ? "" : ": crashed session"
        };
        return fluid.stringTemplate(journal.options.templates.journalLink, terms);
    });
    var linkBlock = links.join("\n");
    var page = fluid.stringTemplate(journal.options.templates.listJournals, {
        journals: linkBlock
    });
    request.res.header("Content-Type", "text/html");
    request.events.onSuccess.fire(page);
};
github GPII / universal / gpii / node_modules / journal / src / Journal.js View on Github external
var links = fluid.transform(journal.journalFiles, function (journalFile) {
        var terms = {
            journalUrl: journal.dateToRestoreUrl(journalFile.createTime),
            journalTime: new Date(journalFile.createTime).toLocaleString(),
            crashedString: journalFile.closed ? "" : ": crashed session"
        };
        return fluid.stringTemplate(journal.options.templates.journalLink, terms);
    });
    var linkBlock = links.join("\n");
github GPII / universal / gpii / node_modules / gpiiFramework / utils.js View on Github external
that.expand = function (url) {
            fluid.log("urlExpander expanding url ", url);
            var expanded = fluid.stringTemplate(url, that.options.vars);
            fluid.log("urlExpander expanded: ",expanded);
            return expanded;
        };
    };