Esempio n. 1
0
    status: function(json, start, end) {
        var str = (json.failed ? mods.color(bad, 'bold+red') : mods.color(good, 'bold+green')) +
            ' ' + mods.color('[' + json.name + ']:', (json.failed ? 'red' : 'blue') + '+bold') +
            ' Passed: ' + (json.passed ? mods.color(String(json.passed), 'green+bold') : json.passed) +
            ' Failed: ' + (json.failed ? mods.color(String(json.failed), 'red+bold') : json.failed) +
            ' Total: ' +  json.total +
            mods.color(' (ignored ' + json.ignored + ')', 'white'),
            s = (new Date()).getTime(),
            e = s + json.duration;

        if (json.duration) {
            str += ' (' + timethat.calc(s, e) + ')';
        }


        if (json.coverage) {
            str += cover.status(json.coverage);
        }

        if (json.consoleInfo && json.consoleInfo.length) {
            str += '\n';
            json.consoleInfo.forEach(function(line) {
                str += '    ' + mods.color(line.type + ': ', 'white') + line['arguments'].join(', ') + '\n';
            });
        }

        log.log(str);

        if (json.failed) {
            if (json.error) {
                printFail('Javascript Error', json.error);
            } else {
                Object.keys(json).forEach(function(key) {
                    var i, t, res;
                    if (typeof json[key] === 'object') {
                        for (i in json[key]) {
                            if (json[key][i].failed) {
                                for (t in json[key][i]) {
                                    if (json[key][i][t].result === 'fail') {
                                        res = json[key][i][t];
                                        printFail(res.name, res.message);
                                    }
                                }
                            } else {
                                if (json[key][i].result === 'fail') {
                                    res = json[key][i];
                                    printFail(res.name, res.message);
                                }
                            }
                        }
                    }
                });
            }
        }

        if (start && end) {
            exports.log('  [Grover Execution Timer] ' + timethat.calc(start, end));
        }

    },
Esempio n. 2
0
 readFile(GLOBAL_INDEX, function(err, d) {
     var json;
     try {
         //sometimes the json can get corrupted or missing, this catches that
         json = JSON.parse(d);
     } catch (e) {
         json = {};
     }
     json.domain = options.domain;
     if (data)  {
         if (data.json && data.json.name) {
             json.processing = data.json.name;
         }
         json.sequence = data.seq;
     }
     //This is for nagios checking..
     json.couchdb = 'Welcome';
     json.pid = process.pid;
     json.version = version;
     json.dir = options.dir;
     json.uptime = timethat(new Date(), new Date(Date.now() + (process.uptime() * 1000)));
     json.node = process.version;
     json.latestSeq = latestSeq;
     json.stamp = Date.now();
     json.date = new Date();
     json.hostname = os.hostname();
     var o = {};
     Object.keys(json).sort().forEach(function(key) {
         o[key] = json[key];
     });
     json = o;
     return writeFile(GLOBAL_INDEX, JSON.stringify(json, null, 4) + '\n', callback);
 });
Esempio n. 3
0
 return function mod_status(req, res, next) {
     var respond,
         responseText = config.text || 'OK';
     if (!config.text) {
         if (config.version) {
             responseText += ' - Node: ' + process.version;
         }
         if (config.uptime) {
             responseText += ' - Uptime: ' + timethat.calc((new Date(Date.now() - (process.uptime() * 1000))));
         }
     }
     req.parsedUrl = req.parsedUrl || url.parse(req.url, true);
     if (req.parsedUrl.pathname === config.url) {
         respond = (config.check) ? config.check(req) : true;
         if (respond) {
             res.writeHead(200, {
                 'Content-Type' : 'text/plain'
             });
             res.end(responseText);
         } else {
             res.writeHead(404, {
                 'Content-Type' : 'text/plain'
             });
             res.end('Not Found');
         }
     } else {
         next();
     }
 };
Esempio n. 4
0
 zip.finalize(function(err, written) {
     if (!written && err) {
         written = err;
     }
     log.info('created zip in ' + timer.calc(zipStart, new Date()));
     log.info(util.prettySize(written) + ' written');
     callback();
 });
Esempio n. 5
0
 util.tree(options.location, options.root, function(tree) {
     log.log('');
     log.info('module created, here\'s what yogi did for you:');
     log.log('');
     console.log(tree);
     log.info('yogi took ' + timethat.calc(start, new Date().getTime()) + ' to create this module');
     callback();
 });
Esempio n. 6
0
 git.on('exit', function(code) {
     if (code) {
         log.bail('git exited with code: ' + code);
     }
     var end = new Date();
     log.info('stole the git repo in ' + timer.calc(start, end));
     callback();
 });
Esempio n. 7
0
 end = function (err) {
     var end = new Date();
     log.info('done racing, the gears are toast');
     log.info('finished in ' + timer.calc(start, end) + ', pretty fast huh?');
     if (buildCallback) {
         buildCallback(err);
     }
 },
Esempio n. 8
0
 res.on('end', function() {
     if (callbackDone) {
         return;
     }
     log.info('[' + counter[info.path] + '] finished downloading', url, 'in', timethat(startDL));
     process.nextTick(function() {
         verify(info, callback);
     });
 })
Esempio n. 9
0
 post(options, results, function() {
     var end = (new Date());
     log.info('stole ' + count + ' modules in ' + timer.calc(start.getTime(), end.getTime()));
     if (Object.keys(options.errors).length) {
         log.warn(Object.keys(options.errors).length + ' failed to build');
         Object.keys(options.errors).forEach(function(mod) {
             log.warn(mod + ': ' + options.errors[mod]);
         });
     }
     callback(results);
 });
Esempio n. 10
0
 stack.done(function () {
     console.log('');
     var end = new Date();
     log.info('done racing, the gears are toast');
     log.info('finished in ' + timer.calc(start, end) + ', pretty fast huh?');
     if (errors.length) {
         log.warn('the following builds exited with a 1');
         errors.forEach(function (mod) {
             console.log('   ', log.color(mod, 'red'));
         });
         process.exit(1);
     }
 });
Esempio n. 11
0
File: loader.js Progetto: JT5D/yogi
    begin: function() {
        var start = new Date();
        this.scan();
        this.process();
        this.reduce();
        this.writeJSON();
        this.conditionals();
        this.writeJS();
        this.writeConds();

        log.info('done generating meta data in ' + timethat.calc(start, new Date()));

    },
Esempio n. 12
0
 child.on('exit', function (code) {
     buildRunning = false;
     var end = new Date();
     log.info('finished in ' + timer.calc(start, end) + ', pretty fast huh?');
     if (code) {
         log.err('build failed, try again..');
         if (quiet) {
             log.err('try it without --quiet next time');
         }
     } else {
         log.info('build exited with ' + code + ' you are good to go');
         log.info('finished at ' + new Date());
     }
     if (callback) {
         callback();
     }
 });
Esempio n. 13
0
		this.on("done", function() {
			var end = Date.now();

			assertively.log(timethat.calc(start, end));
		});
Esempio n. 14
0
 util.getCDNWindow(function(str) {
     log.log(' ' + str);
     log.log(' yogi completed the search in ' + timethat.calc(START, new Date()));
 });
Esempio n. 15
0
 grunt.registerTask('release-finish', 'Complete the YUI Release', function() {
     var endTime = new Date();
     grunt.log.ok('YUI Release for ' + VERSION + ' completed in ' + timethat.calc(startTime, endTime));
 });
Esempio n. 16
0
 cpr(base, artifacts, function() {
     grunt.log.ok('Finished copying artifacts in ' + timethat.calc(start));
     done();
 });
Esempio n. 17
0
 function runUpdateIndexAgain(err) {
     var num = Object.keys(json.versions).length;
     /*istanbul ignore next just a log line with logic*/
     log.info('[' + data.seq + '/' + latestSeq + '] done processing', num, 'version' + ((num > 1) ? 's' : '') + ' of', json.name, 'in', timethat(changeStart));
     exports.updateIndex(data, runAfterAll);
 }
Esempio n. 18
0
 .on('end', function() {
     log.info('Saved JSON for', modules, 'modules in', timethat(start), ', cloning tarballs now...');
     fs.writeFile(options.seqFile, update_seq, 'utf8', function() {
         tarballs(options);
     });
 });
