tasks/releasebuild.js
function isCurrentBranch( branch ) {
      return function() {
        var deferred = Q.defer();

        Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
          .then(function( data ) {
            //console.log('data=',data);
            if ( data && data.trim() === branch ) {
              deferred.resolve(true);
            }
            else {
              throw new Error(format('Error. Branch [%s] is not the current branch. Output:[%s]', branch, data.trim()));
            }
          })
          .catch(function( err ) {
            console.log('err=',err);
            deferred.reject(err);
          });
        return deferred.promise;
      };
    }
function isCurrentBranch( branch ) {
      return function() {
        var deferred = Q.defer();

        Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
          .then(function( data ) {
            //console.log('data=',data);
            if ( data && data.trim() === branch ) {
              deferred.resolve(true);
            }
            else {
              throw new Error(format('Error. Branch [%s] is not the current branch. Output:[%s]', branch, data.trim()));
            }
          })
          .catch(function( err ) {
            console.log('err=',err);
            deferred.reject(err);
          });
        return deferred.promise;
      };
    }
function isCurrentBranch ( branch ) { return function ( ) { var deferred = Q . defer ( ) ; Q . fcall ( command ( 'git symbolic-ref --short -q HEAD' , 'Get current branch' ) ) . then ( function ( data ) { //console.log('data=',data); if ( data && data . trim ( ) === branch ) { deferred . resolve ( true ) ; } else { throw new Error ( format ( 'Error. Branch [%s] is not the current branch. Output:[%s]' , branch , data . trim ( ) ) ) ; } } ) . catch ( function ( err ) { console . log ( 'err=' , err ) ; deferred . reject ( err ) ; } ) ; return deferred . promise ; } ; }
Test if a brach is the current one
@param branch
@returns {Function}
Test if a brach is the current one