From 9ab737a455a95b4ebf99cd2b79670d5a374edb17 Mon Sep 17 00:00:00 2001 From: bzsinger Date: Sun, 23 Jul 2017 15:23:24 -0500 Subject: [PATCH 1/3] add screenshots folder, nested results folders --- .gitignore | 1 + Makefile | 2 +- index.js | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8d87b1d..7ba6ef2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/* +screenshots/* diff --git a/Makefile b/Makefile index 0f8e3c3..a250109 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GREP ?=. test: node_modules - @rm -rf /tmp/niffy + @rm -rf ./screenshots @node_modules/.bin/mocha --harmony --grep "$(GREP)" node_modules: package.json diff --git a/index.js b/index.js index 56d6eec..91ad518 100644 --- a/index.js +++ b/index.js @@ -183,7 +183,15 @@ Niffy.prototype.stopProfile = function (name) { */ function imgfilepath(name, path) { - var filepath = '/tmp/niffy' + path; + + var folderExtension; + if (path === '/') { + folderExtension = 'homepage'; + } else { + folderExtension = path.substring(1).replace('/', '-'); + } + + var filepath = './screenshots/' + folderExtension; if (filepath.slice(-1) !== '/') filepath += '/'; mkdirp(filepath); return (filepath + name + '.png'); From b5972b02a9ca0afd7e688c581cc1c85df288ec9b Mon Sep 17 00:00:00 2001 From: bzsinger Date: Sun, 23 Jul 2017 15:24:04 -0500 Subject: [PATCH 2/3] add make clean command --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index a250109..ffc3bf9 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ test: node_modules @rm -rf ./screenshots @node_modules/.bin/mocha --harmony --grep "$(GREP)" +clean: screenshots + @rm -rf ./screenshots + node_modules: package.json @npm install From ab5545ea3e54f178c835fb8321952bd02ec4938c Mon Sep 17 00:00:00 2001 From: bzsinger Date: Fri, 4 Aug 2017 17:15:22 -0500 Subject: [PATCH 3/3] add nested folders for subdomains --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 91ad518..cbbb6c4 100644 --- a/index.js +++ b/index.js @@ -188,7 +188,7 @@ function imgfilepath(name, path) { if (path === '/') { folderExtension = 'homepage'; } else { - folderExtension = path.substring(1).replace('/', '-'); + folderExtension = path.substring(1); } var filepath = './screenshots/' + folderExtension;