Skip to content

Instantly share code, notes, and snippets.

@alivedise
Created December 15, 2015 08:42
Show Gist options
  • Save alivedise/411d3b2c785ae061064b to your computer and use it in GitHub Desktop.
Save alivedise/411d3b2c785ae061064b to your computer and use it in GitHub Desktop.
Bowerize
// This script will create a bower config and a git tag into all gaia libraries.
require('shelljs/global');
require('shelljs/make');
var IGNORE_LIST = ['uranus', 'gaia', 'kronos', 'B2G', 'Applications', 'Library', 'MyPlayground.playground', 'activation-server', 'base', 'experimental'];
cd('..');
ls('.').forEach(function(appdir) {
cd('/Users/alive/Projects');
if (test('-d', appdir)) {
console.log('looking ' + appdir);
cd(appdir);
} else {
return true;
}
if (test('-e', 'manifest.webapp')) {
console.log('Not a library');
return true;
}
if (test('-d', 'shared')) {
console.log('Already has shared folder');
return true;
}
if (test('-e', '.bowerrc')) {
console.log('Already has bowerrc');
return true;
}
if (IGNORE_LIST.indexOf(appdir) >= 0) {
console.log('Ignore');
return true;
}
console.log('===Bowerize ' + appdir + '====');
exec('cp -av /Users/alive/Projects/kronos/.bowerrc .');
exec('cp -av /Users/alive/Projects/kronos/bower.json .');
exec('cp -av /Users/alive/Projects/kronos/_package.json package.json');
exec('sed -i "" \'s/NAME/' + appdir + '/g\' bower.json');
exec('sed -i "" \'s/NAME/' + appdir + '/g\' package.json');
exec('git add bower.json');
exec('git add package.json');
exec('git add .bowerrc');
exec('git commit -a -m "add package config"');
exec('git push origin master');
exec('git tag -a v0.0.1 -m "version v0.0.1"');
exec('git push origin v0.0.1');
console.log('===lib: ' + appdir + ' bowered ====');
cd('..');
exec('mv ' + appdir + ' Library/');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment