{"name":"grunt-env","description":"Specify an ENV configuration for future tasks in the chain","version":"0.2.1","homepage":"https://github.com/onehealth/grunt-env","author":{"name":"Jarrod Overson","email":"jsoverson@gmail.com","url":"http://jarrodoverson.com/"},"repository":{"type":"git","url":"git://github.com/onehealth/grunt-env.git"},"bugs":{"url":"https://github.com/onehealth/grunt-env/issues"},"licenses":[{"type":"Apache2","url":"https://github.com/onehealth/grunt-env/blob/master/LICENSE-Apache2"}],"main":"grunt.js","engines":{"node":"*"},"scripts":{"test":"grunt test"},"devDependencies":{"grunt":"~0.4.0","grunt-contrib-jshint":"~0.1.1"},"keywords":["gruntplugin","env","config"],"_id":"grunt-env@0.2.1","dist":{"shasum":"0f6fddf66ecfa4c8585092fbdf90c32b1b9b5065","tarball":"http://registry-npm.ywwl.com/grunt-env/download/grunt-env-0.2.1.tgz","integrity":"sha512-aOQg7zSU5Qi5kE0yDvCNgf2L84UxBio1uXtpObV5hGyI3EloKjlcg2tqzVGw6GEiJX1hPJAyn+tZsmZ805NDgA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLWl/Vqc83skKoqjn+YGuiJAe7r2I/pnozly+SGJM1RQIgFDvp9tJV2CILs8uXY4+RutGZPq62+o/WeEJTCkS4w5Q="}],"size":6456,"noattachment":false,"key":"/grunt-env/-/grunt-env-0.2.1.tgz"},"_npmVersion":"1.1.66","_npmUser":{"name":"jsoverson","email":"jsoverson@gmail.com"},"maintainers":[{"name":"jsoverson","email":"jsoverson@gmail.com"}],"directories":{},"readme":"# grunt-env [![Build Status](https://secure.travis-ci.org/jsoverson/grunt-env.png?branch=master)](http://travis-ci.org/onehealth/grunt-env)\n\nSpecify an ENV configuration as a task, e.g.\n\n```\ngrunt.registerTask('dev', ['env:dev', 'lint', 'server', 'watch']);\ngrunt.registerTask('build', ['env:build', 'lint', 'other:build:tasks']);\n```\n\n## Getting Started\nInstall this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-env`\n\nThen add this line to your project's `grunt.js` gruntfile:\n\n```javascript\ngrunt.loadNpmTasks('grunt-env');\n```\n\n[grunt]: http://gruntjs.com/\n[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md\n\n## Configuration\n\n```js\n  env : {\n    options : {\n \t//Shared Options Hash\n    },\n    dev : {\n      NODE_ENV : 'development',\n      DEST     : 'temp'\n    },\n    build : {\n      NODE_ENV : 'production',\n      DEST     : 'dist',\n      concat   : {\n        PATH     : {\n          'value': 'node_modules/.bin',\n          'delimiter': ':'\n        }\n      }\n    },\n    functions: {\n      BY_FUNCTION: function() {\n        var value = '123';\n        grunt.log.writeln('setting BY_FUNCTION to ' + value);\n        return value;\n      }\n    }\n  }\n```\n## Using external files\n\nYou can specify environment values in INI, JSON or YAML style and load them via the src option.\n\n```js\n  env : {\n    dev : {\n      src : \"dev.json\"\n    },\n    prod: {\n      src: \"settings.yaml\"\n    }\n    heroku : {\n      src : \".env\"\n    }\n  }\n```\n\n## Using envdir\n\nYou can specify files to read environment variables from, similar to the daemontools [envdir](http://cr.yp.to/daemontools/envdir.html) utility.\n\n```js\n  env : {\n    dev : {\n      src : [\"envdir/*\"],\n      options: {\n        envdir: true\n      }\n    }\n  }\n```\n\n## Dynamic ENV configuration\n\nThe following directives can be specified in the `options` to alter the environment in more specific ways\n\n- `add`\n  - This will add the variables *only* if they don't already exist\n- `replace`\n  - Will replace the variable with the value specified\n- `unshift`\n  - Will prepend the value to the variable specified, optionally specifying a 'delimiter'\n- `push`\n  - Same as unshift, but at the end of the value.\n- `concat`\n  - Functionally same as `push`, added for readability\n\n```\nyourtask : {\n  USER : 'you',\n  PATH : '/bin:/usr/bin'\n\n  options : {\n    add : {\n      VERBOSE : '1' // will only be added if VERBOSE isn't already set\n    },\n    replace : {\n      USER : 'me'\n    },\n    push : {\n      PATH : {\n        value : '~/bin',\n        delimiter : ':'\n      }\n    },\n    unshift : {\n      PATH : '/sbin:'\n    }\n  }\n}\n```\n\n## Environment-specific configuration\n\nIn order to configure your tasks based on the environment, you need to define a task and use templates:\n\n```\n\ngrunt.initConfig({\n  env: {\n    dev: {\n      MY_CONST: 'a'\n    },\n    prod: {\n      MY_CONST: 'b'\n    }\n  },\n  myTask: {\n    options: {\n      myOpt: <%= MY_CONST %>\n    }\n  }\n});\n\ngrunt.registerTask('loadconst', 'Load constants', function() {\n    grunt.config('MY_CONST', process.env.MY_CONST);\n});\n\ngrunt.registerTask('default', [\n    'env:dev',\n    'loadconst',\n    'myTask'\n]);\n\n```\n\n## Important note on data types\n\nEnvironment variables are strings only. If you attempt to assign complex objects, they will be converted to strings.\n\n## Contributing\nIn 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][grunt].\n\n## Release History\n\n- 0.4.0 Removed automatic parse, added ability to add ini or json style `src` files\n- 0.3.0 Automatically parses .env files now\n- 0.2.1 fixed npm install\n- 0.2.0 grunt 0.4.0 support, simplified\n- 0.1.0 Initial release\n\n## License\n\nLicensed under the Apache 2.0 license.\n\n## Author\n\nJarrod Overson\n","publish_time":1361221592308,"_cnpm_publish_time":1361221592308,"dist-tags":{"latest":"1.0.1"}}