From d9dc8faae47d0e6bbc0af3565ad708d8d84effaa Mon Sep 17 00:00:00 2001 From: "adam j. sontag" Date: Wed, 11 Jul 2012 18:27:30 -0400 Subject: [PATCH] Basic stub out of functioning tasks, still decidedly v0.0.0 --- LICENSE-MIT | 22 ++++++++++++++++++++++ grunt.js | 40 ++++++++++++++++++++++++++++++++++++++++ package.json | 34 ++++++++++++++++++++++++++++++++++ tasks/wintersmith.js | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 LICENSE-MIT create mode 100644 grunt.js create mode 100644 package.json create mode 100644 tasks/wintersmith.js diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..cdbc423 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2012 adam j. sontag + +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. diff --git a/grunt.js b/grunt.js new file mode 100644 index 0000000..380127d --- /dev/null +++ b/grunt.js @@ -0,0 +1,40 @@ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + test: { + files: ['test/**/*.js'] + }, + lint: { + files: ['grunt.js', 'tasks/**/*.js', 'test/**/*.js'] + }, + watch: { + 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'); + +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..a4743d5 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "author": "adam j. sontag (http://ajpiano.com)", + "name": "grunt-wintersmith", + "description": "A grunt task and helpers for invoking the Wintersmith static site generator", + "version": "0.0.0", + "homepage": "https://github.com/ajpiano/grunt-wintersmith", + "repository": { + "type": "git", + "url": "git://github.com/ajpiano/grunt-wintersmith.git" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/ajpiano/grunt-wintersmith/blob/master/LICENSE-MIT" + } + ], + "main": "grunt.js", + "dependencies": { + "grunt": "0.3.x", + "wintersmith": "1.0.x", + "js-yaml": "1.0.x" + }, + "devDependencies": { + "grunt": "~0.3.x", + "wintersmith": "1.0.x", + "js-yaml": "1.0.x" + }, + "keywords": [ + "gruntplugin" + ], + "engines": { + "node": "*" + } +} diff --git a/tasks/wintersmith.js b/tasks/wintersmith.js new file mode 100644 index 0000000..e92d3e8 --- /dev/null +++ b/tasks/wintersmith.js @@ -0,0 +1,39 @@ +module.exports = function(grunt) { + + var wintersmith = require("wintersmith"); + + grunt.registerTask("wintersmith", "Use the wintersmith static site generator", function() { + var config = grunt.config("wintersmith"), + done = this.async(); + + grunt.helper("wintersmith", config, function(error) { + if ( error ) { + grunt.warn("Wintersmithing failed."); + } else { + done(); + } + }); + }); + + grunt.registerTask("wintersmith-ordered", "Use the wintersmith static site generator, respecting an order.yaml file", function(){ + var config = grunt.config("wintersmith-ordered"), + done = this.async(); + + grunt.helper("wintersmith-tree", config, function(error, tree) { + if ( error ) { + grunt.warn("Wintersmithing failed."); + } else { + done(); + } + }); + }); + + grunt.registerHelper("wintersmith", function(options, callback) { + wintersmith( options, callback ); + }); + + grunt.registerHelper("wintersmith-tree", function(options, callback) { + wintersmith.loadContents( options.contents, callback ); + }); + +};