Beispiel #1
0
 }).listen(devServerPort, "localhost", function(err) {
   if(err) {
     errors.breaking(err);
     throw new gutil.PluginError("webpack-dev-server", err)
   };
   clog.info("webpack dev server started: http://localhost:" + devServerPort + "/");
 });
Beispiel #2
0
 .use(function (files, metalsmith, done) {
   if (errors.count > 0) {
     clog.error("There were " + errors.count + " errors with this build. You'll need to fix them before continuing.");
     process.exit(1);
   } else {
     clog.info('Build is clean! Hurray!');
   }
   done();
 })
Beispiel #3
0
module.exports.init = function (transFile, force) {
  force = force || false;
  
  if (!force && fs.existsSync(transFile)) {
    clog.error('Refusing to overwrite an existing translation file.');
    throw new Error('File exists');
  } else {
    fs.writeFileSync(transFile, '{}');
    clog.info('Created empty translation file.');
  }
};
Beispiel #4
0
 }, function _callback(err, data) {
   if (err) {
     callback(err);
   }
   
   clog.info('Got random', data.random[0]);
   clog.info('Got colors', data.colors);
   
   apollo = new ApollonianGasket({
     size: size
   , depth: 4
   , palette: data.colors
   , random: data.random[0]
   });
   
   apollo.draw().toBuffer(function (err, buf) {
     callback(err, {
       buffer: buf,
       random: data.random[0],
       palette: data.colors
     });
   });
 });
 return function (str, params) {
   if (params.context && typeof params.context === 'string' && !params.context.isBlank()) {
     var ctx = params.context.toUpperCase();
     
     if (translated[ctx] != null) {
       if (str !== translated[ctx].original) {
         clog.info('Translation for {0} needs to be updated.'.format(ctx));
         
         translated[ctx].original = str;
         translated[ctx].fuzzy = true;
       }
       
       if (translated[ctx].fuzzy === true) {
         clog.warn('Using fuzzy translation for {0}: please translate it or remove the fuzzy marker.'.format(ctx));
       }
       
       if (params.markdown === 'no') {
         return translated[ctx].translated.replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
       } else {
         return marked(translated[ctx].translated).replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
       }
     } else {
       clog.warn('Missing translation for {0}, source string will be used.'.format(ctx));
       
       translated[ctx] = {
         original: str,
         translated: str,
         fuzzy: true
       };
       
       if (params.markdown === 'no') {
         return str.replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
       } else {
         return marked(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
       }
     }
   } else {
     clog.error('Fatal: missing context for translation.');
     clog.debug('Current translation is ' + str);
     throw new Error('Missing context for translation');
   }
 };
Beispiel #6
0
 db.get(key, function (err, doc) {
   if (err) {
     if (err && err.status_code === 404) {
       clog.info('Generating new avatar for key', key);
       next();
     } else {
       clog.error('CouchDB.get Error', err);
       next(err);
     }
   } else {
     clog.debug('force', force, doc.token);
     
     if (force && force === doc.token) {
       req.doNotSendEmail = true;
       
       db.destroy(doc._id, doc._rev, function (err) {
         if (err) {
           return next(err);
         } else {
           return next();
         }
       });
       
     } else {
       url = utils.makeImageURL(CDN_DOMAIN, key);
       
       if (printUrl) {
         res.statusCode = 200;
         res.write(url);
         res.end();
       } else if (printMeta) {
         res.statusCode = 200;
         res.setHeader('Content-Type', 'application/json');
         res.write(JSON.stringify({ url: url, meta: doc.meta || {}, created_on: doc.created_on }));
         res.end();
       } else {
         utils.redirectKey(res, url);
       }
     }
   }
 });
Beispiel #7
0
    , callback = function(err, res) {
      if (err) {
        clog.error(res && res.code || 'unknown', res && res.message || res);
        failure++;
      }

      if (test.ok(res)) {
        clog.info('ok');
        success++;
      } else if(!err) {
        clog.warn('not ok', res);
        failure++;
      }

      if (units.length) {
        run(units);
      } else {
        scribd.delete(function(err, res) {
          clog('Test finished', 'success ' + success + ', failure ' + failure);
        }, params.docId);
      }
    };
Beispiel #8
0
db.member.find().toArray(function(err, result){
	clog.info("2. 모든 member 컬렉션의 문서 조회: " + util.inspect(result));
});
/**
 * Creates a Database
 * @param {String} name    Name of the collection
 * @param {Object} options Database options
 */
function DataStore(name, options) {
  name = name || "db-" + new Date().getTime();

  if (name in _cache) {
    LOG.info("Returning DataStore " + name + " from cache");
    return _cache[name];
  } else {
    options = options || {};
    var _dbDir = options.path || DEFAULT_DB_DIR;
    var _persistenceDelay = options.delay || DEFAULT_PERSISTENCE_DELAY;
    var _shouldPersist = options.persist || DEFAULT_SHOULD_PERSIST;
    var _path = _dbDir + '/' + name + '.json';

    var _store;
    if (fs.existsSync(_path)) {
      try { _store = require(_path); } 
      catch (dbReadError) {
        LOG.warn("Database (" + name + ") is corrupt. Re-creating it");
      }
    }

    _store = Object.extended(_store);
    LOG.info("Creating DataStore '" + name + "' on disk at: " + _path);

    /**
     * Persists database on disk
     * @private
     * @param  {Boolean} isRecurring Boolean that tells us whether to persist to disk at regular intervals or not
     * @return {void}
     */
    function _persist(isRecurring) {
      LOG.debug("Saving DataStore " + name + " to disk: " + _path);
      fs.writeFile(_path, JSON.stringify(_store), function(dbWriteError) {
        if (dbWriteError) {
          LOG.error("There was an error writing DB to disk: " + _path);
          return;
        }

        if (_shouldPersist && isRecurring) {
          setTimeout(_persist, _persistenceDelay, isRecurring);
        }
      }); 
    };

    // Persist Database on process exit and at regular intervals
    if (_shouldPersist) {
      _persist(true);
    }

    /**
     * Closes the Database and doesn't persist after invoking
     * @public
     * @return {void}
     */
    _store.close = function() {
      LOG.debug("Closing Database (" + name + ")");
      _shouldPersist = false;
    };

    return _cache[name] = _store;
  }
}
Beispiel #10
0
 vim.on('exit', function (code) {
   process.stdin.setRawMode(false);
   clog.info('vim exit with code: ' + code);
   if(code === 0) next();
   else next(new Error('vim exit with code ' + code));
 });