From 3f6bf2452a781bfb170c9b9176d69d218e9b92e7 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 24 Feb 2014 10:14:17 +0000 Subject: [PATCH] Init command should remove any includeWikis definitions The includeWikis references will otherwise be broken when the edition is copied. --- core/modules/commands/init.js | 8 +++++++- editions/tw5.com/tiddlers/commands/InitCommand.tid | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/modules/commands/init.js b/core/modules/commands/init.js index 5eda044bc..3ebe0e73f 100644 --- a/core/modules/commands/init.js +++ b/core/modules/commands/init.js @@ -23,7 +23,8 @@ var Command = function(params,commander) { }; Command.prototype.execute = function() { - var path = require("path"), + var fs = require("fs"), + path = require("path"), editionName = this.params[0] || "empty"; // Check that we don't already have a valid wiki folder if($tw.boot.wikiTiddlersPath) { @@ -39,6 +40,11 @@ Command.prototype.execute = function() { if(!err) { this.commander.streams.output.write("Copied edition '" + editionName + "' to " + $tw.boot.wikiPath + "\n"); } + // Tweak the tiddlywiki.info to remove any included wikis + var packagePath = $tw.boot.wikiPath + "/tiddlywiki.info", + packageJson = JSON.parse(fs.readFileSync(packagePath)); + delete packageJson.includeWikis; + fs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces)); return err; }; diff --git a/editions/tw5.com/tiddlers/commands/InitCommand.tid b/editions/tw5.com/tiddlers/commands/InitCommand.tid index df01cb2e7..d1297a0c5 100644 --- a/editions/tw5.com/tiddlers/commands/InitCommand.tid +++ b/editions/tw5.com/tiddlers/commands/InitCommand.tid @@ -10,7 +10,6 @@ Initialise an empty [[WikiFolder|WikiFolders]] with a copy of the specified edit --init ``` -The "edition" defaults to ''empty''. For example: @@ -18,4 +17,9 @@ For example: tiddlywiki ./MyWikiFolder --init empty ``` -Note that the init command will fail if the wiki folder does not exist, or is not empty. +Note: + +* The "edition" defaults to ''empty'' +* The init command will fail if the wiki folder does not exist, or is not empty +* The init command removes any `includeWikis` definitions in the edition's `tiddlywiki.info` file +