Navigation Menu

Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
jhugman committed Oct 8, 2014
1 parent 5cb4ebe commit e11c964
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions bin/install-me.js
Expand Up @@ -7,48 +7,54 @@ var path = require("path"),
kirinHomePath = path.resolve(__dirname, "..");

function finish() {
console.log("Now tell Eclipse and XCode that KIRIN_HOME = " + kirinHomePath);
console.log("Now tell Eclipse and XCode that KIRIN_HOME = " + kirinHomePath);
}

console.log("Updating android projects with the android command");
childProcess.exec("android list | grep -o android-[0-9]* | sort | head -n 1", function (error, stdout, sterr) {

childProcess.exec("" +
"android list" +
" | grep -o android-[1-9][0-9]*" +
" | grep -o [1-9][0-9]*" +
" | sort -nr | head -n 1" +
"", function (error, stdout, sterr) {

if (sterr) {
console.error("Cannot run the android command. You'll need to update the projects manually");
console.error(sterr.toString());
finish();
return;
}
var target=stdout.toString(),

var target="android-" + stdout.toString().replace(/\n+/g, ""),
projectDirectories = _.filter(findit.sync(kirinHomePath), function (t) {
return t.indexOf("android") > 0 && t.indexOf(".project") > 0;
return t.indexOf("android") > 0 && t.indexOf(".project") > 0;
}),
counter = projectDirectories.length;

console.log("Updating to " + target + ":");

_.each(projectDirectories, function (file) {
var dir = path.dirname(file),
projectProperties = path.join(dir, "project.properties");

console.log(" " + dir);
fileContents = fs.readFileSync(projectProperties).toString(),
isLibraryProject = fileContents.indexOf("android.library=true") > 0,
whatToUpdate = isLibraryProject ? "lib-project" : "project --subprojects",
androidUpdateProjectCommand = "android update " + whatToUpdate + " --path " + dir + " --target " + stdout;
androidUpdateProjectCommand = "android update " + whatToUpdate + " --path " + dir + " --target " + target;

childProcess.exec(androidUpdateProjectCommand, function(error, stdout, stderr) {
if (error !== null) {
console.error("Canot run android update project on the new android app", error);
}
counter --;
if (counter == 0) {
finish();
finish();
}

});

});



});

0 comments on commit e11c964

Please sign in to comment.