Skip to content

Instantly share code, notes, and snippets.

@Palakis
Created August 13, 2015 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Palakis/1dc96d95e28661de5c09 to your computer and use it in GitHub Desktop.
Save Palakis/1dc96d95e28661de5c09 to your computer and use it in GitHub Desktop.
Cordova < 3.7.0 : repackage Firefox OS app (because the integrated method produces corrupted archives)
#!/usr/bin/env node
// Put this file in the hooks/after_compile folder and give it execution rights
var fs = require('fs');
var rootdir = process.argv[2];
if(rootdir) {
var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
for(var x = 0; x < platforms.length; x++) {
try {
var platform = platforms[x].trim().toLowerCase();
if(platform == 'firefoxos') {
var exec = require('child_process').exec;
// Repackager le zip foireux de "cordova compile"
console.log('Repackaging Firefox OS app');
exec("(cd platforms/firefoxos/www/ ; "+
"rm ../build/package.zip ; "+
"zip -r ../build/package.zip ./)",
function(error, stdout, stderr) {
if(error !== null) {
console.log('Error : '+error);
}
});
}
} catch(e) {
process.stdout.write(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment