Skip to content

Commit

Permalink
Add simple support for post install files overwriting.
Browse files Browse the repository at this point in the history
  • Loading branch information
brabeji committed Jun 26, 2014
1 parent 7365692 commit 95620bb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bower-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ bower.commands
}, function(err) {
if(err) console.error(('Error:').red, err);
else {
if(cfg.replace) {
var encoding = 'utf8';
for (var item in cfg.replace) {
console.log(('\tReplacing: '+item+' -> '+cfg.replace[item]).yellow);
try {
var content = fs.readFileSync(item, encoding);
fs.writeFileSync(cfg.replace[item], content, encoding);
} catch(e) {
console.log(('\tNot found.').red);
}
}
}

if(options.remove) {
process.stdout.write('Removing bower_components dir...');
installer.removeComponentsDir(function(err) {
Expand All @@ -135,4 +148,4 @@ bower.commands
.on('error', function(error) {
process.stdout.write(("Error\r\n").red);
console.error(error);
});
});

0 comments on commit 95620bb

Please sign in to comment.