Пример #1
0
  return new Promise(function(resolve, reject) {
    if (!self._isValid()) {
      reject(new Error('This does not seem to be a valid MavensMate project directory.'));
    } else {
      if (self.path !== undefined) {
        self.workspace = path.dirname(self.path);
        self.name = path.basename(self.path);
      } else if (self.workspace !== undefined && self.name !== undefined) {
        self.path = path.join(self.workspace, self.name);
      } else {
        self.path = process.cwd();
        self.workspace = path.dirname(self.path);
        self.name = path.basename(self.path);
      }

      if (!fs.existsSync(self.path)) {
        return reject(new Error('This does not seem to be a valid MavensMate project directory.'));
      }

      logger.debug('project name', self.name);
      logger.debug('project path', self.path);
      // self.workspace = path.dirname(self.path);
      // self.name = path.basename(self.path);

      // TODO: Promise.all or reduce
      // first order of business is to ensure we have a valid sfdc-client

      self.packageXml = new Package({ project: self, path: path.join(self.path, 'src', 'package.xml') });
      self.packageXml.init()
        .then(function() {
          return self._getSettings();
        })
        .then(function() {
          return self._getCachedSession();
        })
        .then(function(cachedSession) {
          cachedSession.username = self.settings.username;
          cachedSession.password = self.settings.password;
          cachedSession.orgType = self.settings.environment;
          cachedSession.loginUrl = self.settings.loginUrl;
          if (!self.sfdcClient) {
            self.sfdcClient = new SalesforceClient(cachedSession);
            self.sfdcClient.on('sfdcclient-cache-refresh', function() {
              logger.debug('project caught event: sfdcclient-cache-refresh');
              self._writeSession()
                .then(self._getCachedSession())
                .catch(function(err) {
                  logger.debug('sfdcclient-cache-refresh: could not update local session cache');
                  throw new Error('Could not update local session cache: '+err.message);
                })
                .done();
            });
          }
          return self.sfdcClient.initialize();
        })
        .then(function() {
          return self._writeSession();
        })
        .then(function() {
          self.getLocalStore();
          return self.getOrgMetadataIndexWithSelections();
        })
        .then(function() {
          return self._refreshDescribeFromServer();
        })
        .then(function() {
          self.logService = new LogService(self);
          self.sfdcClient.on('sfdcclient-new-log', function(message) {
            if (message.sobject && message.sobject.Id) {
              self.logService.downloadLog(message.sobject.Id)
                .then(function(filePath) {
                  self.emit('new-log', filePath);
                })
                .catch(function(error) {
                  logger.debug('Could not download log: '+error.message);
                })
                .done();
            }
          });
          return self.sfdcClient.startSystemStreamingListener();
        })
        .then(function() {
          self.valid = true;
          resolve();
        })
        .catch(function(error) {
          if (error.message.indexOf('INVALID_LOGIN') >= 0 || error.message.indexOf('EXPIRED_PASSWORD') >= 0 || error.message.indexOf('LOGIN_MUST_USE_SECURITY_TOKEN') >= 0) {
            self.valid = false;
          }
          reject(error);
        })
        .done();
    }
  });
