A Grunt-Plugin to handle lockfiles within Grunt, currently just wraps lockSync of https://www.npmjs.org/package/lockfile
This plugin requires Grunt
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. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-lock-extended --save-dev
This modul was forked from https://github.com/evangelion1204/grunt-lock. I had some issues with handling lockfile with multi-thread processes.
If you are looking for a simple and easy to use lockfile-wrapper, i recommend grunt-lock.
The "lockfile" task
lockfile:your_target:path: 'yourname.lck'//you can add one task to be ignored by the lockfile task. - i use it for an unlock task with email-reportingignored:'taskToIgnore1''taskToIgnore2'//only allowed tasks can create a lockfile - other tasks will fail fatalallowed:'taskToAllow1''taskToAllow2'//if true, just the fails and warnings are loggedquiet: true|false
The path where your lockfile will be created
a string or an array of tasknames that will be ignored creating a lockfile
a string or an array of tasknames. Only there tasks will be able to run, if this option is set
quiet [optional - default=false]
STFU for this module. Just log what is really necessary!
Autostart the lock
To ensure the lockfile-task is invoked everytime you use grunt, you should add the following code right after grunt.initConfig()
The "lockfile" format
"user": "currentUser""pid": 12345"tasks": "theExecutedTask""created": "<creation time of lockfile in SQL-Format>"
This Module is supposed to be used on multiuser-systems. The generated lockfile will contain information about the invoking task. The Task adds the option "parentPid" with the current pid to the grunt-options. That allows us to start childprocesses, in which the current lockfile will not prevent execution.
To allow a childprocess the execucting user and the given parentPid have to match the ones in lockfile.
In your project's Gruntfile, add a section named
lockfile to the data object passed into
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
This plugin was inspired by https://github.com/evangelion1204/grunt-lock