Skip to content

andrezero/grunt-git-is-clean

Repository files navigation

grunt-git-is-clean

Build Status: Linux NPM version

Grunt task: checks if repository checkout is clean.

WARNING: This code is not maintained

Very obvious - but due - WARNING. Time flies, the world revolves, grunt became gulp became webpack, yada yada. Good memories!

Getting Started

This plugin requires Grunt ~0.4.0.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins.

Install the plugin with this command:

npm install grunt-git-is-clean --save-dev

Add this line to your project's Gruntfile.js gruntfile:

grunt.loadNpmTasks('grunt-git-is-clean');

The "git-is-clean" task

Run this task with the grunt git-is-clean command.

Note: there are no task targets, files or options for this task.

Overview

This purpose of this task is to abort a build if the current checkout is unclean. Useful to make sure everything is predictable while doing sensitive operations like automated releases.

Example

Assuming you are using the bump and conventional-changelog tasks to tag a pre-release:

grunt.registerTask('release', [
    'build',
    'test',
    'git-is-clean',
    'bump-only:minor',
    'changelog',
    'bump-commit'
]);

If the repository is dirty the task is aborted before running any tasks that have side-effects.

Running "git-is-clean" task
Fatal error: Repository is dirty.

Copyright (c) 2014 Andre Torgal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Just a little Grunt utility to check if checkout is clean

Resources

License

Stars

Watchers

Forks

Packages

No packages published