vojtajina / grunt-bump

Grunt.js plugin - Increment package version.
MIT License
651 stars 122 forks source link

Defaults are overriding my options #185

Closed kjhandy closed 8 years ago

kjhandy commented 8 years ago

Even though I've specified pushTo: 'origin', when I run grunt bump it tries to 'git push upstream master'.

grunt.config('bump', {
    options: {
        files: versionedFiles,
        commit: true,
        commitMessage: '[grunt-bump-plugin] Cut ' + grunt.config.get('pkg.name') + ' %VERSION%',
        commitFiles: ['-a'],
        createTag: true,
        tagName: '%VERSION%',
        tagMessage: '[grunt-bump-plugin] ' + grunt.config.get('pkg.name') + ' v%VERSION%',
        push: true,
        pushTo: 'origin',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=d'
    }
});

Running "bump" task Running grunt-bump in dry mode!

bump-dry: Version bumped to 0.0.3 (in package.json) bump-dry: git commit package.json -m "Release v0.0.3" bump-dry: git tag -a v0.0.3 -m "Version 0.0.3" bump-dry: git push upstream master && git push upstream v0.0.3

Done, without errors.

kjhandy commented 8 years ago

I've found the source of the problem. I factored out my grunt tasks to individual files so that grunt-bump is found in grunt/tasks/bump.js. For whatever reason, it sees my file, runs it (as I can see console.log's), and then runs node_modules/grunt-bump/tasks/bump.js, which is why I always see the defaults.

kjhandy commented 8 years ago

Just in case anyone has the same problem, I found my mistake. I had a config variable in one of my other grunt tasks that was overwriting grunt.config causing it to overwrite my options object with the default one when it got to the registerTask method.