diff --git a/bin/haraka b/bin/haraka index fd2c46496..fb606b857 100755 --- a/bin/haraka +++ b/bin/haraka @@ -183,13 +183,20 @@ var readme = [ "", ].join("\n"); -function createReadme(readmePath) { +var packageJson = JSON.stringify({ + "name": "Local Haraka", + "description": "An SMTP Server project.", + "version": "0.0.1", + "dependencies": {} +}); + +function createFile(filePath, data) { try { - var fd = fs.openSync(readmePath, 'w'); - fs.writeSync(fd, readme, null); + var fd = fs.openSync(filePath, 'w'); + fs.writeSync(fd, data, null); } catch (e) { - warning("Unable to create README file: " + e); + warning("Unable to create file: " + e); } } @@ -199,7 +206,7 @@ if (parsed.version) { else if (parsed.list) { console.log("\033[32;40m*global\033[0m\n" + listPlugins()); if (parsed['configs']) { - console.log("\033[32;40m*local\033[0m\n" + listPlugins(parsed['configs'])); + console.log("\033[32;40m*local\033[0m\n" + listPlugins(parsed.configs)); } } else if (parsed.help) { @@ -207,8 +214,16 @@ else if (parsed.help) { console.log(usage); } else { - var md_path = path.join(base, 'docs', parsed.help) + '.md'; - if (!path.existsSync(md_path)) { + var md_path, + md_paths = [path.join(base, 'docs', parsed.help) + '.md']; + if (parsed.configs) { md_paths.unshift(path.join(parsed.configs, 'docs', parsed.help) + '.md'); } + for (var i=0, j=md_paths.length; i