Permalink
Browse files

updated for grunt 0.4.0

  • Loading branch information...
1 parent 10aedb0 commit 717295534974915e4891771b41cea546421998e3 @jsoverson committed Feb 18, 2013
Showing with 71 additions and 109 deletions.
  1. +14 −0 .jshintrc
  2. +50 −0 Gruntfile.js
  3. +1 −0 README.md
  4. +0 −2 bin/grunt-env
  5. +0 −46 grunt.js
  6. +3 −5 package.json
  7. +3 −15 tasks/env.js
  8. +0 −41 test/env_test.js
View
@@ -0,0 +1,14 @@
+{
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true,
+ "es5": true
+}
View
@@ -0,0 +1,50 @@
+module.exports = function(grunt) {
+ "use strict";
+
+ // Project configuration.
+ grunt.initConfig({
+ env : {
+ options: {
+ globalOption : 'foo'
+ },
+ testData : {
+ data : 'bar'
+ },
+ testOptions : {
+ options : {
+ localOption : 'baz'
+ }
+ }
+ },
+ jshint: {
+ options: {
+ jshintrc : '.jshintrc'
+ },
+ task : ['tasks/**/*.js']
+ }
+ });
+
+ // Load local tasks.
+ grunt.loadTasks('tasks');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ var assert = require('assert');
+
+ grunt.registerTask('testData', function(grunt){
+ assert.equal(process.env.globalOption, 'foo', 'globalOption should be set');
+ assert.equal(process.env.data, 'bar', 'data should be set');
+ delete process.env.globalOption;
+ delete process.env.data;
+ });
+
+ grunt.registerTask('testOptions', function(grunt){
+ assert.equal(process.env.globalOption, 'foo', 'globalOption should be set');
+ assert.equal(process.env.localOption, 'baz', 'localOption should be set');
+ delete process.env.globalOption;
+ delete process.env.localOption;
+ });
+
+ // Default task.
+ grunt.registerTask('default', ['jshint','env:testData', 'testData', 'env:testOptions', 'testOptions']);
+
+};
View
@@ -43,6 +43,7 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.
## Release History
+- 0.2.0 grunt 0.4.0 support, simplified
- 0.1.0 Initial release
## License
View
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-require('grunt').npmTasks('grunt-env').cli();
View
@@ -1,46 +0,0 @@
-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');
-
-};
View
@@ -1,7 +1,7 @@
{
"name": "grunt-env",
"description": "Specify an ENV configuration for future tasks in the chain",
- "version": "0.1.1",
+ "version": "0.2.0",
"homepage": "https://github.com/onehealth/grunt-env",
"author": {
"name": "Jarrod Overson",
@@ -29,11 +29,9 @@
"scripts": {
"test": "grunt test"
},
- "dependencies": {
- "grunt-lib-contrib": "~0.4.0"
- },
"devDependencies": {
- "grunt": "~0.4.0"
+ "grunt": "~0.4.0",
+ "grunt-contrib-jshint": "~0.1.1"
},
"keywords": [
"gruntplugin",
View
@@ -8,20 +8,8 @@
"use strict";
-function task(grunt) {
+module.exports = function (grunt) {
grunt.registerMultiTask('env', 'Specify an ENV configuration for future tasks in the chain', function() {
-
- var helpers = require('grunt-lib-contrib').init(grunt);
- var options = helpers.options(this, this.data);
-
- grunt.verbose.writeflags(options, "Options");
-
- task.run(options);
+ grunt.util._.extend(process.env, this.options(), this.data);
});
-
- task.run = function(config) {
- grunt.util._.extend(process.env, config);
- };
-}
-
-module.exports = task;
+};
View
@@ -1,41 +0,0 @@
-"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 7172955

Please sign in to comment.