How to use the simple-git.listRemote function in simple-git

To help you get started, we’ve selected a few simple-git 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 gregoryguillou / terraform-api / api / api / models / git.js View on Github external
function getBranches (project, callback) {
  const localProject = '/tmp/' + project.name
  require('simple-git')(localProject).listRemote(['--heads'], (err, heads) => {
    if (!err) {
      let output = []
      heads.split('\n').forEach(p => {
        if (p && p.split('\t')[1].match(/^refs\/heads\//)) {
          output.push(p.split('\t')[1].replace(/^refs\/heads\//, ''))
        }
      })
      callback(output)
    }
  })
}
github gregoryguillou / terraform-api / api / api / models / git.js View on Github external
function getTags (project, callback) {
  const localProject = '/tmp/' + project.name
  require('simple-git')(localProject).listRemote(['--tags'], (err, tags) => {
    if (!err) {
      let output = []
      tags.split('\n').forEach(p => {
        if (p && p.split('\t')[1].match(/^refs\/tags\//)) {
          output.push(p.split('\t')[1].replace(/^refs\/tags\//, ''))
        }
      })
      callback(output)
    }
  })
}
github wesleytodd / YeoPress / util / wordpress.js View on Github external
function getCurrentVersion(callback) {
	var latestVersion = '3.8';
	require('simple-git')().listRemote('--tags '+ wordpressRepo, function(err, tagsList) {
		if (err) return callback(err, latestVersion);
		tagList = ('' + tagsList).split('\n');
		tagList.pop();
		lastTag = /\d\.\d(\.\d)?/ig.exec(tagList.pop());
		if (lastTag !== null) {
			latestVersion = lastTag[0];
		}
		callback(null, latestVersion);
	});
};