diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-02-08 10:55:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 10:55:26 +0800 |
commit | c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9 (patch) | |
tree | 139d5dfad53652b50e0af07c3aec37394b3b654b /notices | |
parent | ffe588365cb2dd84906613d13ad8e35b08a08dbb (diff) | |
parent | ce57957aa0fdeb79efd6ede8b6e94b8f26131dcf (diff) | |
download | tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.tar tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.tar.gz tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.tar.bz2 tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.tar.lz tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.tar.xz tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.tar.zst tangerine-wallet-browser-c9aab2084ec7dd8b81b02c9053a8fcbb6038e0b9.zip |
Merge pull request #1094 from MetaMask/dev
Version 3.2.0
Diffstat (limited to 'notices')
-rw-r--r-- | notices/notice-delete.js | 27 | ||||
-rw-r--r-- | notices/notice-generator.js | 36 | ||||
-rw-r--r-- | notices/notices.json | 1 |
3 files changed, 64 insertions, 0 deletions
diff --git a/notices/notice-delete.js b/notices/notice-delete.js new file mode 100644 index 000000000..652f96159 --- /dev/null +++ b/notices/notice-delete.js @@ -0,0 +1,27 @@ +var fs = require('fs') +var path = require('path') +var prompt = require('prompt') +var open = require('open') +var extend = require('extend') +var notices = require('./notices.json') + + +console.log('List of Notices') +console.log(`ID \t DATE \t\t\t TITLE`) +notices.forEach((notice) => { + console.log(`${(' ' + notice.id).slice(-2)} \t ${notice.date} \t ${notice.title}`) +}) +prompt.get(['id'], (error, res) => { +prompt.start() + if (error) { + console.log("Exiting...") + process.exit() + } + var index = notices.findIndex((notice) => { return notice.id == res.id}) + if (index === -1) { + console.log('Notice not found. Exiting...') + } + notices.splice(index, 1) + fs.unlink(`notices/archive/notice_${res.id}.md`) + fs.writeFile(`notices/notices.json`, JSON.stringify(notices)) +}) 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)) + }) + }) + }) + }) diff --git a/notices/notices.json b/notices/notices.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/notices/notices.json @@ -0,0 +1 @@ +[]
\ No newline at end of file |