How to use the bindings.getRoot function in bindings

To help you get started, we’ve selected a few bindings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intel / iotivity-node / grunt-build / tasks / options / iot-js-api.js View on Github external
module.exports = function( grunt ) {

var assignIn = require( "lodash.assignin" );
var path = require( "path" );
var ocfRunner = require( "iot-js-api" );
var results = require( "../../../tests/getresult" );

var packageRoot = path.join( require( "bindings" ).getRoot( __filename ) );
var preamblePath = path.join( packageRoot, "tests", "preamble" );
var generateSpawn = function( spawnFinal ) {
	return function( interpreter, commandLine ) {
		var preambleCommandLine;

		commandLine[ 2 ] = grunt.option( "ci" ) ?
			path.dirname( require.resolve( "iotivity-node" ) ) :
			packageRoot;

		preambleCommandLine = commandLine.slice();

		// argv[ 4 ] for the preamble means to clobber or not, not secure or not. Let's
		// make sure we clobber any previous test ACLs.
		preambleCommandLine[ 3 ] = false;

		require( preamblePath ).apply( this, preambleCommandLine );
github tessel / t2-cli / lib / tessel / deployment / javascript.js View on Github external
var binaries = glob.files(globRoot, patterns).reduce((bins, globPath) => {
      // Gather information about each found module
      var resolved = true;
      var modulePath = bindings.getRoot(globPath);
      var packageJson = require(path.join(globRoot, modulePath, 'package.json'));
      var binName = path.basename(globPath);
      var buildPath = path.normalize(globPath.replace(path.join(modulePath), '').replace(binName, ''));
      var buildType = (function() {
        var matches = buildPath.match(buildexp);
        if (matches && matches.length) {
          return matches[1];
        }
        return 'Release';
      }());

      // If the compiled module doesn't actually need a binary.node
      // injected into the bundle, then there is nothing to do.
      if (packageJson.tessel && packageJson.tessel.skipBinary) {
        return bins;
      }