Permalink
Browse files

grunt now concatinates and minifies, assembling the results into dist

  • Loading branch information...
1 parent f1785e1 commit cca03287ba3da85b635d9e8e4abfe104c909dd3b @robrich committed Oct 27, 2012
Showing 6,768 changed files with 1,374,968 additions and 159,769 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
View
@@ -3,3 +3,5 @@
.idea
*.orig
*.swp
+dist
+temp
View
@@ -8,9 +8,11 @@ How to Use
1. Reference jQuery (such as on [Google's CDN](https://developers.google.com/speed/libraries/devguide#jquery))
-2. Reference the css file: [http://cactusdraw.com/cactusdraw.css](http://cactusdraw.com/cactusdraw.css)
+2. Reference the css file: [http://cactusdraw.com/cactusdraw.min.css](http://cactusdraw.com/cactusdraw.min.css)
+or [http://cactusdraw.com/cactusdraw.css](http://cactusdraw.com/cactusdraw.css)
-3. Reference the javascript file: [http://cactusdraw.com/cactusdraw.js](http://cactusdraw.com/cactusdraw.js)
+3. Reference the javascript file: [http://cactusdraw.com/cactusdraw.min.js](http://cactusdraw.com/cactusdraw.min.js)
+or [http://cactusdraw.com/cactusdraw.js](http://cactusdraw.com/cactusdraw.js)
4. Create a div:
@@ -31,3 +33,7 @@ Sample
`<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>`
`<link rel="stylesheet" href="http://cactusdraw.com/cactusdraw.css" type="text/css" />`
`<script src="http://cactusdraw.com/cactusdraw.js"></script>`
+
+## License
+Copyright (c) 2012 Rob Richardson
+Licensed under the MIT license.
View
@@ -1,103 +0,0 @@
-/*global node:true */
-"use strict";
-
-//
-// The server
-//
-
-var express = require("express"),
- io = require("socket.io"),
- http = require("http");
-
-var app = express(),
- server = http.createServer(app),
- sio = io.listen(server);
-
-app.use(express.static(__dirname+'/www'));
-
-sio.configure(function () {
- /*
- https://github.com/learnboost/socket.io/wiki/Configuring-Socket.IO
- 0 - error
- 1 - warn
- 2 - info
- 3 - debug
- */
- sio.set('log level', 1);
-});
-
-var port = process.env.PORT || 8090;
-server.listen(port, function () {
- console.log("Listening on "+port);
-});
-
-// Store state so we can broadcast it to clients that connect late or reconnect
-var rooms = {};
-
-// -server is "from server to client"
-// -client is "from client to server"
-sio.sockets.on('connection', function (socket) {
- var theRoom = null;
-
- var broadcast = function (event, data) {
- sio.sockets.in(theRoom.room).emit(event, data)
- };
-
- socket.on('connect-client', function (data) {
- var room = 's-'+data;
- if (room === 's-' || room === 's-[object Object]') {
- socket.disconnect(); // You fail
- return;
- }
-
- // Create the session if it doesn't exist
- if (!Object.prototype.hasOwnProperty.call(rooms, room)) {
- rooms[room] = {
- drawing: [],
- img: null,
- room: room
- };
- }
- theRoom = rooms[room];
- socket.join(room);
-
- // Replay old data to the user
- if (theRoom.img) {
- theRoom.img.drawing = theRoom.drawing;
- socket.emit("image-server", theRoom.img);
- theRoom.img.drawing = undefined;
- } else if (theRoom.drawing.length > 0) {
- socket.emit("drawing-server", theRoom.drawing);
- }
- });
-
- socket.on('line-client', function (data) {
- if (!theRoom) {
- socket.disconnect();
- return;
- }
- theRoom.drawing.push(data);
- broadcast("line-server",data);
- });
-
- socket.on('image-client', function (data) {
- if (!theRoom) {
- socket.disconnect();
- return;
- }
- theRoom.img = data;
- theRoom.drawing = []; // Image overwrites it
- broadcast("image-server",data);
- });
-
- socket.on('clear-client', function (data) {
- if (!theRoom) {
- socket.disconnect();
- return;
- }
- theRoom.drawing = [];
- theRoom.img = null;
- broadcast("clear-server",data);
- });
-
-});
View
@@ -0,0 +1,126 @@
+/*global grunt:false, module:true */
+module.exports = function(grunt) {
+ "use strict";
+
+ grunt.loadNpmTasks('grunt-contrib');
+ grunt.loadNpmTasks('grunt-css');
+ grunt.loadNpmTasks('grunt-bump');
+
+ // Project configuration.
+ grunt.initConfig({
+ pkg: '<json:package.json>',
+ meta: {
+ banner: '/* Cactus Draw - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
+ '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
+ '* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
+ '* References Socket.IO (http://socket.io/)\n' +
+ '* References Modernizr (http://modernizr.com/)\n' +
+ '* References Really Simple Color Picker in jQuery (http://laktek.com/2008/10/27/really-simple-color-picker-in-jquery/)\n' +
+ '* Requires jQuery (http://jquery.com/)\n' +
+ '*/'
+ },
+ clean: {
+ temp: 'temp/',
+ dist: 'dist/'
+ },
+ test: {
+ files: ['test/**/*.js']
+ },
+ lint: {
+ files: ['grunt.js', 'src/app.js', 'src/www/!(modernizr|socket).js']
+ },
+ csslint: {
+ www: {
+ src: 'src/www/*.css',
+ rules: {
+ "box-model": false,
+ "universal-selector": false
+ }
+ }
+ },
+ concat: {
+ www: {
+ src: ['<banner:meta.banner>','src/www/!(cactus).js','src/www/cactus*.js'],
+ dest: 'dist/www/cactusdraw.js'
+ },
+ app: {
+ src: ['<banner:meta.banner>','src/app.js'],
+ dest: 'temp/app.js'
+ },
+ css: {
+ src: ['<banner:meta.banner>','<config:csslint.www.src>'],
+ dest: 'dist/www/cactusdraw.css'
+ }
+ },
+ min: {
+ www: {
+ src: ['<banner:meta.banner>','<config:concat.www.dest>'],
+ dest: 'dist/www/cactusdraw.min.js'
+ },
+ app: {
+ src: ['<banner:meta.banner>','<config:concat.app.dest>'],
+ dest: 'dist/app.js'
+ }
+ },
+ cssmin: {
+ www: {
+ src: ['<banner:meta.banner>','<config:csslint.www.src>'],
+ dest: 'dist/www/cactusdraw.min.css'
+ }
+ },
+ copy: {
+ www: {
+ files: {
+ 'dist/www/': [
+ 'src/www/*.html',
+ 'src/www/*.jpg',
+ 'src/www/*.png',
+ 'src/www/*.gif'
+ ]
+ }
+ },
+ app: {
+ files: {
+ 'dist/node_modules/express/': 'src/node_modules/express/**',
+ 'dist/node_modules/socket.io/': 'src/node_modules/socket.io/**'
+ }
+ },
+ main: {
+ files: {
+ 'dist/': [
+ 'README.md',
+ 'package.json'
+ ]
+ }
+ }
+ },
+ 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
+ }
+ }
+ });
+
+ // Default task.
+ grunt.registerTask('default', 'clean lint csslint test concat min cssmin copy');
+ grunt.registerTask('full', 'bump default');
+
+ // regular command:
+ // > grunt.cmd
+ // to also bump the version:
+ // > grunt.cmd full
+};
@@ -1,6 +0,0 @@
-var mkdirp = require('mkdirp');
-
-mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
- if (err) console.error(err)
- else console.log('pow!')
-});
@@ -0,0 +1 @@
+test/*
@@ -0,0 +1,33 @@
+# grunt-bump
+
+**Bump package version.**
+
+## Installation
+
+Install npm package, next to your project's `grunt.js` file:
+
+ npm install grunt-bump
+
+Add this line to your project's `grunt.js`:
+
+ grunt.loadNpmTasks('grunt-bump');
+
+
+## Usage
+
+Let's say current version is `0.0.1`.
+
+ grunt bump
+ >> Version bumped to 0.0.2
+
+ grunt bump:patch
+ >> Version bumped to 0.0.3
+
+ grunt bump:minor
+ >> Version bumped to 0.1.0
+
+ grunt bump
+ >> Version bumped to 0.1.1
+
+ grunt bump:major
+ >> Version bumped to 1.0.0
@@ -0,0 +1,15 @@
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ test: {
+ bump: ['test/*.spec.js']
+ },
+ });
+
+ // Load local tasks.
+ grunt.loadTasks('tasks');
+
+ // Default task.
+ grunt.registerTask('default', 'test');
+};
@@ -0,0 +1,15 @@
+#!/bin/sh
+basedir=`dirname "$0"`
+
+case `uname` in
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ "$basedir/node" "$basedir/../grunt/bin/grunt" "$@"
+ ret=$?
+else
+ node "$basedir/../grunt/bin/grunt" "$@"
+ ret=$?
+fi
+exit $ret
@@ -0,0 +1,6 @@
+:: Created by npm, please don't edit manually.
+@IF EXIST "%~dp0\node.exe" (
+ "%~dp0\node.exe" "%~dp0\..\grunt\bin\grunt" %*
+) ELSE (
+ node "%~dp0\..\grunt\bin\grunt" %*
+)
@@ -0,0 +1,2 @@
+node_modules
+/tmp
@@ -0,0 +1,22 @@
+Copyright (c) 2012 "Cowboy" Ben Alman
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
Oops, something went wrong. Retry.

0 comments on commit cca0328

Please sign in to comment.