From 8888337d20aa4c4baeee8b53e4564c431371f4fb Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Mon, 16 Jun 2014 16:08:19 +0100 Subject: [PATCH 1/7] Allow file extensions other than .swig --- tasks/swig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/swig.js b/tasks/swig.js index bce763b..7beda50 100644 --- a/tasks/swig.js +++ b/tasks/swig.js @@ -35,7 +35,7 @@ module.exports = function(grunt) { } else { var dirName = path.dirname(file).split('/'), destPath = dirName.splice(1, dirName.length).join('/'), - outputFile = path.basename(file, '.swig'), + outputFile = path.basename(file, path.extname(file)), htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + '.html', tplVars = {}, contextVars = {}; From 5dc76c8e2e564253e3dac2542379397d4516e2c9 Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Tue, 17 Jun 2014 13:16:58 +0100 Subject: [PATCH 2/7] Updated readme and package info --- README.md | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 607a4da..29e445d 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ This plugin requires Grunt `~0.4.1` If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: ```shell -npm install grunt-swig --save-dev +npm install grunt-swig-revsys --save-dev ``` One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: ```js -grunt.loadNpmTasks('grunt-swig'); +grunt.loadNpmTasks('grunt-swig-revsys'); ``` ## The "swig" task diff --git a/package.json b/package.json index 66816bf..5bc3190 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "grunt-swig", - "version": "0.2.1", + "name": "grunt-swig-revsys", + "version": "0.1.0", "description": "Static site compiler built around swig", "repository": { "type": "git", From e63d9c81a6b8d884a2308a4b3dc704774f5c3485 Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Mon, 30 Jun 2014 14:34:07 +0100 Subject: [PATCH 3/7] Added support for cwd option --- tasks/swig.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks/swig.js b/tasks/swig.js index 7beda50..f2a9054 100644 --- a/tasks/swig.js +++ b/tasks/swig.js @@ -28,12 +28,14 @@ module.exports = function(grunt) { } this.filesSrc.forEach(function(file) { + var cwd = globalVars.cwd || ""; + var relativePath = file; + file = cwd + file; if (!grunt.file.exists(file)) { - grunt.log.warn('Source file "' + file.src + '" not found.'); - + grunt.log.warn('Source file "' + file + '" not found.'); return false; } else { - var dirName = path.dirname(file).split('/'), + var dirName = path.dirname(relativePath).split('/'), destPath = dirName.splice(1, dirName.length).join('/'), outputFile = path.basename(file, path.extname(file)), htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + '.html', From a556b3d8f79ba1efb7a5d6d0e056107ec8efda05 Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Mon, 30 Jun 2014 14:41:54 +0100 Subject: [PATCH 4/7] Advanced version number to 0.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5bc3190..f3f3924 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grunt-swig-revsys", - "version": "0.1.0", + "version": "0.2.0", "description": "Static site compiler built around swig", "repository": { "type": "git", From 2b1f7be5c9c377f8d7df28cdc7c7755302fe1bd5 Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Thu, 16 Oct 2014 11:55:51 +0100 Subject: [PATCH 5/7] maintain file extension unless specified in config --- tasks/swig.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/swig.js b/tasks/swig.js index f2a9054..81d4859 100644 --- a/tasks/swig.js +++ b/tasks/swig.js @@ -35,10 +35,12 @@ module.exports = function(grunt) { grunt.log.warn('Source file "' + file + '" not found.'); return false; } else { + var ext = config.data.ext; + if(!ext){ext = path.extname(file);} var dirName = path.dirname(relativePath).split('/'), destPath = dirName.splice(1, dirName.length).join('/'), outputFile = path.basename(file, path.extname(file)), - htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + '.html', + htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + ext, tplVars = {}, contextVars = {}; From 23cacc7433f364c1c92bdda31ad03ff698a84c1f Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Thu, 16 Oct 2014 12:12:21 +0100 Subject: [PATCH 6/7] maintain directory structure --- package.json | 2 +- tasks/swig.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f3f3924..80868fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grunt-swig-revsys", - "version": "0.2.0", + "version": "0.3.0", "description": "Static site compiler built around swig", "repository": { "type": "git", diff --git a/tasks/swig.js b/tasks/swig.js index 81d4859..26e8fcc 100644 --- a/tasks/swig.js +++ b/tasks/swig.js @@ -38,7 +38,7 @@ module.exports = function(grunt) { var ext = config.data.ext; if(!ext){ext = path.extname(file);} var dirName = path.dirname(relativePath).split('/'), - destPath = dirName.splice(1, dirName.length).join('/'), + destPath = dirName.splice(0, dirName.length).join('/'), outputFile = path.basename(file, path.extname(file)), htmlFile = config.data.dest + '/' + destPath + '/' + outputFile + ext, tplVars = {}, From efbfcd9151dbf2835b135b9c80ce6b306181ad21 Mon Sep 17 00:00:00 2001 From: Adam Knight Date: Tue, 28 Oct 2014 15:38:13 +0000 Subject: [PATCH 7/7] Added travis notifications --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0ce3be2..568f32a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,9 @@ language: node_js node_js: - "0.10" before_script: - - npm install -g grunt-cli \ No newline at end of file + - npm install -g grunt-cli +notifications: + email: + - adam@revolutionarysystems.co.uk + - andrew@revolutionarysystems.co.uk + - ci@revolutionarysystems.co.uk \ No newline at end of file