m19c / gulp-run

Pipe to shell commands in gulp
ISC License
151 stars 25 forks source link

How to amend the stream contents to the next command? #37

Closed binarykitchen closed 8 years ago

binarykitchen commented 9 years ago

Look at this example where I am incrementing the version and use the new version number in the git flow release start command:

function bumpAndTag(importance) {

    return gulp.src(['./package.json'])

        // bump the version number according to the given importance
        .pipe(plugins.bump({type: importance}))

        // amend the new version number to that command
        .pipe(plugins.run('git flow release start'))

        // save it back to filesystem
        .pipe(gulp.dest('./'))

        ...
}

That is not working of course because git flow release start requires a version number. Just am trying to explain my issue. How can I make the stream contents in .pipe(plugins.bump({type: importance})) be amended to git flow release start? So that it becomes git flow release start 1.3.19

m19c commented 8 years ago

First of all you need to extract the new version number. To do this a through2-stream should help. The stream should flush with an object (e.g. { version: 'XY' }). Now, the command should be able to parse something like <%= version %>.

binarykitchen commented 8 years ago

thx but i am afraid your response came in too late and already figured out something else