From b341dd846bf989d430ea69f03582700a7c5e61b8 Mon Sep 17 00:00:00 2001 From: Ben Carlsson Date: Thu, 20 Mar 2014 00:23:57 -0700 Subject: [PATCH] Auto-check/make quotes files instead of failing --- .gitignore | 2 ++ commands/quote.js | 10 ++++++++++ quotes.txt | 1 - submitted-quotes.txt | 2 -- 4 files changed, 12 insertions(+), 3 deletions(-) delete mode 100644 quotes.txt delete mode 100644 submitted-quotes.txt diff --git a/.gitignore b/.gitignore index a0d235f..d79bc14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ oauth node_modules config.js +quotes.txt +submitted-quotes.txt diff --git a/commands/quote.js b/commands/quote.js index 3aed010..5cdc953 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -1,4 +1,14 @@ var fs = require('fs'); +fs.exists('quotes.txt', function (exists) { + if (!exists) { + fs.writeFile('quotes.txt', 'No quotes yet!\n'); + } +}); +fs.exists('submitted-quotes.txt', function (exists) { + if (!exists) { + fs.writeFile('submitted-quotes.txt', ''); + } +}); module.exports = function(argv, options) { options = options || {}; diff --git a/quotes.txt b/quotes.txt deleted file mode 100644 index 6cd2f7c..0000000 --- a/quotes.txt +++ /dev/null @@ -1 +0,0 @@ -Sorry, no quotes yet! diff --git a/submitted-quotes.txt b/submitted-quotes.txt deleted file mode 100644 index 2f9eb09..0000000 --- a/submitted-quotes.txt +++ /dev/null @@ -1,2 +0,0 @@ -No quotes yet! -"Test quote" -- knotmirror 0.0.1