2.1.2 • Published 4 years ago

grunt-elevator v2.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

6 years ago

2.0.0

7 years ago

1.0.0

7 years ago