Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jarrod Overson
committed
Oct 24, 2012
0 parents
commit ee4da5d
Showing
9 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
#!/usr/bin/env node | |||
require('grunt').npmTasks('grunt-env').cli(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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'); | |||
|
|||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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" | |||
] | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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; | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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(); | |||
} | |||
}; |