Init command should remove any includeWikis definitions

The includeWikis references will otherwise be broken when the edition
is copied.
print-window-tiddler
Jermolene 2014-02-24 10:14:17 +00:00
rodzic 886d648568
commit 3f6bf2452a
2 zmienionych plików z 13 dodań i 3 usunięć

Wyświetl plik

@ -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;
};

Wyświetl plik

@ -10,7 +10,6 @@ Initialise an empty [[WikiFolder|WikiFolders]] with a copy of the specified edit
--init <edition>
```
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