Skip to content

Instantly share code, notes, and snippets.

@moduscreate
Created November 25, 2013 22:18
Show Gist options
  • Save moduscreate/7649940 to your computer and use it in GitHub Desktop.
Save moduscreate/7649940 to your computer and use it in GitHub Desktop.
require('./AbstractTask');
Ext.define('tasks.GetSenchaProjectName', {
extend : 'tasks.AbstractTask',
singleton : true,
run : function() {
var me = this,
file = 'html5/app.json',
jsonData;
fs.readFile(file, 'utf8', function(err, fileData) {
if (err) {
me.dieWithMessage('Could not read ' + file + '!');
}
try {
console.log(typeof fileData);
jsonData = Ext.decode(fileData);
}
catch (e) {
me.dieWithMessage('Contents of ' + file + ' does not seem to be valid JSON! \n ' + fileData);
}
me.onAfterRun(jsonData);
});
},
onAfterRun : function(jsonData) {
// remove new line character
var projName = global.projName = jsonData.name;
global.senchaBuildDir = 'html5/build/' + projName + '/' + global.configData.senchaBuildTarget;
console.info(global.senchaBuildDir);
this.finish();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment