carkraus avatar carkraus committed e7998af

Little cleanup & prep distribution

Comments (0)

Files changed (5)

 module.exports = function(grunt) {
-
-  // Project configuration.
   grunt.initConfig({
     test: {
       files: ['test/**/*.js']
       icons: {
         src: 'test/assets/icons',
         // dest: 'test/assets/icons_out',
-        opts: '--css=test/assets/out --img=test/assets/out --less --namespace=ico --optipng'
+        options: '--css=test/assets/out --img=test/assets/out --less --namespace=ico --optipng'
       }
       // ,
       // bgs: {
     }
   });
 
-  // Load local tasks.
   grunt.loadTasks('tasks');
-
-  // Default task.
-  // grunt.registerTask('default', 'lint test');
   grunt.registerTask('default', 'watch');
-
 };
 # grunt-glue
 
-The best grunt tasks ever.
+A grunt plugin for the glue spriting tool(https://github.com/jorgebastida/glue).
 
 ## Getting Started
+Install glue. See http://glue.readthedocs.org/en/latest/installation.html.
+
 Install this grunt plugin next to your project's [Gruntfile][getting_started] with: `npm install grunt-glue`
 
-Then add this line to your project's Gruntfile:
+Next, add this line to your project's Gruntfile:
 
 ```javascript
 grunt.loadNpmTasks('grunt-glue');
 ## Documentation
 _(Coming soon)_
 
-## 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
-_(Nothing yet)_
-
 ## License
-Copyright (c) 2012 carsten  
+Copyright (c) 2012 Carsten Kraus
 Licensed under the MIT license.
 {
   "name": "grunt-glue",
-  "description": "The best grunt tasks ever.",
+  "description": "A grunt plugin for the glue spriting tool.",
   "version": "0.1.0",
   "homepage": "https://bitbucket.org/carkraus/grunt-glue",
   "author": {
-    "name": "carsten",
+    "name": "Carsten Kraus",
     "email": "carsten.kraus@gmail.com"
   },
   "repository": {
   "engines": {
     "node": ">= 0.6.0"
   },
-  "scripts": {
-    "test": "grunt test"
-  },
   "dependencies": {
     "grunt": "~0.4.0a"
   },
 /**
- * grunt-glue
- * https://github.com/carsten/grunt-glue
+ * grunt-glue - A wrapper for the glue spriting tool.
+ * @see https://bitbucket.org/carkraus/grunt-glue
+ * @see https://github.com/jorgebastida/glue
  *
- * Copyright (c) 2012 carsten
+ * Copyright (c) 2012 Carsten Kraus
  * Licensed under the MIT license.
  */
 
   // ==========================================================================
   // TASKS
   // ==========================================================================
-  grunt.registerMultiTask('glue', 'Glue wrapper.', function() {
+  grunt.registerMultiTask('glue', 'A wrapper for the glue spriting tool.', function() {
     var done = this.async(),
         config = this.data,
         src = config.src,
-        dest = config.dest;
-        opts = config.opts
-    // var options = this.options({
-    //   separator: null,
-    //   banner: grunt.config('banner') || '',
-    //   uglify: {}
-    // });
+        dest = config.dest,
+        opts = config.options;
+    // Build the command
+    var cmd = ['glue', src];
+    if(dest) cmd.push(dest);
+    if(opts) cmd.push(opts);
+    // grunt.log.debug(cmd.join(' '));
 
-    var cmd = 'glue';
-    cmd += ' ' + src;
-    if(dest) {
-      cmd += ' ' + dest;
-    }
-    if(opts) {
-      cmd += ' ' + opts;
-    }
-    grunt.log.debug(cmd);
-    exec(cmd, function(err, stdout, stderr) {
-      if (err) throw err;
+    // Execute
+    exec(cmd.join(' '), function(err, stdout, stderr) {
+      if (err) {
+        throw err;
+      }
       if (stderr) {
+        done();
         return false;
       }
       done();
     });
   });
-
-  // ==========================================================================
-  // HELPERS
-  // ==========================================================================
-  grunt.registerHelper('glue', function(src, target, options) {
-    // grunt.log.writeln(src);
-    // grunt.log.writeln(target);
-    // grunt.log.writeln(options);
-    // grunt.log.writeln(grunt.toString());
-    // return 'glue ' + src;
-  });
-
 };

test/glue_test.js

-var grunt = require('grunt'),
-    rimraf = require('rimraf');
+/**
+ * Nothing here for now.
+ */
+
+
+// var grunt = require('grunt'),
+//     rimraf = require('rimraf');
 
 /*
   ======== A Handy Little Nodeunit Reference ========
     test.ifError(value)
 */
 
-exports['glue'] = {
-  setUp: function(done) {
-    // Sample dir
-    var sampleDir = '';
-    // Test output
-    var outDir = '/tmp/glueTestOut';
-    grunt.file.mkdir(outDir)
-    done();
-  },
-  tearDown: function(done) {
-    // Test output
-    var outDir = '/tmp/glueTestOut';
-    rimraf.sync(outDir);
-    done();
-  },
-  'helper': function(test) {
-    // tests here
-    test.equal(grunt.helper('glue', 'foo'), 'glue foo', 'should return the correct value.');
-    test.done();
-  }
-};
+// exports['glue'] = {
+//   setUp: function(done) {
+//     // Sample dir
+//     var sampleDir = '';
+//     // Test output
+//     var outDir = '/tmp/glueTestOut';
+//     grunt.file.mkdir(outDir)
+//     done();
+//   },
+//   tearDown: function(done) {
+//     // Test output
+//     var outDir = '/tmp/glueTestOut';
+//     rimraf.sync(outDir);
+//     done();
+//   },
+//   'helper': function(test) {
+//     // tests here
+//     test.equal(grunt.helper('glue', 'foo'), 'glue foo', 'should return the correct value.');
+//     test.done();
+//   }
+// };
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.