Esempio n. 19
0
 stack.done(function() {
     var end = new Date();
     log.info(results.length + ' results gathered in ' + timer.calc(start, end));
     callback(results);
 });
Esempio n. 20
0
File: mine.js Progetto: Kiira02/yogi
 pending.forEach(function(item) {
     var stamp = (new Date());
     console.log('   ', item.module, 'has been pending for ' + timethat.calc((new Date(item.created * 1000)), stamp));
 });
Esempio n. 21
0
 fs.unlink(options.seqFile, function() {
     log.warn('finished cleaning in', timethat(start));
     callback();
 });
Esempio n. 22
0
 async.eachLimit(dirs, options.limit, save, function() {
     log.info('finished fetching', count, 'tarballs in', timethat(start));
     log.info('First clone completed, now you can follow as usual..');
 });
Esempio n. 23
0
File: info.js Progetto: Kiira02/yogi
    cdn: function(cdn) {
        var oncdn, since, self = this,
            repo = '', print;
        if (this.json.cdn) {
            if (this.json.hidden) {
                log.warn('this is a yogi only module and will be hidden from the site');
            }

            if (this.json.cdn.oncdn) {
                oncdn = new Date(this.json.cdn.oncdn * 1000);
                console.log('');
                log.log('   ' + this.json.cdn.github + '/' + self.module);
                console.log('');
                log.log('   module has been on the cdn since: ' + oncdn.toDateString());
                log.log('   last build tag pushed: ' + this.json.cdn.buildtag);
            }

            print = function() {
                log.log('');
                repo = 'git://github.com/' + self.json.cdn.github  + '/' + self.json.cdn.repo + '.git';
                if (cdn && cdn.stamp) {
                    since = (new Date(cdn.stamp * 1000)).toDateString();
                    log.log('   currently in the CDN Queue since ' + since);
                    console.log('');
                    log.log('       stamp:      ' + new Date(cdn.stamp * 1000));
                    log.log('       sha:        ' + cdn.sha1);
                    log.log('       repo:       ' + repo);
                    log.log('       message:    ' + cdn.message);
                    console.log('');
                }
                log.log('       clone this request:');
                log.log('           git clone ' + repo);
                log.log('           cd ' + path.join(self.json.cdn.repo, self.json.cdn.path));
                if (cdn && cdn.sha1) {
                    log.log('           git checkout ' + cdn.sha1.substr(0, 7));
                }
                console.log('');
                util.getCDNWindow(function(str) {
                    log.log('   ' + str);
                    console.log('');
                    self.reports();
                    console.log('');
                });
            };

            if (cdn && cdn.sha1) {
                this.checkSha(this.json.cdn.github, this.json.cdn.repo, cdn.sha1, function(status) {
                    if (status) {
                        log.info('good news! this sha is on github! that means this module "should" build for the cdn.');
                    } else {
                        log.error(cdn.sha1 + ' was not found on github, have you pushed it yet?');
                    }
                    print();
                });
            } else {
                print();
            }
        } else {
            if (!this.json.module.approved) {
                log.log('-----------------------------------------------------');
                log.warn('this module is still pending approval'.red);
                log.log('-----------------------------------------------------');
            } else {
                if (this.json.licenses[0].type === 'YUI BSD') {
                    log.warn('this module is not on the cdn');
                } else {
                    log.error('this module\'s license prohibits CDN deployment');
                    log.error('type     : ' + this.json.licenses[0].type);
                    log.error('url      : ' + this.json.licenses[0].url);
                }
            }
            console.log('');
            log.log('   ' + this.json.cdn.github + '/' + self.module);
            console.log('');
            repo = 'git://github.com/' + this.json.cdn.github + '/' + this.json.cdn.repo + '.git';
            log.log('       created: ' + (new Date(this.json.module.created * 1000)));
            if (!this.json.module.approved) {
                log.log('       pending for: ' + timethat.calc((new Date(this.json.module.created * 1000)), new Date()));
            }
            log.log('       clone this module:');
            log.log('           git clone ' + repo);
            log.log('           cd ' + path.join(this.json.cdn.repo, this.json.cdn.path));
            console.log('');
        }
    },