Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit e494c2433cdedf644e9b62dd61def23fc4e1189d @tkellen tkellen committed Oct 3, 2012
Showing with 175 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +2 −0 AUTHORS
  3. 0 CHANGELOG
  4. +43 −0 Gruntfile.js
  5. +22 −0 LICENSE-MIT
  6. +3 −0 README.md
  7. 0 docs/examples.md
  8. 0 docs/options.md
  9. 0 docs/overview.md
  10. +38 −0 package.json
  11. +64 −0 tasks/server.js
@@ -0,0 +1,3 @@
+node_modules
+npm-debug.log
+tmp
@@ -0,0 +1,2 @@
+"Cowboy" Ben Alman (http://benalman.com)
+Tyler Kellen (http://goingslowly.com)
No changes.
@@ -0,0 +1,43 @@
+/*
+ * grunt-contrib-server
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman, contributors
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ jshint: {
+ all: [
+ 'Gruntfile.js',
+ 'tasks/*.js'
+ ],
+ 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
+ }
+ }
+ });
+
+ // Actually load this plugin's task(s).
+ grunt.loadTasks('tasks');
+
+ // By default, lint task.
+ grunt.registerTask('default', ['jshint']);
+
+};
@@ -0,0 +1,22 @@
+Copyright (c) 2012 "Cowboy" Ben Alman, contributors
+
+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.
@@ -0,0 +1,3 @@
+# grunt-contrib-server (unreleased, for grunt v0.4.0a)
+
+> Concatenate files.
No changes.
No changes.
No changes.
@@ -0,0 +1,38 @@
+{
+ "name": "grunt-contrib-concat",
+ "description": "Concatenate files.",
+ "version": "0.4.0",
+ "homepage": "https://github.com/gruntjs/grunt-contrib-concat",
+ "author": {
+ "name": "\"Cowboy\" Ben Alman",
+ "email": "cowboy@rj3.net",
+ "url": "http://gruntjs.com/"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/gruntjs/grunt-contrib-concat.git"
+ },
+ "bugs": {
+ "url": "https://github.com/gruntjs/grunt-contrib-concat/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/gruntjs/grunt-contrib-concat/blob/master/LICENSE-MIT"
+ }
+ ],
+ "main": "Gruntfile.js",
+ "engines": {
+ "node": ">= 0.6.0"
+ },
+ "scripts": {
+ "test": "grunt test"
+ },
+ "devDependencies": {
+ "grunt-contrib-clean": "0.4.0a",
+ "grunt": "~0.4.0a"
+ },
+ "keywords": [
+ "gruntplugin"
+ ]
+}
@@ -0,0 +1,64 @@
+/*
+ * grunt-contrib-server
+ * http://gruntjs.com/
+ *
+ * Copyright (c) 2012 "Cowboy" Ben Alman, contributors
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Nodejs libs.
+ var path = require('path');
+
+ // External libs.
+ var connect = require('connect');
+
+ // ==========================================================================
+ // TASKS
+ // ==========================================================================
+
+ grunt.registerTask('server', 'Start a static web server.', function() {
+ // Merge task-specific options with these defaults.
+ var options = this.options({
+ port: 8000,
+ base: '.',
+ keepalive: false
+ });
+
+ // Connect requires the base path to be absolute.
+ var base = path.resolve(options.base);
+
+ // Sweet, sweet middleware.
+ var middleware = [
+ // Serve static files.
+ connect.static(base),
+ // Make empty directories browsable. (overkill?)
+ connect.directory(base)
+ ];
+
+ // If --debug was specified, enable logging.
+ if (grunt.option('debug')) {
+ connect.logger.format('grunt', ('[D] server :method :url :status ' +
+ ':res[content-length] - :response-time ms').magenta);
+ middleware.unshift(connect.logger('grunt'));
+ }
+
+ // Start server.
+ grunt.log.writeln('Starting static web server on port ' + options.port + '.');
+ connect.apply(null, middleware).listen(options.port);
+
+ // So many people expect this task to keep alive that I'm adding an option
+ // for it. Running the task explicitly as grunt:keepalive will override any
+ // value stored in the config. Have fun, people.
+ if (this.flags.keepalive || options.keepalive) {
+ // This is now an async task. Since we don't store a handle to the "done"
+ // function, this task will never, ever, ever terminate. Have fun!
+ this.async();
+ grunt.log.write('Waiting forever...');
+ }
+ });
+
+};

0 comments on commit e494c24

Please sign in to comment.