Created
November 25, 2013 22:18
-
-
Save moduscreate/7649940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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