Giter Site home page Giter Site logo

Comments (5)

air avatar air commented on August 20, 2024

Another example. If I try to checkout then merge:

// FIXME merge fails, seems to happen before checkout is complete
gulp.task('publish', ['test'], function() {
  var version = require('./package.json').version;

  return gulp.src('.')
    .pipe(git.checkout('gh-pages'))
    .pipe(git.merge('master'))
    .pipe(git.commit('merged master ' + version + ' to gh-pages'))
    .pipe(git.push('origin', 'gh-pages'))
    .pipe(git.checkout('master'))
    .end();
});

The merge seems to fail early ('Already up to date') before the checkout has been done:

[gulp] Starting 'publish'...
[gulp] 'publish' errored after 13 ms Object #<ChildProcess> has no method 'pipe'
[gulp] Already up-to-date.
[gulp] Your branch is up-to-date with 'origin/gh-pages'.
 Switched to branch 'gh-pages'

from gulp-git.

stephenlacy avatar stephenlacy commented on August 20, 2024

What happens when you isolate the push into the on end?

gulp.task('release', function() {
  var version = require('./package.json').version;
  return gulp.src('.')
    .pipe(git.commit('released version ' + version))
    .on('end', function(){
      .pipe(git.push('origin', 'master'))
      .end();
    });

});

Merge is not a stream, it is a function. #3

from gulp-git.

stephenlacy avatar stephenlacy commented on August 20, 2024

Closing, I will reopen if needed.

from gulp-git.

air avatar air commented on August 20, 2024

Hi, thanks for responding. The code above needs a this added to work, so this is successful:

gulp.task('release', ['bump-version'], function() {
  var version = require('./package.json').version;

  return gulp.src('.')
    .pipe(git.commit('released version ' + version))
    .on('end', function(){
      this.pipe(git.push('origin', 'master'))
      .end();
    });
});

It sounds like there is a hard distinction between the stream tasks - like commit and checkout which are 'normal' gulp plugins and don't generate surprises - and the function ones, which need special treatment.

If the hard split is by design then the docs need to be much clearer about how you mix and match the task types.

from gulp-git.

air avatar air commented on August 20, 2024

No luck getting the merge workflow functional (checkout, merge, push, checkout). Can you confirm the below is how you envision real-world use?

gulp.task('checkoutPages', function() {
  return gulp.src('.').pipe(git.checkout('gh-pages'));
});

gulp.task('mergeMaster', function() {
  git.merge('master');
});

gulp.task('pushPages', function() {
  var version = require('./package.json').version;
  return gulp.src('.')
    .pipe(git.commit('merged master ' + version + ' to gh-pages'))
    .on('end', function(){
      this.pipe(git.push('origin', 'gh-pages'))
      .end();
    });
});

gulp.task('checkoutMaster', function() {
  return gulp.src('.').pipe(git.checkout('master'));
});

// merge master into gh-pages and push it
gulp.task('publish', ['checkoutPages', 'mergeMaster', 'pushPages', 'checkoutMaster'], function() {
  // no op  
});

n.b. My test project is at https://github.com/air/gulp-test

from gulp-git.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.