From e4093d38056bcf06af7d5d4734fa3f985fd60a14 Mon Sep 17 00:00:00 2001 From: Jakub <jakub@skorepa.info> Date: Wed, 24 Feb 2016 17:17:26 +0100 Subject: [PATCH] Make it work on windows --- README.md | 19 +++++++++++++++++++ sitegin/input-hugo.js | 3 +-- sitegin/transformer-git.js | 19 +++++++++---------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7218b964..ea93d128 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Tento software pro psanĂ ÄŤlánkĹŻ NENĂŤ nutnĂ© instalovat. +ÄŚlánky mĹŻĹľete psát pĹ™Ămo z [webovĂ©ho rozhranĂ](https://git.ok1kvk.cz/ok1kvk.cz/content) # Jak to zprovoznit na fedoĹ™e # PĹ™idat repozitář nodejs - ve fedoĹ™e je verze 0.10.x @@ -5,3 +7,20 @@ sudo dnf -y install nodejs git ./configure.sh node index.js + +# Jak to zprovoznit na windows + +* Budeme potĹ™ebovat [git](https://git-scm.com/download/win) +* Dále budeme potĹ™ebovat [nodejs](https://nodejs.org/en/) - stáhnÄ›te si tu verzi, +na kterĂ© je nápis LTS. +* U obou nástrojĹŻ silnÄ› doporuÄŤuji nemÄ›nit žádná nastavenĂ! + +Po instalaci obou vÄ›cĂ pĹ™ejdÄ›te do nÄ›jakĂ© sloĹľky pomocĂ prĹŻzkumnĂka a kliknÄ›te na +`git bash`. Pak napište následujĂcĂ: + + git clone https://git.ok1kvk.cz/ok1kvk.cz/generator.git + cd generator + bash configure.sh + node index.js + +NynĂ otevĹ™ete prohlĂĹľeÄŤ a pĹ™ejdÄ›te na [localhost:1337](http://localhost:1337) diff --git a/sitegin/input-hugo.js b/sitegin/input-hugo.js index 4e44872c..f37c413c 100644 --- a/sitegin/input-hugo.js +++ b/sitegin/input-hugo.js @@ -37,7 +37,7 @@ var readPageWorker = function(file, articleName, contentDir) { obj.file = articleName.replace("articles","clanek"); obj.content = file.substring(fm_end+4); try { - obj.metadata = toml.parse(file.substring(0,fm_end-1)); + obj.metadata = toml.parse(file.substring(0,fm_end-1)+"\n"); } catch(e) { console.log(articleName+": Failed to parse metadata"); throw e; @@ -117,4 +117,3 @@ module.exports = function(_contentDir) { }); }; } - diff --git a/sitegin/transformer-git.js b/sitegin/transformer-git.js index 9ca3e887..c4488c93 100644 --- a/sitegin/transformer-git.js +++ b/sitegin/transformer-git.js @@ -60,13 +60,13 @@ var getFilesHistory = function() { diffs.forEach(function(data) { var commit = data[1]; var diff = data[0]; - + diff.forEach(function(entry) { - var path = entry.newFile().path(); - if(filehistory[path]===undefined) { - filehistory[path] = []; + var p = path.normalize(entry.newFile().path()); + if(filehistory[p]===undefined) { + filehistory[p] = []; } - filehistory[path].push(commit); + filehistory[p].push(commit); }); }); return filehistory; @@ -76,7 +76,7 @@ var getFilesHistory = function() { module.exports = function() { var tr = this; tr.fancyname = "transformer git"; - + tr.pre = function(cb, articleList) { getFilesHistory() .then((filesHistory) => { @@ -90,7 +90,7 @@ module.exports = function() { if(commits !== undefined) { var newestCommit = commits[0]; var oldestCommit = commits[commits.length-1]; - + if(article.metadata.date == undefined) article.metadata.date = {}; @@ -109,16 +109,15 @@ module.exports = function() { article.commits = commits; } - + todo--; if(todo == 0) cb(); }); }) .catch(function(err) {console.log(err.stack);}); } - + tr.forEachPage = function(article, cb) { cb(); } } - -- GitLab