grunt-elevator

2.1.2 • Public • Published

grunt-elevator Build Status

Automatically elevate your grunt script's UAC privileges in windows.

Install

$ npm install --save grunt-elevator

Usage

// tasks/elevate.js
module.exports = function (grunt) {
  require("grunt-elevator")(grunt, {
    env: {
      //We need to copy these variables to the elevated process.
      names: ["HOME", "PATH", "SSH_AUTH_SOCK", "SSH_AGENT_PID"],
      tmp: "c:\\temp\\elevatedEnv.tmp", // optional - defaults to working directory
      cb: function (name, value) {
        if (name == "HOME" && process.env.HOMESHARE) {
          //We substitute HOME with HOMESHARE as the elevated process cannot access U:\
          return process.env.HOMESHARE;
        }
        else if ((name == "SSH_AUTH_SOCK" || name == "SSH_AGENT_PID") && !value) {
          //If the ssh-agent is not running then issue a warning.
          grunt.log.writeln(("You have not set " + name + ". This could cause you to be banned from git!").yellow.bold);
        }
      }
    },
    triggers: [
      /activate/,
      /deactivate/
    ],
    /* Set this to true if you need to get grunt-elevator working with grunt extensions
       that hook into grunt.log.header e.g. grunt-timer.  Otherwise leave it false or unset (the default)
    */
    writeHeader: true 
  });
};

License

MIT © Ciaran Jessup

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.1.2
    1
    • latest

Version History

Package Sidebar

Install

npm i grunt-elevator

Weekly Downloads

2

Version

2.1.2

License

MIT

Unpacked Size

9.05 kB

Total Files

5

Last publish

Collaborators

  • ciaranj