Skip to content
Browse files

update to 0.2.0 for compatibility with Grunt 0.4.0

  • Loading branch information...
1 parent ef5ead9 commit b8a651dd5d5e149e8907e7d9d22c35e6b7116082 Blaine Bublitz committed Feb 27, 2013
Showing with 102 additions and 106 deletions.
  1. +15 −0 .jshintrc
  2. +31 −0 Gruntfile.js
  3. +1 −1 LICENSE-MIT
  4. +19 −1 README.md
  5. +0 −2 bin/grunt-dojo
  6. +0 −42 grunt.js
  7. +8 −7 package.json
  8. +28 −23 tasks/dojo.js
  9. +0 −30 test/dojo_test.js
View
15 .jshintrc
@@ -0,0 +1,15 @@
+{
+ "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": {}
+}
View
31 Gruntfile.js
@@ -0,0 +1,31 @@
+module.exports = function(grunt) {
+
+ 'use strict';
+
+ // Project configuration.
+ grunt.initConfig({
+ watch: {
+ files: '<%= jshint.all %>',
+ tasks: 'default'
+ },
+ jshint: {
+ all: [
+ 'Gruntfile.js',
+ 'tasks/**/*.js'
+ ],
+ options: {
+ jshintrc: '.jshintrc'
+ }
+ }
+ });
+
+ // Load local tasks.
+ grunt.loadTasks('tasks');
+
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ // Default task.
+ grunt.registerTask('default', ['jshint']);
+
+};
View
2 LICENSE-MIT
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Blaine Bublitz
+Copyright (c) 2013 Blaine Bublitz
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
View
20 README.md
@@ -2,6 +2,12 @@
Build Dojo inside a Grunt task
+## Compatibility
+
+grunt-dojo `~0.2.0` works with Grunt `~0.4.0`
+
+For Grunt `~0.3.0`: use `grunt-dojo@0.1.2`
+
## Getting Started
Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-dojo`
@@ -19,6 +25,18 @@ grunt.loadNpmTasks('grunt-dojo');
```javascript
dojo: {
dist: {
+ options: {
+ dojo: 'path/to/dojo.js', // Path to dojo.js file in dojo source
+ load: 'build', // Optional: Utility to bootstrap (Default: 'build')
+ profile: 'app.profile.js', // Profile for build
+ package: '', // Optional: Location to search package.json (Default: nothing)
+ packages [], // Optional: Array of locations of package.json (Default: nothing)
+ cwd: './', // Directory to execute build within
+ dojoConfig: '' // Optional: Location of dojoConfig (Default: null)
+ }
+ },
+ options: {
+ // You can also specify options to be used in all your tasks
dojo: 'path/to/dojo.js', // Path to dojo.js file in dojo source
load: 'build', // Optional: Utility to bootstrap (Default: 'build')
profile: 'app.profile.js', // Profile for build
@@ -37,5 +55,5 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.
_(Nothing yet)_
## License
-Copyright (c) 2012 Blaine Bublitz
+Copyright (c) 2013 Blaine Bublitz
Licensed under the MIT license.
View
2 bin/grunt-dojo
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-require('grunt').npmTasks('grunt-dojo').cli();
View
42 grunt.js
@@ -1,42 +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'
- },
- 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
15 package.json
@@ -1,7 +1,7 @@
{
"name": "grunt-dojo",
"description": "Build Dojo inside a Grunt task",
- "version": "0.1.3",
+ "version": "0.2.0",
"homepage": "https://github.com/phated/grunt-dojo",
"author": {
"name": "Blaine Bublitz",
@@ -21,18 +21,19 @@
"url": "https://github.com/phated/grunt-dojo/blob/master/LICENSE-MIT"
}
],
- "main": "grunt.js",
- "bin": "bin/grunt-dojo",
+ "main": "Gruntfile.js",
"engines": {
- "node": "*"
+ "node": "~0.8.x"
},
"scripts": {
- "test": "grunt test"
+ "test": "grunt"
},
"devDependencies": {
- "grunt": "~0.3.17"
+ "grunt": "~0.4.0",
+ "grunt-contrib-jshint": "~0.2.0",
+ "grunt-contrib-watch": "~0.2.0"
},
"keywords": [
"gruntplugin"
]
-}
+}
View
51 tasks/dojo.js
@@ -2,58 +2,63 @@
* grunt-dojo
* https://github.com/phated/grunt-dojo
*
- * Copyright (c) 2012 Blaine Bublitz
+ * Copyright (c) 2013 Blaine Bublitz
* Licensed under the MIT license.
*/
module.exports = function(grunt) {
'use strict';
- // Please see the grunt documentation for more information regarding task and
- // helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md
-
- // ==========================================================================
- // TASKS
- // ==========================================================================
-
grunt.registerMultiTask('dojo', 'build dojo by spawning a child process', function(){
- var utils = grunt.utils;
var done = this.async();
+ var options = this.options({
+ dojo: null,
+ load: 'build',
+ profile: null,
+ package: null,
+ packages: null,
+ cwd: null,
+ dojoConfig: null
+ });
+
grunt.log.subhead('Building Dojo...');
var args = [];
- if(this.data.dojo){
- args.push(this.data.dojo);
- args.push('load=' + (this.data.load ? this.data.load : 'build'));
+ if(options.dojo){
+ args.push(options.dojo);
+ args.push('load=' + options.load);
- if(this.data.profile){
- args.push('--profile', this.data.profile);
+ if(options.profile){
+ args.push('--profile', options.profile);
}
- if(this.data.packages && Array.isArray(this.data.packages)){
- this.data.packages.forEach(function(packagePath){
+ if(options.packages && Array.isArray(options.packages)){
+ options.packages.forEach(function(packagePath){
args.push('--package', packagePath);
});
}
- if(this.data.package){
- args.push('--package', this.data.package);
+ if(options.package){
+ args.push('--package', options.package);
}
- if(this.data.dojoConfig){
- args.push('--dojoConfig', this.data.dojoConfig);
+ if(options.dojoConfig){
+ args.push('--dojoConfig', options.dojoConfig);
}
+ } else {
+ grunt.log.error('No dojo specified');
+ done(false);
}
var opts = {};
- if(this.data.cwd){
- opts.cwd = this.data.cwd;
+ if(options.cwd){
+ opts.cwd = options.cwd;
}
- utils.spawn({
+ grunt.util.spawn({
cmd: 'node',
args: args,
opts: opts
View
30 test/dojo_test.js
@@ -1,30 +0,0 @@
-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)
-*/
-
-exports['dojo'] = {
- setUp: function(done) {
- 'use strict';
-
- // setup here
- done();
- }
-};

0 comments on commit b8a651d

Please sign in to comment.
Something went wrong with that request. Please try again.