Retrieve Jenkins version number from x-jenkins header.
If x-jenkins header does not exist, then it's assumed that the server is not a Jenkins instance.

@param {Function} cb: standard cb(err, result) callback
972738
function version(cb) {

  function _cb(err, result, response) {
    if (err) {
      cb(err);
    } else if (response.headers['x-jenkins']) {
      cb(null, response.headers['x-jenkins']);
    } else {
      cb(new Error(text.__('Not a Jenkins server')));
    }
  }
  this.remoteAccessApi.headJenkins(_cb);
}
1301534
function (cert, cb) {
    var infoObject = {},
        subjectElements = [],
        err;

  	var openssl = spawn('openssl', ['req', '-noout', '-subject', '-nameopt', 'RFC2253']);

    // Catch stderr
    openssl.stderr.on('data', function (out) {
      err = new Error(out);

      // Callback and return array
  		return cb(err, infoObject);
    });

    openssl.stdout.on('data', function (out) {
      var data = out.toString();

      // Put each line into an array
      var lineArray = data.split('\n');

      // Filter out empty ones
      lineArray = lineArray.filter(function(n){ return n !== undefined && n !== '' });

      /* Construct infoObject */

      // Certificate
      infoObject.certificate = cert;

      // Subject
      infoObject.subject = {};
      // Split by "/" prefix
      subjectElements = lineArray[0].replace('subject=', '').split(',');
      // For each elements
      for (var iS = 0; iS < subjectElements.length; iS++) {
        // Split keys and values by "=" separator
        var subjectKeyValue = subjectElements[iS].split('=');
        infoObject.subject[subjectKeyValue[0]] = subjectKeyValue[1];
      }

      // Callback and return array
  		return cb(err, infoObject);
  	});

  	openssl.stdin.write(cert);
  	openssl.stdin.end();
  }
1011681
function getVersion (plugin) {
  return new Promise(function (resolve, reject) {
    npm.commands.view([plugin, 'version'], function (err, data) {
      if (err) return reject(err)
      resolve(Object.keys(data)[0])
    })
  })
}
1252643
function (options, cb) {
		let stack = options.infra.stack;
		
		let nginxDeploymentName = options.soajs.registry.code.toLowerCase() + '-nginx';
		let deployer = {};
		let deployerConfig = {
			url: `https://${options.soajs.registry.deployer.container.kubernetes.remote.nodes}:${options.soajs.registry.deployer.container.kubernetes.remote.apiPort}`,
			version: 'v1',
			auth: {
				bearer: options.soajs.registry.deployer.container.kubernetes.remote.auth.token
			},
			request: {strictSSL: false}
		};
		
		//build namespace
		let namespace = options.soajs.registry.deployer.container.kubernetes.remote.namespace.default;
		if (options.soajs.registry.deployer.container.kubernetes.remote.namespace.perService) {
			namespace += '-' + nginxDeploymentName;
		}
		
		deployer.core = new K8Api.Core(deployerConfig);
		let nginxServiceName = nginxDeploymentName + '-service';
		deployer.core.namespaces(namespace).services.get({name: nginxServiceName}, (error, service) => {
			if (error) {
				return cb(error);
			}
			
			if (!service || !service.metadata || !service.metadata.name || !service.spec) {
				return cb(new Error("Nginx deployment not found!"));
			}
			
			let DNSIPAddress;
			if (service.spec.type === 'LoadBalancer' && service.status && service.status.loadBalancer && service.status.loadBalancer.ingress) {
				DNSIPAddress = service.status.loadBalancer.ingress[0].ip; //NOTE: not sure about this, need access to a gke deployment to verify it
			} else if (service.spec.type === 'NodePort' && service.spec.clusterIP) {
				DNSIPAddress = service.spec.clusterIP;
			}
			
			let mockedResponse = {
				"id": stack.id
			};
			
			if (DNSIPAddress) {
				mockedResponse = {
					"id": stack.id,
					"dns": {
						"msg": "<table>" +
							"<thead>" +
							"<tr><th>Field Type</th><th>Field Value</th></tr>" +
							"</thead>" +
							"<tbody>" +
							"<tr><td>DNS Type</td><td>A</td></tr>" +
							"<tr class='even'><td>Domain Value</td><td>%domain%</td></tr>" +
							"<tr><td>IP Address</td><td>" + DNSIPAddress + "</td></tr>" +
							"<tr class='even'><td>TTL</td><td>5 minutes</td></tr>" +
							"</tbody>" +
							"</table>"
					}
				};
			}
			
			return cb(null, mockedResponse);
		});
	}
428085
function convertVersionNumber (ver) {
    var hashVersion = {
        '18.0': '1.0.1',
        '18.1': '1.1',
        '26.0': '1.2',
        '28.0': '1.3',
        '30.0': '1.4',
        '32.0': '2.0'
    };
    var rver = ver;
    var sStr = ver.substring(0, 4);
    if (hashVersion[sStr]) {
        rver = hashVersion[sStr];
    }
    return (rver);

}
563925
function(args, cb) {
    var ssn = this.getSessionById(args.sessionId);
    if (!this._authFn) {
      var nodeEnv = process.env.NODE_ENV || "development";
      if (nodeEnv !== "development") {
        var msg = "The Node server you are connecting to appears "
        + "to be a production server, and yet its Vantage.js "
        + "instance does not support any means of authentication. \n"
        + "To connect to this server without authentication, "
        + "ensure its 'NODE_ENV' environmental variable is set "
        + "to 'development' (it is currently '" + nodeEnv + "').";
        ssn.log(chalk.yellow(msg));
        ssn.authenticating = false;
        ssn.authenticated = false;
        cb(msg, false);
      } else {
        ssn.authenticating = false;
        ssn.authenticated = true;
        cb(void 0, true);
      }
    } else {
      this._authFn.call(ssn, args, function(message, authenticated) {
        ssn.authenticating = false;
        ssn.authenticated = authenticated;
        if (authenticated === true) {
          cb(void 0, true);
        } else {
          cb(message);
        }
      });
    }
  }