Пример #2
0
f.analogWrite = function(pin, value, freq, callback) {
    if(debug) winston.debug('analogWrite(' + [pin,value,freq] + ');');
    pin = my.getpin(pin);
    freq = freq || 2000.0;
    var path = '';

    // Make sure the pin has a pwm associated
    if(typeof pin.pwm == 'undefined') {
        throw(pin.key + ' does not support analogWrite()');
    }

    // Make sure it no one else who has the pwm
    if((typeof pwm[pin.pwm.name] != 'undefined') && (pin.key != pwm[pin.pwm.name].key)) {
        throw(pin.key + ' requires pwm ' + pin.pwm.name +
            ' but it is already in use by ' +
            pwm[pin.pwm].key
        );
    }

    // Make sure pwm[].key and pwm[].(pwm_test_path|old_pwm_path) are valid
    if(typeof pwm[pin.pwm.name] == 'undefined') {
        pwm[pin.pwm.name] = {};
        pwm[pin.pwm.name].key = pin.key;
        var pinMode = f.getPinMode(pin.key);
        var slew = pinMode.slew || 'fast';
        var pullup = pinMode.pullup || 'disabled';
        var pinData = my.pin_data(slew, 'out', pullup, pin.pwm.muxmode);
        if(my.load_dt('am33xx_pwm') && my.create_dt(pin, pinData, 'bspwm')) {
            var ocp = my.file_find('/sys/devices', 'ocp.');
            var pwm_test = my.file_find(ocp, 'bs_pwm_test_' + pin.key + '.', 10000);
            my.file_find(pwm_test, 'period', 10000);
            pwm[pin.pwm.name].pwm_test_path = pwm_test;
            pwm[pin.pwm.name].freq = 0;
            path = pwm_test;
            fs.writeFileSync(path+'/polarity', 0);
        } else {
            pwm[pin.pwm.name].old_pwm_path = '/sys/class/pwm/' + pin.pwm.path;
            path = pwm[pin.pwm.name].old_pwm_path;

            f.pinMode(pin, g.OUTPUT, pin.pwm.muxmode, 'disabled', 'fast');

            // Clear up any unmanaged usage
            fs.writeFileSync(path+'/request', '0');

            // Allocate and configure the PWM
            fs.writeFileSync(path+'/request', '1');
            fs.writeFileSync(path+'/period_freq', Math.round(freq));
            fs.writeFileSync(path+'/polarity', '0');
            fs.writeFileSync(path+'/run', '1');
            pwm[pin.pwm.name].freq = freq;
        }
        pwm[pin.pwm.name].key = pin.key;
    }

    // Perform update only
    if(typeof pwm[pin.pwm.name].pwm_test_path === 'string') {
        path = pwm[pin.pwm.name].pwm_test_path;
        try {
            var period = Math.round( 1.0e9 / freq ); // period in ns
            var duty = Math.round( period * value );
            fs.writeFileSync(path+'/duty', 0);
            if(pwm[pin.pwm.name].freq != freq) {
                fs.writeFileSync(path+'/period', period);
                pwm[pin.pwm.name].freq = freq;
            }
            fs.writeFileSync(path+'/duty', duty);
        } catch(ex) {
            winston.error('analogWrite error: ' + path + ', ' + ex);
        }
    } else {
        path = pwm[pin.pwm.name].old_pwm_path;
        if(pwm[pin.pwm.name].freq != freq) {
            fs.writeFileSync(path+'/run', '0');
            fs.writeFileSync(path+'/duty_percent', '0');
            fs.writeFileSync(path+'/period_freq', Math.round(freq));
            fs.writeFileSync(path+'/run', '1');
            pwm[pin.pwm.name].freq = freq;
        }
        fs.writeFileSync(path+'/duty_percent', Math.round(value*100));
    }

    // All done
    if(callback) callback({value:true});
    return(true);
};
Пример #3
0
 .then(function(oauthObj){
     logger.debug('intuit-cad::client::oauthTokenCheck::got oauth token resolving now');
     deferred.resolve(oauthObj);
   },
Пример #4
0
	.alias('?', 'help')
	.alias('v', 'verbose')
	.count('verbose')
	.describe('b', 'URL of the MQTT broker')
	.describe('spi', 'device file for the SPI interface')
	.describe('ce', 'GPIO pin for the CE')
	.describe('irq', 'GPIO pin for the IRQ')
    .default({ b : 'mqtt://localhost:1883', spi : '/dev/spidev0.0', ce: 25, irq: 24 })
    .argv;

var loggingLevels = ['warn', 'info', 'verbose', 'debug', 'silly'];
var loggingLevel = loggingLevels[argv.verbose];
var logger = new (winston.Logger)({
    transports: [new (winston.transports.Console)({ level: loggingLevel, colorize: true })]
  });  
winston.debug('logging level set to ' + loggingLevel);

var mqttUrl = url.parse(process.env.MQTT_BROKER_URL || argv.b);
var mqttAuth = (mqttUrl.auth || ':').split(':');

var mqttClient = mqtt.createClient(mqttUrl.port, mqttUrl.hostname, {
  username: mqttAuth[0],
  password: mqttAuth[1]
});



var messageStore = [];

mqttClient.subscribe('RF24SN/out/+/+');
mqttClient.on('message', function(topic, message) {
Пример #5
0
f.pinMode = function(pin, direction, mux, pullup, slew, callback) {
    if(debug) winston.debug('pinMode(' + [pin, direction, mux, pullup, slew] + ');');
    pin = my.getpin(pin);
    if(direction == g.INPUT_PULLUP) pullup = 'pullup';
    pullup = pullup || ((direction == g.INPUT) ? 'pulldown' : 'disabled');
    slew = slew || 'fast';
    mux = mux || 7; // default to GPIO mode
    var resp = {value: true};
    var template = 'bspm';
    
    if(direction == g.ANALOG_OUTPUT || mux == g.ANALOG_OUTPUT) {
        if((typeof pin.pwm == 'undefined') || 
                (typeof pin.pwm.muxmode == 'undefined')) {
            var err = 'pinMode only supports ANALOG_OUTPUT for PWM pins: ' + pin.key;
            winston.info(err);
            if(callback) callback({value:false, err:err});
            return(false);
        }
        direction = g.OUTPUT;
        mux = pin.pwm.muxmode;
        template = 'bspwm';
    }
    
    if(!pin.mux) {
        if(debug) winston.debug('Invalid pin object for pinMode: ' + pin);
        throw('Invalid pin object for pinMode: ' + pin);
    }

    var muxFile = '/sys/kernel/debug/omap_mux/' + pin.mux;
    var gpioFile = '/sys/class/gpio/gpio' + pin.gpio + '/value';
    var n = pin.gpio;
    
    // Handle case where pin is allocated as a gpio-led
    if(pin.led) {
        if((direction != g.OUTPUT) || (mux != 7)) {
            resp.err = 'pinMode only supports GPIO output for LEDs: ' + pin.key;
            winston.info(resp.err);
            resp.value = false;
            if(callback) callback(resp);
            return(false);
        }
        gpioFile = '/sys/class/leds/beaglebone::' + pin.led + '/brightness';
        var pathA = "/sys/class/leds/beaglebone:";
        var pathB = pathA;
        pathA += ":" + pin.led + "/trigger";
        pathB += "green:" + pin.led + "/trigger";
        if(my.file_existsSync(pathA)) {
            fs.writeFileSync(pathA, "gpio");
        } else {
            if(my.file_existsSync(pathB)) {
                fs.writeFileSync(pathB, "gpio");
            } else {
                resp.err = "Unable to find LED: " + pin.led;
                winston.error(resp.err);
                resp.value = false;
            }
        }
        gpio[n] = {'path': gpioFile};
        if(callback) callback(resp);
        return(resp.value);
    }

    // Figure out the desired value
    var pinData = my.pin_data(slew, direction, pullup, mux);
   
    if(my.is_capemgr()) {
        my.create_dt(pin, pinData, template);
    } else {
        try {
            var fd = fs.openSync(muxFile, 'w');
            fs.writeSync(fd, pinData.toString(16), null);
        } catch(ex) {
            if(debug) winston.debug('Unable to configure mux for pin ' + pin + ': ' + ex);
            // Don't exit yet --- need to try using pinmux-helper with devicetree
            // ... and it might work if the pin is already muxed to 7
            if(debug) winston.debug('mode = ' + JSON.stringify(f.getPinMode(pin)));
            var currentMode = f.getPinMode(pin);
            if(currentMode.mux != mux) {
                resp.value = false;
                resp.err = 'Unable to configure mux for pin ' + pin.key + ': ' + ex;
                winston.info(resp.err);
                gpio[n] = {};
                if(callback) callback(resp);
                return(resp.value);
            }
        }
    }
    
    // Enable GPIO, if not already done
    if(mux == 7) {
        if(!gpio[n] || !gpio[n].path) {
            gpio[n] = {'path': gpioFile};
    
            // Export the GPIO controls
            var exists = my.file_existsSync(gpioFile);
            if(exists) {
                if(debug) winston.debug("gpio: " + n + " already exported.");
                fs.writeFileSync("/sys/class/gpio/gpio" + n + "/direction",
                    direction, null);
            } else {
                try {
                    if(debug) winston.debug("exporting gpio: " + n);
                    fs.writeFileSync("/sys/class/gpio/export", "" + n, null);
                    if(debug) winston.debug("setting gpio " + n +
                        " direction to " + direction);
                    fs.writeFileSync("/sys/class/gpio/gpio" + n + "/direction",
                        direction, null);
                } catch(ex2) {
                    resp.value = false;
                    resp.err = 'Unable to export gpio-' + n + ': ' + ex2;
                    if(debug) winston.debug(resp.err);
                    var gpioUsers =
                        fs.readFileSync('/sys/kernel/debug/gpio', 'utf-8');
                    gpioUsers = gpioUsers.split('\n');
                    for(var x in gpioUsers) {
                        var y = gpioUsers[x].match(/gpio-(\d+)\s+\((\S+)\s*\)/);
                        if(y && y[1] == n) {
                            resp.err += '\nconsumed by ' + y[2];
                            if(debug) winston.debug(resp.err);
                        }
                    }
                    gpio[n] = {};
                    if(callback) callback(resp);
                    return(resp.value);
                }
            }
        }
    } else {
        gpio[n] = {};
    }
    
    if(callback) callback(resp);
    return(resp.value);
};
Пример #6
0
	processMatchDetails: function(matchDetails, matchMetadata, lobbyInfo) {
		// winston.info("matchDetails: " + JSON.stringify(matchDetails));
		// winston.info("matchMetadata: " + JSON.stringify(matchMetadata));

		var teams = [];
		_.each(["radiant", "dire"], function(name) {
			var team = {};
			_.each(["name", "team_id", "logo", "team_complete"], function(param) {
				team[param] = matchDetails[name+"_"+param];
			});
			team["side"] = name;

			team.kills = 0;

			teams.push(team);
		});

		// this is a little unusual; instead of counting kills and crediting the
		// to the team with the kills, we're changing to count DEATHS of the opposite
		// team and attribute that score to the opposite team. This difference matters
		// in situations with suicides and neutral denies. This matches the behavior
		// of the in-game scoreboard, even though it's sort of idiosyncratic.
		// Thanks to @datdota for pointing out this inconsistency.
		_.each(matchDetails.players, function(player) {
			var index = 1;
			if(player.player_slot >= 128) index = 0;

			teams[index].kills += player.deaths;
		});

		// Check if we have a twitter handle for this team id.
		_.each(teams, function(team) {
			if(team.team_id in team_twitter) {
				team.name = "@" + team_twitter[team.team_id];
			} else {
				winston.info("No twitter handle found for team: " + team.name + " (" + team.team_id + ")");
			}
		});

		if(matchDetails.radiant_win) {
			teams[0].winner = true;
			teams[1].winner = false;

			teams[0].displayName = "[" + teams[0].name + "]";
			teams[1].displayName = teams[1].name;
		} else {
			teams[0].winner = false;
			teams[1].winner = true;

			teams[0].displayName = teams[0].name;
			teams[1].displayName = "[" + teams[1].name + "]";
		}

		// now, lets update the series_id information.
		// first, check and see if this series has been seen before.

		// look first in the lobby info. for TI games, we won't have any
		// matchMetadata at all to work with. 
		if((lobbyInfo && lobbyInfo.lastSnapshot.series_type > 0) || matchMetadata.series_type > 0) {
			var seriesType, seriesId, usingLobbyInfo;

			if(lobbyInfo.lastSnapshot.series_type > 0) {
				seriesType = lobbyInfo.lastSnapshot.series_type;
				seriesId = null;
				usingLobbyInfo = true;
			} else {
				seriesType = matchMetadata.series_type;
				seriesId = matchMetadata.series_id;
				usingLobbyInfo = false;
			}

			winston.debug("ACTIVE SERIES: " + seriesId + " with type " + seriesType);
			winston.debug("activeSeriesIds:" + JSON.stringify(this.activeSeriesIds));

			// the logic starts to diverge here. there are two cases:
			// 1. we have matchMetadata, eg the old system of GetMatchHistory works,
			//	  and we found the match that way.
			// 2. we don't have matchMetadata and are relying on GetLiveLeagueGames-generated
			//    events to determine when a game has ended. In that case, we don't have
			//    a series_id, but we do have series_type and the aggregated radiant_series_wins
			//	  and dire_series_wins. 

			// this is the minimum structure we need. 
			// we generate more elaborate structure only if we are doing the old-fashioned
			// style.
			var seriesStatus = {"teams":{}};
			if(usingLobbyInfo) {
				seriesStatus.teams[lobbyInfo.lastSnapshot.radiant_team.team_id] = lobbyInfo.lastSnapshot.radiant_series_wins;
				seriesStatus.teams[lobbyInfo.lastSnapshot.dire_team.team_id] = lobbyInfo.lastSnapshot.dire_series_wins;
				seriesStatus.series_type = lobbyInfo.lastSnapshot.series_type;
			} else {
				// this branch is concerned with the cached version of series status only.
				if(series_id && (series_id in this.activeSeriesIds)) {
					seriesStatus = _.clone(this.activeSeriesIds[matchMetadata.series_id]);
				} else {
					seriesStatus = {
						series_id: matchMetadata.series_id,
						series_type: matchMetadata.series_type,
						teams: {},
						time: new Date().getTime()
					}

					seriesStatus.teams[teams[0]["team_id"]] = 0;
					seriesStatus.teams[teams[1]["team_id"]] = 0;
				}
			}


			// now update the results based on who won
			var teamId = teams[0]["team_id"];

			if(teams[1].winner) {
				teamId = teams[1]["team_id"];
			}

			seriesStatus.teams[teamId] = seriesStatus.teams[teamId]+1;
			seriesStatus.time = new Date().getTime();

			// construct a string where it has filled in circles for every
			// win, and empty circles to fill into the total number of games
			// necessary.

			_.each([0, 1], function(index) {
				teams[index].series_wins = seriesStatus.teams[teams[index]["team_id"]]

				var winString = "";
				for(var x=0; x<teams[index].series_wins; x++) {
					winString = winString + "\u25FC";
				}

				// at this point we have as many dots as this team has wins.
				// now, fill up the remainder.
				var gamesToWin = seriesStatus.series_type+1;
				var emptyDots = gamesToWin - teams[index].series_wins;

				// flip the direction the empty dots are on, so wins are always
				// closest to the team name.
				if(index==0) {
					for (var o=0; o<emptyDots; o++) {
						winString = "\u25FB" + winString;
					}
				} else {
					for (var o=0; o<emptyDots; o++) {
						winString = winString + "\u25FB";
					}
				}

				// store it for later.
				teams[index].wins_string = winString;
			});

			// move the information into the teams objects for convenience
			teams[0].series_wins = seriesStatus.teams[teams[0]["team_id"]]
			teams[1].series_wins = seriesStatus.teams[teams[1]["team_id"]]

			winston.debug("activeSeriesIds POST:" + JSON.stringify(this.activeSeriesIds));
		} else {
			// this branch is for non series, eg bo1.
			teams[0].series_wins = null;
			teams[1].series_wins = null;
			teams[0].wins_string = "";
			teams[1].wins_string = "";
		}

		// now push the series status into

		var durationString = " " + Math.floor(matchDetails.duration/60) + "m";

		if(matchDetails.duration%60<10) {
			durationString += "0" + matchDetails.duration%60;
		} else {
			durationString += matchDetails.duration%60;
		}

		durationString += "s";

		var league = this.leagues[matchDetails.leagueid];

		if(matchDetails.leagueid==600) {
			league.name = "The International 2014 #ti4";
		}

		// drop the word "ticket" in all situations
		if(league.name.indexOf("Season ") > -1) {
			league.name = league.name.replace("Season ", "S");
		}

		if(league.name.indexOf("Captains Draft") > -1) {
			league.name = league.name.replace("Captains Draft", "CD");
		}

		league.name = league.name.replace(" Ticket", "");
		league.name = league.name.replace(" League", "");

		var tweetString = teams[0].wins_string + " " + teams[0].displayName + " " + teams[0].kills + "\u2014" + teams[1].kills + " " + teams[1].displayName + " " + teams[1].wins_string + "\n";
		tweetString = tweetString + durationString + " / " +league.name + "   \n";

		// check if an @ sign is the first character. If it is, then add a preceeding period
		// so it doesn't count as a reply.
		tweetString = tweetString.trim();
		if(tweetString[0]=='@') {
			tweetString = "." + tweetString;
		}

		// We know we want to append a dotabuff link, and that it will get auto-shortened
		// to a string of max length 23; (see https://dev.twitter.com/docs/api/1/get/help/configuration - this could increase)
		// so check and see if the content without the url is over the space we have left
		// for a \n + a t.co link. If it is, then chop away at the league name
		// which has started getting super long in some situations.
		// (-1 because of the \n character)

		if(tweetString.length > (140-23-1)) {
			tweetString = tweetString.substring(0, 140-23-1);
		}

		var baseString = tweetString;
		// now add the link back in.
		// this is definitely going to push the total over 140, but we count on the fact that
		// twitter will shorten it automatically for us post-submission. Not 100% sure this is true
		// but I think it is.
		tweetString = tweetString + "\nhttp://dotabuff.com/matches/" + matchMetadata.match_id;

		// we're going to prepare an extra-short tweet string too, in case
		// there's a picture to include. there are two cases here:
		// 1. the resulting tweet in tweetString has room for an extra 23 characters
		//	  for the twitter image link.
		// 2. the resulting tweet does not have room. 
		//		a. in this case, drop the dotabuff link and tweet the result, since
		//		   we know that that's the same length.

		var shortMessage;
		if(tweetString.length > 140-23-1) {
			// use the pre-dotabuff-appended link.
			shortMessage = baseString;

			// it seems like pic links are longer than normal links,
			// so cut off some extra text just in case. Not totally sure
			// about this number, can't find a reliable reference. Links
			// should be 23 max, but I've seen references to 26 chars max
			// for image links to edging on the careful side.
			if(shortMessage.length > 112) {
				shortMessage = shortMessage.substring(0, 112);
			}
		} else {
			// otherwise, we're fine; shortMessage can be the same.
			shortMessage = tweetString;
		}

		var result = {message: tweetString, teams:teams, duration:matchDetails.duration,
						seriesStatus: seriesStatus, shortMessage: shortMessage};

		return result;
	},
      "connector": "postgresql",
      "database": urlObject.path.substring(1),
      "host": urlObject.hostname,
      "port": urlObject.port,
      "username": urlObject.auth.substring(0, urlObject.auth.indexOf(":")),
      "password": urlObject.auth.substring(urlObject.auth.indexOf(":") + 1),
      "max": Math.max(1, vcapServices.elephantsql[0].credentials.max_conns - 2) // leave some connections for the frontend
    };
  }
}

