Returns a promise that contains the installed platform version (vs the CLI version). Works in both new and old versions of the Cordova. (No cordova-lib API exists.)
960021
function getInstalledPlatformVersion(projectPath, platform) {
    var platformJsonPath = path.join(projectPath, 'platforms', 'platforms.json')
    if (fileExistsSync(platformJsonPath)) {
        var platformsJson = require(path.join(projectPath, 'platforms', 'platforms.json'));
        return Q(platformsJson[platform]);
    } else {
        return exec(path.join(projectPath, 'platforms', platform, 'cordova', 'version')).then(function (result) {
            return result[0].replace(/\r?\n|\r/g, '');
        });
    }
}
1210172
function getPlatVersionsFromFile(platformsJsonFile){

    var platformData;

    // Handle 'file not found' exception and stay within the 'promise monad'
    try{
        platformData = getJson(platformsJsonFile);
    } catch(e) {
        return Q.reject(e);
    }

    var platformVersions = [];

    platformVersions = Object.keys(platformData).map(function(p){
        return {platform: p, version: platformData[p]};
    });

    return Q(platformVersions);
}
932603
function resolveForVersion(version, platformID, opts) {
    opts = _.defaults(opts || {}, {
        // Order for filetype
        filePreference: ['.exe', '.dmg', '.deb', '.rpm', '.tgz', '.tar.gz', '.zip', '.nupkg'],
        wanted: null
    });

    // Prepare file prefs
    if (opts.wanted) opts.filePreference = _.uniq([opts.wanted].concat(opts.filePreference));

    // Normalize platform id
    platformID = detectPlatform(platformID);

    return _.chain(version.platforms)
        .filter(function(pl) {
            return pl.type.indexOf(platformID) === 0;
        })
        .sort(function(p1, p2) {
            var result = 0;

            // Compare by arhcitecture ("osx_64" > "osx")
            if (p1.type.length > p2.type.length) result = -1;
            else if (p2.type.length > p1.type.length) result = 1;

            // Order by file type if samee architecture
            if (result == 0) {
                var ext1 = path.extname(p1.filename);
                var ext2 = path.extname(p2.filename);
                var pos1 = _.indexOf(opts.filePreference, ext1);
                var pos2 = _.indexOf(opts.filePreference, ext2);

                pos1 = pos1 == -1? opts.filePreference.length : pos1;
                pos2 = pos2 == -1? opts.filePreference.length : pos2;

                if (pos1 < pos2) result = -1;
                else if (pos2 < pos1) result = 1;
            }
            return result;
        })
        .first()
        .value()
}
535475
function getProjectModule(context) {
    const projectRoot = getProjectRoot(context);
    const projectPath = path.join(projectRoot, "platforms", "ios");

    try {
      // pre 5.0 cordova structure
      return context
        .requireCordovaModule("cordova-lib/src/plugman/platforms")
        .ios.parseProjectFile(projectPath);
    } catch (e) {
      try {
        // pre 7.0 cordova structure
        return context
          .requireCordovaModule("cordova-lib/src/plugman/platforms/ios")
          .parseProjectFile(projectPath);
      } catch (e) {
        // post 7.0 cordova structure
        return getProjectModuleGlob(context);
      }
    }
  }
329563
function getPlatVersionsFromFileSystem(projectRoot){
    var platforms_on_fs = cordova_util.listPlatforms(projectRoot);
    var platformVersions = platforms_on_fs.map(function(platform){
        var script = path.join(projectRoot, 'platforms', platform, 'cordova', 'version');
        return Q.ninvoke(child_process, 'exec', script, {}).then(function(result){
            var version = result[0];

            // clean the version we get back from the script
            // This is necessary because the version script uses console.log to pass back
            // the version. Using console.log ends up adding additional line breaks/newlines to the value returned.
            // ToDO: version scripts should be refactored to not use console.log()
            var versionCleaned = version.replace(/\r?\n|\r/g, '');
            return {platform: platform, version: versionCleaned};
        });
    });

    return Q.all(platformVersions);
}
406276
def get_version():
    
    with open(os.path.join(DIR, 'include/libjsonnet.h')) as f:
        for line in f:
            if '#define' in line and 'LIB_JSONNET_VERSION' in line:
                v_code = line.partition('LIB_JSONNET_VERSION')[2].strip('\n "')
                if v_code[0] == "v":
                    v_code = v_code[1:]
                return v_code
