Permalink
Browse files

initial commit

  • Loading branch information...
jsoverson committed Oct 24, 2012
0 parents commit ee4da5dc4b94ff14de60354a4c11484f0bad97df
Showing with 213 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 .npmignore
  3. +13 −0 LICENSE
  4. +47 −0 README.md
  5. +2 −0 bin/grunt-env
  6. +46 −0 grunt.js
  7. +40 −0 package.json
  8. +22 −0 tasks/env.js
  9. +41 −0 test/env_test.js
@@ -0,0 +1 @@
node_modules
@@ -0,0 +1 @@
/node_modules/
13 LICENSE
@@ -0,0 +1,13 @@
Copyright 2012 OneHealth Solutions, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,47 @@
# grunt-env
Specify an ENV configuration as a task, e.g.
```
grunt.registerTask('dev', 'env:dev lint test');
grunt.registerTask('build', 'env:build lint test');
```
## Getting Started
Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-env`
Then add this line to your project's `grunt.js` gruntfile:
```javascript
grunt.loadNpmTasks('grunt-env');
```
[grunt]: http://gruntjs.com/
[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md
## Configuration
```js
env : {
dev : {
env_var : 'env value'
}
}
```
## Contributing
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][grunt].
## Release History
- 0.1.0 Initial release
## License
Copyright (c) 2012 OneHealth Solutions, Inc
Licensed under the Apache 2.0 license.
## Author
Jarrod Overson
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('grunt').npmTasks('grunt-env').cli();
@@ -0,0 +1,46 @@
module.exports = function(grunt) {
"use strict";
// Project configuration.
grunt.initConfig({
test: {
files: ['test/**/*.js']
},
lint: {
files: ['grunt.js', 'tasks/**/*.js', 'test/**/*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'default'
},
env : {
test : {
foo : 'bar'
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true,
es5: true
},
globals: {}
}
});
// Load local tasks.
grunt.loadTasks('tasks');
// Default task.
grunt.registerTask('default', 'lint test');
};
@@ -0,0 +1,40 @@
{
"name": "grunt-env",
"description": "Specify an ENV configuration for future tasks in the chain",
"version": "0.1.0",
"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",
"bin": "bin/grunt-env",
"engines": {
"node": "*"
},
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt": "~0.3.17"
},
"keywords": [
"gruntplugin",
"env",
"config"
]
}
@@ -0,0 +1,22 @@
/*
* grunt-env
* https://github.com/onehealth/grunt-env
*
* Copyright (c) 2012 OneHealth Solutions, inc
* Licensed under the Apache 2.0 license.
*/
"use strict";
function task(grunt) {
grunt.registerMultiTask('env', 'Your task description goes here.', function() {
task.run(this.data);
});
task.run = function(config) {
grunt.utils._.extend(process.env, config);
};
}
module.exports = task;
@@ -0,0 +1,41 @@
"use strict";
var grunt = require('grunt');
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/
var task = require('../tasks/env');
exports['env'] = {
setUp: function(done) {
// setup here
done();
},
'helper': function(test) {
test.expect(1);
task.run({
bar : 'bar'
});
test.equal(process.env.bar, 'bar', 'Should set environment');
test.done();
}
};

0 comments on commit ee4da5d

Please sign in to comment.