var
  schedule = require('node-schedule'),
  tweet = require('./tweet'),
  syncTask = require('./tasks/sync');

// Tasks to run on startup
syncTask.run();

// Update entries every 30 minutes and boot
schedule.scheduleJob('0,30 * * * *', function () {
  syncTask.run();
});

// Events
syncTask.on('new component', function (model) {
  tweet(model, function (err, reply) {
    if (err) { }
  });
});

var
  schedule = require('node-schedule'),
  tweet = require('./tweet'),
  logger = require('./logger'),
  syncTask = require('./tasks/sync');

// Tasks to run on startup
runSync();

// Update entries every 30 minutes and boot
schedule.scheduleJob('0,30 * * * *', runSync);

function runSync () {
  logger.debug.info('SYNC: Running');
  syncTask.run(function (err) {
    if (!err) {
      logger.debug.info('SYNC: Completed');
    } else {
      logger.debug.error('SYNC: Completed, ' + err.length + ' errors found', err[0]);
    }
  });
}

// Events
syncTask.on('new component', function (model) {
  tweet(model, function (err, reply) {
    if (!err) {
      logger.debug.info('TWEET: Tweeted ' + model.repo);
    } else {
      logger.debug.error('TWEET: Attempted to tweet ' + model.repo, err);
    }
  });
});

Add sync logging and tweet logging
Add sync logging and tweet logging