1016389
function shouldPreferGlobalPromise(implementation){
  if(implementation){
    return implementation === 'global.Promise'
  } else if(typeof global.Promise !== 'undefined'){
    // Load global promise if implementation not specified
    // Versions < 0.11 did not have global Promise
    // Do not use for version < 0.12 as version 0.11 contained buggy versions
    var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version)
    return !(version && +version[1] == 0 && +version[2] < 12)
  }

  // do not have global.Promise or another implementation was specified
  return false
}
1058690
async function getVersions () {
  let versions = process.versions
  let prettyVersions = []
  versions.os = process.platform + ' ' + process.arch

  for (let variable in versions) {
    if (versions.hasOwnProperty(variable)) {
      prettyVersions.push(`${variable}: ${versions[variable]}`)
    }
  }

  try {
    const windowsVersion = await _getWindowsVersion()
    prettyVersions.push(windowsVersion.replace(/  +/g, ' '))
  } catch (error) {
    // Do nothing, we're okay with this failing.
    // Most common reason is we're not on an english
    // Windows.
  }

  return prettyVersions.join(' | ')
}
627197
def get_version():
    
    if not INSTALLED:
        try:
            with open('version.txt', 'r') as v_fh:
                return v_fh.read()
        except Exception:
            warnings.warn(
                'Unable to resolve package version until installed',
                UserWarning
            )
            return '0.0.0'  #can't parse version without stuff installed

    return p_version.get_version(HERE)
683611
function isPropagatingVersion(uri) {
  const version = uri.split('@')[1];

  return !!version && _.includes(propagatingVersions, version);
}
896289
function getVersion(req) {
   var version;
   if (!req.version) {
      if (req.headers && req.headers['accept-version']) {
         version = req.headers['accept-version'];
      }
   } else {
      version = String(req.version);
   }
   return version;
}
433669
private static boolean ensureVersion(Version existing, Version expected) {
        return existing != Version.UNDEFINED && existing.greaterThanOrEqualTo(expected);
    }
631223
function() {

    // Return the correct config
    switch (process.platform) {
      case 'darwin':
        return Promise.resolve({
          host: '127.0.0.1',
          socketPath: '/var/run/docker.sock'
        });
      case 'linux':
        return Promise.resolve({
          host: '10.13.37.100',
          port: '2375'
        });
      case 'win32':
        return Promise.resolve({
          host: '127.0.0.1',
          port: '2375'
        });
    }

  }
1200934
def version():
    '''
    
    '''
    _false_return = {'result': False,
                     'comment': 'OSQuery version unavailable.'}
    res = _osquery_cmd(table='osquery_info', attrs=['version'])
    if 'result' in res and res['result']:
        if 'data' in res and isinstance(res['data'], list):
            return res['data'][0].get('version', '') or _false_return
    return _false_return
155635
def get_version():
    """"""
    version = 'Not installed.'

    try:
        version = pkg_resources.get_distribution(__package__).version
    except pkg_resources.DistributionNotFound:
        pass

    return version
996891
def get_version():
    """"""
    pkg_dir = get_package_dir()
    with open(os.path.join(pkg_dir, 'nestcheck/_version.py')) as ver_file:
        string = ver_file.read()
    return string.strip().replace('__version__ = ', '').replace('\'', '')
922945
function ensureDockerVersion() {
    if (opts.generate) {
        return P.resolve(true);
    }
    return promisedSpawn(['docker', 'version', '--format', '{{.Server.Version}}'], {
        capture: true
    })
    .then((dockerVersion) => {
        if (!dockerVersion) {
            console.error('Docker is not found.');
            process.exit(1);
        }

        const minimumDockerVersion = os.type() === 'Darwin' ? '1.12.0' : '1.8.0';
        dockerVersion = dockerVersion.replace(/\.0+(0|[1-9]+)/g, '.$1');
        if (semver.lt(dockerVersion, minimumDockerVersion)) {
            console.error(`Building the deploy repo on ${os.type()} supported only with docker ${minimumDockerVersion}+`);
            process.exit(1);
        }
    });
}