Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Sep 14, 2011
1 parent ab56071 commit 3094692
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions scripts/sync_githook.js
@@ -1,42 +1,42 @@
#!/usr/bin/env node

require('colors');
var path = require('path');
var fs = require('fs');
var config = require('../config').opt;
var hosted = path.join(config.home_dir, config.hosted_apps_subdir);
var exists = path.existsSync;
var util = require('util');
process.chdir(hosted);
require('colors');

util.print('Reading git repos:'.magenta);
var src = path.join(config.app_dir, 'scripts', 'gitrepoclone.sh');
var copy = function() {
var copy = function () {
if (repos.length) {
var dest = repos.pop();
var is = fs.createReadStream(src);
var os = fs.createWriteStream(dest);
util.pump(is, os, copy);
var dest = repos.pop();
var is = fs.createReadStream(src);
var os = fs.createWriteStream(dest);
util.pump(is, os, copy);
} else {
util.print(' [done]\n'.white);
util.print(' [done]\n'.white);
}
};
};

var repos = [];
var repos = [];
var dirs = fs.readdirSync('.');
dirs.forEach(function(v) {
if (exists(v)) {
dirs.forEach(function (v) {
if (exists(v)) {
var stat = fs.statSync(v);
if (stat.isDirectory()) {
var dirs = fs.readdirSync(v);
dirs.forEach(function(i) {
if (path.extname(i) === '.git') {
repos.push(path.join(hosted, v, i, 'hooks', 'post-receive'));
}
});
if (stat.isDirectory()) {
var dirs = fs.readdirSync(v);
dirs.forEach(function (i) {
if (path.extname(i) === '.git') {
repos.push(path.join(hosted, v, i, 'hooks', 'post-receive'));
}
}
});
}
}
});
util.print((' (' + repos.length + ')').yellow + ' [done]\n'.white);
util.print('Processing git commit hooks'.magenta);
copy();

copy();

0 comments on commit 3094692

Please sign in to comment.