diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-02-03 07:02:32 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-02-03 07:02:32 +0800 |
commit | afb60b9061109d06fa678c730a3b0716d5718777 (patch) | |
tree | 66a8d43cbf8a7853b60089d70622c6e07175db9a /notices/notice-generator.js | |
parent | 3afa3592feef33070a997e53cf3a8b358c5ff703 (diff) | |
download | tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.gz tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.bz2 tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.lz tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.xz tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.zst tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.zip |
modification of notices.
Diffstat (limited to 'notices/notice-generator.js')
-rw-r--r-- | notices/notice-generator.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/notices/notice-generator.js b/notices/notice-generator.js new file mode 100644 index 000000000..a691bca15 --- /dev/null +++ b/notices/notice-generator.js @@ -0,0 +1,36 @@ +var fsp = require('fs-promise') +var path = require('path') +var prompt = require('prompt') +var open = require('open') +var extend = require('extend') +var notices = require('./notices.json') + +var id = 0 +var date = new Date().toDateString() + +var notice = { + read: false, + date: date, +} + +fsp.readdir('notices/archive') + .then((files) => { + files.forEach(file => { id ++ }) + Promise.resolve() + }).then(() => { + fsp.writeFile(`notices/archive/notice_${id}.md`,'Message goes here. Please write out your notice and save before proceeding at the command line.') + .then(() => { + open(`notices/archive/notice_${id}.md`) + prompt.start() + prompt.get(['title'], (err, result) => { + notice.title = result.title + fsp.readFile(`notices/archive/notice_${id}.md`) + .then((body) => { + notice.body = body.toString() + notice.id = id + notices.push(notice) + return fsp.writeFile(`notices/notices.json`, JSON.stringify(notices)) + }) + }) + }) + }) |