769396
def _get_version():
    '''
    
    '''
    version_string = __salt__['cmd.run'](
        [_check_xbps(), '--version'],
        output_loglevel='trace')
    if version_string is None:
        # Dunno why it would, but...
        return False

    VERSION_MATCH = re.compile(r'(?:XBPS:[\s]+)([\d.]+)(?:[\s]+.*)')
    version_match = VERSION_MATCH.search(version_string)
    if not version_match:
        return False

    return version_match.group(1).split('.')
260672
function dashboard(cb) {
  return function (args) {
    function resultCb(result) {
      var jobs = result.jobs;
      if (_.isEmpty(jobs)) {
        console.log(text.__('Jobless Jenkins'));
      } else {
        jobs.forEach(function (job) {
          var status = util.statusByColor(job.color);
          var color  = util.colorByStatus(status, job.color);
          console.log('%s - %s', text.__(status)[color], job.name);
        });
      }
    }
    function jenkinsCb(jenkins) {
      jenkins.info(cli.exitCb(null, resultCb));
    }
    cb(args, jenkinsCb);
  };
}
1083402
function checkIfVersionUpdated() {

        var latestBuildNumber = updateJsonHandler.get("latestBuildNumber"),
            currentBuildNumber = Number(/-([0-9]+)/.exec(brackets.metadata.version)[1]);

        return latestBuildNumber === currentBuildNumber;
    }
1081698
function getUpdatedDeps (pkg, cb) {
  var opts = {
    stable: !argv.unstable,
    loose: true,
    error: {
      E404: argv.error404,
      ESCM: argv.errorSCM,
      EDEPTYPE: argv.errorDepType
    },
    ignore: argv.ignore || argv.i
  }

  if (argv.registry) {
    opts.npm = {registry: argv.registry}
  }

  david.getUpdatedDependencies(pkg, opts, function (err, deps) {
    if (err) return cb(err)

    david.getUpdatedDependencies(pkg, xtend(opts, {dev: true}), function (err, devDeps) {
      if (err) return cb(err)

      david.getUpdatedDependencies(pkg, xtend(opts, {optional: true}), function (err, optionalDeps) {
        cb(err, filterDeps(deps), filterDeps(devDeps), filterDeps(optionalDeps))
      })
    })
  })
}
681183
function checkServer(hostname, port, cb) {
      const self = this;
      //console.log(`[${this.counter}] checkServer`);

      if (self.status !== Status.STARTING) return;

      setTimeout(function _checkServer_fire() {
        http.request({
          method: 'HEAD',
          hostname: hostname,
          port: port
        }, function _checkServer_httpCallback(res) {
          const statusCodeType = Number(res.statusCode.toString()[0]);

          if ([2, 3, 4].indexOf(statusCodeType) !== -1) {
            return cb(true);
          } else if (statusCodeType === 5) {
            console.log(
              'Server docroot returned 500-level response. Please check ' +
              'your configuration for possible errors.'
            );
            return cb(true);
          }

          checkServer.call(self, hostname, port, cb);
        }).on('error', function _checkServer_httpError(err) {
          // back off after 1s
          if (++self.checkServerTries > 20) {
            console.log('PHP server not started. Retrying...');
            return cb(false);
          }
          checkServer.call(self, hostname, port, cb);
        }).end();
      }, 15);
    }
621501
private static @CheckForNull VersionNumber toVersion(@CheckForNull String versionString) {
        if (versionString == null) {
            return null;
        }

        try {
            return new VersionNumber(versionString);
        } catch (NumberFormatException e) {
            try {
                // for non-released version of Jenkins, this looks like "1.345 (private-foobar), so try to approximate.
                int idx = versionString.indexOf(' ');
                if (idx > 0) {
                    return new VersionNumber(versionString.substring(0,idx));
                }
            } catch (NumberFormatException ignored) {
                // fall through
            }

            // totally unparseable
            return null;
        } catch (IllegalArgumentException e) {
            // totally unparseable
            return null;
        }
    }
150278
function checkName(name, cb) {
  request(`https://registry.npmjs.org/${name}/latest`, {}, function(err, res, msg) {
    if (err) return cb(err);

    if (typeof msg === 'string' && msg === 'Package not found') {
      cb(null, false);
      return;
    }

    if (res && res.statusCode === 404) {
      return cb(null, false);
    }

    cb(null, true);
  });
}
376333
function isErrorHandler (cb) {
  var str = cb.toString()
  var args = str.split('(')[1].split(')')[0].split(',')
  return args.length === 4
}
896442
def get_version(self):
        """"""
        _, version = misc.get_version(self.confdir)
        if version is None:
            return "Can't get the version."
        else:
            return "cslbot - %s" % version
728962
function cmpVersion(a, b) {
    "use strict";
    var i, cmp, len, re = /(\.0)+[^\.]*$/;
    a = versionToString(a);
    b = versionToString(b);
    a = (a + '').replace(re, '').split('.');
    b = (b + '').replace(re, '').split('.');
    len = Math.min(a.length, b.length);
    for (i = 0; i < len; i++) {
        cmp = parseInt(a[i], 10) - parseInt(b[i], 10);
        if (cmp !== 0) {
            return cmp;
        }
    }
    return a.length - b.length;
}
1115517
def server_version(self) -> Version:
        """"""
        if self._server_version_cache is None:
            data = self._client.get("/version")
            self._server_version_cache = Version(data["version"])
        return self._server_version_cache