UNPKG

tgomadev

Version:

A package to expediate and simplify tgoma game development

59 lines (46 loc) 1.46 kB
var fse = require('fs-extra'); var path = require("path"); var packPath = path.join.bind(path, __dirname, "/.."); // the path of the tgoma dev directory console.log(packPath('templateCache')) var keepGit; var gitFileExp = function(stringm){ return keepGit || !(stringm.match(new RegExp('\.git\w*'))) } /* copy from the tgomaGameDevPack package directory the template, throwing an error listing valid templates if the template given does not exist */ function getTemplate(template){ fse.copy(packPath("templateCache/"+template), ".", { clobber:true, filter:gitFileExp }, function (err) { if (err) { return console.error("Invalid template given: ", err); } console.log('done!'); }); } function prepareTgomaProj(){ //create tgomaproj json var projfile = fse.outputJsonSync("tgomaproj.json", { ftpOpts:{ username: "tgomadev", password: "tgomadev", host: "10.33.1.135", port: 2121, localRoot: ".", remoteRoot: "/sdcard/Android/data/com.tgoma.trampolineapp.sandbox/files/www/mygame", exclude: ['.git', 'src', "tsdefs", 'scripts', ".git*"] } } ); } function main(template, keepGit){ console.log("template selected", template); keepGit = keepGit getTemplate(template) prepareTgomaProj() } module.exports = main;