// and allow override with a local datasource definition
var localDatasources = null;
try {
  localDatasources = require("./datasources.local.json");
  winston.debug("Loaded local datasources");

  if (localDatasources.hasOwnProperty("db")) {
    winston.info("Using locally defined datasource");
    datasources.db = localDatasources.db;
  }
} catch (e) {
  winston.error(e);
}

winston.info("Datasource uses connector:", datasources.db.connector);

module.exports = datasources;

//------------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
Пример #8
0
 .then(function() {
   logger.debug('done indexing symbols!');
   resolve();
 })
Пример #9
0
  return new Promise(function(resolve, reject) {
    if (fs.existsSync(path.join(self.path, 'config', '.org_metadata'))) {
      try {
        fs.readJson(path.join(self.path, 'config', '.org_metadata'), function(err, orgMetadata) {
          if (err) {
            reject(err);
          } else {
            self.orgMetadata = orgMetadata;
            var indexService = new IndexService({ project: self });
            var metadataHelper = new MetadataHelper({ sfdcClient: self.sfdcClient });

            var promise;
            var customPackage;
            if (packageLocation) {
              customPackage = new Package({ path: packageLocation });
              promise = customPackage.init();
            } else {
              promise = new Promise(function(r) { r(); });
            }

            promise
              .then(function() {
                if (!ids) {
                  ids = [];
                  var pkg = packageLocation ? customPackage : self.packageXml;
                  _.forOwn(pkg.subscription, function(packageMembers, metadataTypeXmlName) {
                    var metadataType = metadataHelper.getTypeByXmlName(metadataTypeXmlName); //inFolder, childXmlNames
                    if (!metadataType) {
                      return reject(new Error('Unrecognized package.xml metadata type: '+metadataTypeXmlName));
                    }
                    if (_.has(metadataType, 'parentXmlName')) {
                      var parentMetadataType = metadataHelper.getTypeByXmlName(metadataType.parentXmlName);
                    }
                    if (packageMembers === '*') {
                      ids.push(metadataTypeXmlName);
                      var indexedType = _.find(orgMetadata, { 'xmlName': metadataTypeXmlName });
                      if (_.has(indexedType, 'children')) {
                        _.each(indexedType.children, function(child) {
                          child.select = true;
                        });
                      }
                    } else {
                      _.each(packageMembers, function(member) {
                        if (metadataType.inFolder) {
                          // id : Document.FolderName.FileName.txt
                          ids.push([metadataTypeXmlName, member.replace(/\//, '.')].join('.'));
                        } else if (parentMetadataType) {
                          // id : CustomObject.Object_Name__c.fields.Field_Name__c
                          var id = [ parentMetadataType.xmlName, member.split('.')[0], metadataType.tagName, member.split('.')[1] ].join('.');
                          ids.push(id);
                        } else if (_.has(metadataType, 'childXmlNames')) {
                          var indexedType = _.find(orgMetadata, { 'xmlName': metadataTypeXmlName });
                          if (indexedType) {
                            var indexedNode = _.find(indexedType.children, { 'id': [metadataTypeXmlName, member].join('.')});
                            if (_.has(indexedNode, 'children')) {
                              _.each(indexedNode.children, function(child) {
                                child.select = true;
                                if (_.has(child, 'children')) {
                                  _.each(child.children, function(grandChild) {
                                    grandChild.select = true;
                                  });
                                }
                              });
                            }
                            ids.push([metadataTypeXmlName, member].join('.'));
                          }
                        } else {
                          // id: ApexClass.MyClassName
                          ids.push([metadataTypeXmlName, member].join('.'));
                        }
                      });
                    }
                  });
                }
                indexService.setChecked(orgMetadata, ids);
                indexService.ensureParentsAreCheckedIfNecessary(orgMetadata);
                if (keyword) {
                  indexService.setVisibility(orgMetadata, keyword);
                }
                resolve(orgMetadata);
              });
          }
        });
      } catch(err) {
        logger.debug('Could not getOrgMetadataIndexWithSelections: '+err.message);
        resolve([]);
      }
    } else {
      logger.debug('org_metadata not found, returning empty array');
      resolve([]);
    }
  });
Пример #10
0
        .then(function() {
          logger.debug('initing local store ... ');
          logger.debug(fileProperties);

          return self._writeLocalStore(fileProperties);
        })
Пример #11
0
 .then(function() {
   logger.debug('done indexing lightning, now go get it');
   var lightningIndex = fs.readJsonSync(path.join(self.path, 'config', '.lightning'));
   return resolve(lightningIndex);
 })
Пример #12
0
 finder.on('error', function (err) {
   logger.debug('Could not process retrieved metadata: '+err.message);
   reject(err);
 });
Пример #13
0
 .catch(function(error) {
   logger.debug('Could not download log: '+error.message);
 })
Пример #14
0
 .catch(function(err) {
   logger.debug('sfdcclient-cache-refresh: could not update local session cache');
   throw new Error('Could not update local session cache: '+err.message);
 })
Пример #15
0
/**
 * Transforms a PDU to an object
 *
 * @param buf pdu
 * @param bol stupidNullByte - Define if the short_message should be followed by a stupid NULL byte - will be auto resolved if left undefined
 * @param func callback(err, obj)
 */
function pduToObj(pdu, stupidNullByte, callback) {
	var retObj = {'params': {}, 'tlvs': {}},
	    err    = null,
	    offset,
	    command,
	    param,
	    tlvCmdId,
	    tlvLength,
	    tlvValue,
	    paramSize;

	if (typeof stupidNullByte === 'function') {
		callback       = stupidNullByte;
		stupidNullByte = undefined;
	}

	// Returns true if this PDU is a response to another PDU
	retObj.isResp = function() {
		return ! ! (this.cmdId & 0x80000000);
	};

	log.silly('larvitsmpp: lib/utils.js: pduToObj() - Decoding PDU to Obj. PDU buff in hex: ' + pdu.toString('hex'));

	if (pdu.length < 16) {
		err = new Error('PDU is to small, minimum size is 16, given size is ' + pdu.length);
		log.warn('larvitsmpp: lib/utils.js: pduToObj() - ' + err.message);

		callback(err);
		return;
	}

	// Read the PDU Header
	retObj.cmdLength = parseInt(pdu.readUInt32BE(0));
	retObj.cmdId     = parseInt(pdu.readUInt32BE(4));
	retObj.cmdStatus = defs.errorsById[parseInt(pdu.readUInt32BE(8))];
	retObj.seqNr     = parseInt(pdu.readUInt32BE(12));

	// Lookup the command id in the definitions
	if (defs.cmdsById[retObj.cmdId] === undefined) {
		err = new Error('Unknown PDU command id: ' + retObj.cmdId + ' PDU buff in hex: ' + pdu.toString('hex'));
	}

	if (isNaN(retObj.seqNr)) {
		err = new Error('Invalid seqNr, is not an interger: "' + retObj.seqNr + '"');
	} else if (retObj.seqNr > 2147483646) {
		err = new Error('Invalid seqNr, maximum size of 2147483646 (0x7fffffff) exceeded.');
	}

	// If error is found, do not proceed with execution
	if (err !== null) {
		log.warn('larvitsmpp: lib/utils.js: pduToObj() - ' + err.message);
		callback(err);
		return;
	}

	command        = defs.cmdsById[retObj.cmdId];
	retObj.cmdName = command.command;

	// Get all parameters from the body that should exists with this command
	offset = 16; // 0-15 is the header, so the body starts at 16
	for (param in command.params) {

		// Get the parameter value by using the definition type read() function
		try {
			retObj.params[param] = command.params[param].type.read(pdu, offset, retObj.params.sm_length);
			paramSize            = command.params[param].type.size(retObj.params[param]);

			log.silly('larvitsmpp: lib/utils.js: pduToObj() - Reading param "' + param + '" at offset ' + offset + ' with calculated size: ' + paramSize + ' content in hex: ' + pdu.slice(offset, offset + paramSize).toString('hex'));

			if (param === 'short_message') {
				// Check if we have a trailing NULL octet after the short_message. Some idiot thought that would be a good idea
				// in some implementations, so we need to account for that.
				if (stupidNullByte === true) {
					log.silly('larvitsmpp: lib/utils.js: pduToObj() - stupidNullByte is set, so short_message is followed by a NULL octet, increase paramSize one extra to account for that');
					paramSize ++;
				}
			}

			// Increase the offset by the current params length
			offset += paramSize;
		} catch (e) {
			err = new Error('Failed to read param "' + param + '": ' + e.message);
			log.error('larvitsmpp: lib/utils.js: pduToObj() - ' + err.message);
			callback(err);

			return;
		}
	}

	// If the length is greater than the current offset, there must be TLVs - resolve them!
	// The minimal size for a TLV is its head, 4 octets
	while ((offset + 4) < retObj.cmdLength) {
		try {
			tlvCmdId  = pdu.readInt16BE(offset);
			tlvLength = pdu.readInt16BE(offset + 2);
		} catch (e) {
			err = new Error('Unable to read TLV at offset "' + offset + '", given cmdLength: "' + retObj.cmdLength + '" pdu: ' + pdu.toString('hex'));
			log.error('larvitsmpp: lib/utils.js: pduToObj() - ' + err.message);
			callback(err);
			return;
		}

		if (defs.tlvsById[tlvCmdId] === undefined) {
			tlvValue = pdu.slice(offset + 4, offset + 4 + tlvLength).toString('hex');

			retObj.tlvs[tlvCmdId] = {
				'tagId': tlvCmdId,
				'tagName': undefined,
				'tagValue': tlvValue
			};

			log.verbose('larvitsmpp: lib/utils.js: pduToObj() - Unknown TLV found. Hex ID: ' + tlvCmdId.toString(16) + ' length: ' + tlvLength + ' hex value: ' + tlvValue);
		} else {
			tlvValue = defs.tlvsById[tlvCmdId].type.read(pdu, offset + 4, tlvLength);

			if (Buffer.isBuffer(tlvValue)) {
				tlvValue = tlvValue.toString('hex');
			}

			retObj.tlvs[defs.tlvsById[tlvCmdId].tag] = {
				'tagId': tlvCmdId,
				'tagName': defs.tlvsById[tlvCmdId].tag,
				'tagValue': tlvValue
			};

			log.silly('larvitsmpp: lib/utils.js: pduToObj() - TLV found: "' + defs.tlvsById[tlvCmdId].tag + '" ID: "' + tlvCmdId + '" value: "' + tlvValue + '"');
		}

		offset = offset + 4 + tlvLength;
	}

	if (offset !== retObj.cmdLength && stupidNullByte === undefined) {
		log.verbose('larvitsmpp: lib/utils.js: pduToObj() - Offset (' + offset + ') !== cmdLength (' + retObj.cmdLength + ') for seqNr: ' + retObj.seqNr + ' - retry with the stupid NULL byte for short_message');

		pduToObj(pdu, true, callback);
		return;
	}

	if (offset !== retObj.cmdLength) {
		log.warn('larvitsmpp: lib/utils.js: pduToObj() - Offset (' + offset + ') !== cmdLength (' + retObj.cmdLength + ') for seqNr: ' + retObj.seqNr);
	}

	// Decode the short message if it is set and esm_class is 0
	// The esm_class 0x40 (64 int) means the short_message have a UDH
	// Thats why we return the short_message as a buffer
	if (retObj.params.short_message !== undefined && retObj.params.esm_class !== 0x40) {
		retObj.params.short_message = decodeMsg(retObj.params.short_message, retObj.params.data_coding);
	}

	log.debug('larvitsmpp: lib/utils.js: pduToObj() - Complete decoded PDU: ' + JSON.stringify(retObj));

	callback(null, retObj);
}
Пример #16
0
  process: function(docs, config) {

    // Keywords to ignore
    var wordsToIgnore = [];
    var propertiesToIgnore;
    var areasToSearch;

    // Keywords start with "ng:" or one of $, _ or a letter
    var KEYWORD_REGEX = /^((ng:|[\$_a-z])[\w\-_]+)/;

    // Load up the keywords to ignore, if specified in the config
    if ( config.processing.search && config.processing.search.ignoreWordsFile ) {

      var ignoreWordsPath = path.resolve(config.basePath, config.processing.search.ignoreWordsFile);
      wordsToIgnore = fs.readFileSync(ignoreWordsPath, 'utf8').toString().split(/[,\s\n\r]+/gm);

      log.debug('Loaded ignore words from "' + ignoreWordsPath + '"');
      log.silly(wordsToIgnore);

    }

    areasToSearch = _.indexBy(config.get('processing.search.areasToSearch', ['api', 'guide', 'misc', 'error', 'tutorial']));

    propertiesToIgnore = _.indexBy(config.get('processing.search.propertiesToIgnore', []));
    log.debug('Properties to ignore', propertiesToIgnore);

    var ignoreWordsMap = _.indexBy(wordsToIgnore);

    // If the title contains a name starting with ng, e.g. "ngController", then add the module name
    // without the ng to the title text, e.g. "controller".
    function extractTitleWords(title) {
      var match = /ng([A-Z]\w*)/.exec(title);
      if ( match ) {
        title = title + ' ' + match[1].toLowerCase();
      }
      return title;
    }

    function extractWords(text, words, keywordMap) {

      var tokens = text.toLowerCase().split(/[\.\s,`'"#]+/mg);
      _.forEach(tokens, function(token){
        var match = token.match(KEYWORD_REGEX);
        if (match){
          var key = match[1];
          if ( !keywordMap[key]) {
            keywordMap[key] = true;
            words.push(key);
          }
        }
      });
    }


    // We are only interested in docs that live in the right area
    docs = _.filter(docs, function(doc) { return areasToSearch[doc.area]; });

    _.forEach(docs, function(doc) {

      var words = [];
      var keywordMap = _.clone(ignoreWordsMap);
      var members = [];
      var membersMap = {};

      // Search each top level property of the document for search terms
      _.forEach(doc, function(value, key) {

        if ( _.isString(value) && !propertiesToIgnore[key] ) {
          extractWords(value, words, keywordMap);
        }

        if ( key === 'methods' || key === 'properties' || key === 'events' ) {
          _.forEach(value, function(member) {
            extractWords(member.name, members, membersMap);
          });
        }
      });


      doc.searchTerms = {
        titleWords: extractTitleWords(doc.name),
        keywords: _.sortBy(words).join(' '),
        members: _.sortBy(members).join(' ')
      };

    });

  }
Пример #17
0
/**
 * Transform an object to a PDU
 *
 * @param obj obj - example {'cmdName': 'bind_transceiver_resp', 'cmdStatus': 'ESME_ROK', 'seqNr': 2} - to add parameters add a key 'params' as object
 * @param func callback(err, pdu)
 */
function objToPdu(obj, callback) {
	var err = null,
	    shortMsg,
	    seqNr;

	// Check so the command is ok
	if (defs.cmds[obj.cmdName] === undefined) {
		err = new Error('larvitsmpp: lib/utils.js: objToPdu() - Invalid cmdName: "' + obj.cmdName + '"');
	}

	// Check so the command status is ok
	if (obj.cmdStatus === undefined) {
		// Default to OK
		obj.cmdStatus = 'ESME_ROK';
	}

	if (defs.errors[obj.cmdStatus] === undefined) {
		err = new Error('larvitsmpp: lib/utils.js: objToPdu() - Invalid cmdStatus: "' + obj.cmdStatus + '"');
	}

	// Check so seqNr is ok
	seqNr = parseInt(obj.seqNr);
	if (isNaN(seqNr)) {
		err = new Error('larvitsmpp: lib/utils.js: objToPdu() - Invalid seqNr, is not an interger: "' + obj.seqNr + '"');
	} else if (seqNr > 2147483646) {
		err = new Error('larvitsmpp: lib/utils.js: objToPdu() - Invalid seqNr, maximum size of 2147483646 (0x7fffffff) exceeded.');
	}

	// If error is found, do not proceed with execution
	if (err !== null) {
		log.warn(err.message);
		callback(err);
		return;
	}

	// Params must be an object
	if (obj.params === undefined) {
		obj.params = {};
	}

	// If param "short_message" exists, encode it and set parameter "data_coding" accordingly
	if (obj.params.short_message !== undefined && ! Buffer.isBuffer(obj.params.short_message)) {

		// Detect encoding if is not set already
		if (obj.params.data_coding === undefined) {
			obj.params.data_coding = defs.encodings.detect(obj.params.short_message);

			log.silly('larvitsmpp: lib/utils.js: objToPdu() - data_coding "' + obj.params.data_coding + '" detected');

			// Now set the hex value
			obj.params.data_coding = defs.consts.ENCODING[obj.params.data_coding];
		}

		// Acutally encode the string
		shortMsg                 = obj.params.short_message;
		obj.params.short_message = encodeMsg(obj.params.short_message);

		obj.params.sm_length     = obj.params.short_message.length;
		log.silly('larvitsmpp: lib/utils.js: objToPdu() - encoding message "' + shortMsg + '" to "' + obj.params.short_message.toString('hex') + '"');
	}

	log.debug('larvitsmpp: lib/utils.js: objToPdu() - Complete object to encode: ' + JSON.stringify(obj));

	calcCmdLength(obj, function(err, cmdLength) {
		if (err) {
			callback(err);
			return;
		}

		writeBuffer(obj, cmdLength, callback);
	});
}
Пример #18
0
var winston = require('winston'),
	path = require('path'),
    mcapi = require('mailchimp-api'),
    Parser = require('./lib/parser'),
    ApiWrapper = require('./lib/api-wrapper');

var date = new Date();
date = date.toJSON().replace(/(-|:)/g, '.');

winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, { level: 'silly'});
winston.add(winston.transports.File, { 
    filename: path.join('./', 'logs', 'sxla' + date + '.log'),
    level: 'silly',
    timestamp: true
});

winston.info('*********** APPLICATION STARTED ***********');

var apiKey = process.env.MAILCHIMP_SXLA_API_KEY;
var listId = process.env.MAILCHIMP_SXLA_LIST_ID;
winston.debug('apiKey: ', apiKey);
winston.debug('listId: ', listId);

var api = new ApiWrapper(mcapi, apiKey, listId, winston);

var parser = new Parser(winston);
parser.parseCsv(__dirname + '/data/soci14-15.csv', function (data) {
	api.batchSubscribe(data);
});
Пример #19
0
 .on('uploaded', (details) => {
   logger.debug(`Snapshot upload successful. File name: ${details.Key}`);
   snapshot.delete();
 });
Пример #20
0
 this.slack.rtm.on('open', () => {
   logger.debug('Connected to Slack');
 });
Пример #21
0
  return new Promise(function(resolve, reject) {
    var localStore = self.project.getLocalStore();
    logger.silly(localStore);

    var testsPayload = []; // this will either be an array of class ids or an array of objects containing class names and methods
    var testClassIds = [];

    if (_.isString(self.tests[0])) { // an array of class ids
      testsPayload = [];
      _.each(self.testClassNames, function(testClassName) {
        logger.debug('adding test to job', testClassName);
        if (!localStore[testClassName]) {
          return reject(new Error('Invalid project metadata cache. Run Index Metadata command to reset the cache.'));
        }
        var apexClassId = localStore[testClassName].id;
        testsPayload.push(apexClassId);
        testClassIds.push(apexClassId);
      });
    } else {
      _.each(self.tests, function(test) {
        logger.debug('adding test to job', test);
        if (!localStore[path.basename(test.testNameOrPath)]) {
          return reject(new Error('Invalid project metadata cache. Run Index Metadata command to reset the cache.'));
        }
        var apexClassId = localStore[path.basename(test.testNameOrPath)].id;
        testsPayload.push({
          classId: apexClassId,
          testMethods: test.methodNames
        });
        testClassIds.push(apexClassId);
      });
    }

    logger.debug('running the following tests: ');
    logger.debug(testsPayload);

    var classResults;
    var methodResults;
    var projectClassIds = [];
    var projectTriggerIds = [];
    var coverageResults = {};
    var testResults = {};

    self.project.sfdcClient.runTests(testsPayload)
      .then(function(results) {
        classResults = results.classResults;
        methodResults = results.methodResults;
        _.forOwn(self.project.getLocalStore(), function(value, key) {
          if (util.endsWith(key, '.cls')) {
            projectClassIds.push(value.id);
            self.apexClassOrTriggerIdToName[value.id] = value.fullName;
          } else if (util.endsWith(key, '.trigger')) {
            projectTriggerIds.push(value.id);
            self.apexClassOrTriggerIdToName[value.id] = value.fullName;
          }
        });

        var logDownloadPromises = [];
        var logIdsToDownload = [];

        if (config.get('mm_download_categorized_test_logs')) {
          _.each(methodResults.records, function(r) {
            if (r.ApexLogId && logIdsToDownload.indexOf(r.ApexLogId) === -1) {
              logIdsToDownload.push(r.ApexLogId);
              logDownloadPromises.push(self._downloadLog(r.ApexClass.Name, r.ApexLogId));
            }
          });
        }

        return Promise.all(logDownloadPromises);
      })
      .then(function() {
        _.each(classResults.records, function(classResult) {
          var key = classResult.ApexClass.Name;
          testResults[key] = classResult;
          testResults[key].results = _.where(methodResults.records, { ApexClassId : classResult.ApexClassId });
        });

        if (self.skipCoverage) {
          logger.info('skipping test coverage...');
          resolve({ testResults: testResults });
        } else {
          logger.info('getting test coverage...');
          self.getCoverage(projectClassIds, testClassIds)
            .then(function(classCoverageResults) {
              coverageResults.classes = classCoverageResults;
              return self.getCoverage(projectTriggerIds, testClassIds);
            })
            .then(function(triggerCoverageResults) {
              coverageResults.triggers = triggerCoverageResults;
              resolve({ testResults: testResults, coverageResults: coverageResults });
            })
            .catch(function(err) {
              logger.error('Failed to get coverage');
              logger.error(err);
              reject(err);
            })
            .done();
        }
      })
      .catch(function(err) {
        logger.error('Could not run tests');
        logger.error(err);
        reject(err);
      })
      .done();
  });
Пример #22
0
 this.ircClient.on('registered', message => {
   logger.debug('Registered event: ', message);
   this.autoSendCommands.forEach(element => {
     this.ircClient.send(...element);
   });
 });
Пример #23
0
var my = require('./my');
var package_json = require('./package.json');
var g = require('./constants');
var epoll = my.require('epoll');

var debug = true;

winston.setLevels(winston.config.syslog.levels);
if(debug) {
    winston.add(winston.transports.File, {
        filename: '/var/lib/cloud9/bonescript.log',
        level: 'warn'
    });
}

winston.debug('index.js loaded');

var f = {};

// Keep track of allocated resources
var gpio = [];
var pwm = {};

// returned object has:
//  mux: index of mux mode
//  options: array of mode names
//  slew: 'fast' or 'slow'
//  rx: 'enabled' or 'disabled'
//  pullup: 'diabled', 'pullup' or 'pulldown'
//  pin: key string for pin
//  name: pin name
app.get('/', function(req, res){
	winston.debug('GET /');
  res.sendfile('views/index.html');
});
Пример #25
0
f.getPinMode = function(pin, callback) {
    if(debug) winston.debug('getPinMode(' + pin + ');');
    pin = my.getpin(pin);
    var mode = {'pin': pin.key, 'name': pin.name};
    if(pin.options) mode.options = pin.options;

    // Get PWM settings if applicable
    if((typeof pin.pwm != 'undefined')
        && (typeof pwm[pin.pwm.name] != 'undefined')
        && (pin.key == pwm[pin.pwm.name].key)) {
        mode.pwm = {};
        try {
            if(typeof pwm[pin.pwm.name].pwm_test_path === 'string') {
                var period = fs.readFileSync(pwm[pin.pwm.name].pwm_test_path+'/period');
                var duty = fs.readFileSync(pwm[pin.pwm.name].pwm_test_path+'/duty');
                mode.pwm.freq = 1.0e9 / period;
                mode.pwm.value = duty / period;
            } else {
                var duty_percent = fs.readFileSync(pwm[pin.pwm.name].old_pwm_path+'/duty_percent');
                mode.pwm.freq = fs.readFileSync(pwm[pin.pwm.name].old_pwm_path+'/period_freq');
                mode.pwm.value = duty_percent / 100.0;
            }
        } catch(ex) {
            mode.pwm.freq = undefined;
            mode.pwm.value = undefined;
        }
    }

    // Get GPIO settings if applicable
    if((typeof pin.gpio != 'undefined')) {
        var n = pin.gpio;
        var directionFile = "/sys/class/gpio/gpio" + n + "/direction";
        if(my.file_existsSync(directionFile)) {
            mode.gpio = {};
            mode.gpio.active = true;
            var direction = fs.readFileSync(directionFile, 'utf-8');
            direction = direction.replace(/^\s+|\s+$/g, '');
            mode.gpio.direction = direction;
            if(gpio[n] && gpio[n].path) {
                mode.gpio.allocated = true;
            } else {
                mode.gpio.allocated = false;
            }
        }
    }

    // Get pinmux settings
    var muxFile = '/sys/kernel/debug/omap_mux/' + pin.mux;
    var pinctrlFile = '/sys/kernel/debug/pinctrl/44e10800.pinmux/pins';
    var muxRegOffset = parseInt(pin.muxRegOffset, 16);
    var readOmapMux = function(err, data) {
        if(err) { 
            mode.err = 'readOmapMux error: ' + err;
            if(debug) winston.debug(mode.err);
            callback(mode);
        }
        mode = parse.modeFromOmapMux(data, mode);
        callback(mode);
    };
    var readPinctrl = function(err, data) {
        if(err) {
            mode.err = 'readPinctrl error: ' + err;
            if(debug) winston.debug(mode.err);
            callback(mode);
        }
        mode = parse.modeFromPinctrl(data, muxRegOffset, 0x44e10800, mode);
        callback(mode);
    };
    var tryPinctrl = function(exists) {
        if(exists) {
            fs.readFile(pinctrlFile, 'utf8', readPinctrl);
        } else {
            if(debug) winston.debug('getPinMode(' + pin.key + '): no valid mux data');
            callback(mode);
        }
    };
    var tryOmapMux = function(exists) {
        if(exists) {
            fs.readFile(muxFile, 'utf8', readOmapMux);
        } else {
            my.file_exists(pinctrlFile, tryPinctrl);
        }
    };
    if(callback) {
        my.file_exists(muxFile, tryOmapMux);
    } else {
        try {
            var data = fs.readFileSync(muxFile, 'utf8');
            mode = parse.modeFromOmapMux(data, mode);
        } catch(ex) {
            try {
                var data2 = fs.readFileSync(pinctrlFile, 'utf8');
                mode = parse.modeFromPinctrl(data2, muxRegOffset, 0x44e10800, mode);
            } catch(ex2) {
                if(debug) winston.debug('getPinMode(' + pin.key + '): ' + ex2);
            }
        }
        return(mode);
    }
};
app.get('/success', function(req, res){
	winston.debug('GET /success');
  res.sendfile('views/success.html');
});
Пример #27
0
 function(reason){
   logger.debug('intuit-cad::client::could not get customer accounts because: ', reason);
   deferred.reject(reason);
 });
app.get('/failure', function(req, res){
	winston.debug('GET /failure');
  res.sendfile('views/failure.html');
});
Пример #29
0
 function(reason){
   var message ='intuit-cad::client::oauthTokenCheck::could not get new token because';
   logger.debug(message, reason);
   deferred.reject(reason)
 });
Пример #30
0
 User.update({_id:userId},{$set:investorInfo},function(err,user){
   logger.debug("user: "******" updated for event: " + event);
 });