From bdec7437018c5286d70d416f9c2f09f23b392086 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 22 May 2018 14:10:37 +0200 Subject: [PATCH 1/2] add rescue statement for blog feed parsing --- _src/_plugins/blog.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/_src/_plugins/blog.rb b/_src/_plugins/blog.rb index e563b60..bbd7af1 100644 --- a/_src/_plugins/blog.rb +++ b/_src/_plugins/blog.rb @@ -8,18 +8,18 @@ module Jekyll # Runs during jekyll build class RssFeedCollector < Generator - safe true - priority :high - def generate(site) + safe true + priority :high + def generate(site) - rss_items = SimpleRSS.parse open('https://blog.bigchaindb.com/feed/') + rss_items = SimpleRSS.parse open('https://blog.bigchaindb.com/feed/') - # Create a new on-the-fly Jekyll collection called "articles" - jekyll_items = Jekyll::Collection.new(site, 'articles') - site.collections['articles'] = jekyll_items + # Create a new on-the-fly Jekyll collection called "articles" + jekyll_items = Jekyll::Collection.new(site, 'articles') + site.collections['articles'] = jekyll_items - # Add fake virtual documents to the collection - rss_items.items.each do |item| + # Add fake virtual documents to the collection + rss_items.items.each do |item| title = item.title link = item.link @@ -33,9 +33,10 @@ module Jekyll doc.data['link'] = link doc.data['image'] = image jekyll_items.docs << doc - end - - end + end + rescue + puts "Could not parse blog feed. Are you offline?" + end end end From 530f01994e15339b9cd364ff09d4b42aa2754564 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 22 May 2018 14:11:26 +0200 Subject: [PATCH 2/2] new logger for Jekyll task to show actual Jekyll output --- gulpfile.babel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 298cb50..cd3d483 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -125,7 +125,13 @@ export const jekyll = (done) => { const jekyll = cp.execFile('bundle', ['exec', jekyll_options], { stdio: 'inherit' }) - jekyll.on('error', (error) => onError() ).on('close', done) + const jekyllLogger = (buffer) => { + buffer.toString() + .split(/\n/) + .forEach((message) => console.log(message)) + } + + jekyll.stdout.on('data', jekyllLogger).on('close', done) }