2014-07-12 08:09:36 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/commands/makelibrary.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: command
|
|
|
|
|
|
|
|
Command to pack all of the plugins in the library into a plugin tiddler of type "library"
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
exports.info = {
|
|
|
|
name: "makelibrary",
|
|
|
|
synchronous: true
|
|
|
|
};
|
|
|
|
|
|
|
|
var UPGRADE_LIBRARY_TITLE = "$:/UpgradeLibrary";
|
|
|
|
|
|
|
|
var Command = function(params,commander,callback) {
|
|
|
|
this.params = params;
|
|
|
|
this.commander = commander;
|
|
|
|
this.callback = callback;
|
|
|
|
};
|
|
|
|
|
|
|
|
Command.prototype.execute = function() {
|
|
|
|
var wiki = this.commander.wiki,
|
|
|
|
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
|
2024-05-21 10:22:39 +00:00
|
|
|
tiddlers = $tw.utils.getAllPlugins();
|
2014-07-12 08:09:36 +00:00
|
|
|
// Save the upgrade library tiddler
|
|
|
|
var pluginFields = {
|
|
|
|
title: upgradeLibraryTitle,
|
|
|
|
type: "application/json",
|
|
|
|
"plugin-type": "library",
|
2019-09-16 11:15:39 +00:00
|
|
|
"text": JSON.stringify({tiddlers: tiddlers})
|
2014-07-12 08:09:36 +00:00
|
|
|
};
|
|
|
|
wiki.addTiddler(new $tw.Tiddler(pluginFields));
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.Command = Command;
|
|
|
|
|
|
|
|
})();
|