Tags:
deployment1Add my vote for this tag dev_essential1Add my vote for this tag installation1Add my vote for this tag shell1Add my vote for this tag create new tag
, view all tags

TWiki Command Line and Shell Interface to TWiki

twikishell is a generic command line utility for TWiki. Think of it providing linkage between bash and twiki: it provides mechanism for the Core and plugins to add CommandSets to the vocabulary of commands available.

The idea behind TWikiShell is to have an unifying foundational layer sitting behind these scripts, improving:

  • Modularity
  • Distributed and
  • Sharing

In my opinion the twikishell belongs as an infrastructure capability, a rare case of something that has legitimate reason to be bundled with TWiki.

Invoking the twikishell

These commands are can be used in two ways: interactively like the perl debugger:

$ twikishell
twikishell> command param1 param2 param3
twikishell>

This is an interactive environment where you can then interactively type your commands and use cursors to scroll back to recall your last command, etc

Alternatively you can invoke it directly through the command line:

$ twikishell command param1 param2 param3
$

Or script the commands in another perl or bash script:

#! /bin/sh
twikishell command1 param2 ..
twikishell command2 params ...

twikishell uses the same base class (Term::Shell) as the Perl interactive debugger and CPAN installer.

Moving away from dispersed scripts

There are several operations that admins and developers can/must perform on a Twiki installation that are/can be implemented as perl scripts (download and install plugins, create topics, relock topics, backup entire site, etc).

By providing services that are common to several tasks people don't need to recode them.

A value proposition is that we repackage as subcommands all the miscellaneous scripts not run via the web to be twikishell commands, e.g.:

twikishell upgrade dakar

Advantages of this:

  • The twikishell has access to all the TWiki environment and can offer APIs as commands.
    • Unzip files (using unzip or Archive::Zip, whatever is available at the moment)
    • Path creation (create all the path down to a file.ie: makepath(/lib/TWiki/Plugin/MyPlugin/Some.pm) will creathe the /lib/TWiki/Plugin/MyPlugin directory and every directory in the middle as necesary
    • Locate the bin, lib, data, pub and template directories in a twiki instalation (the current implementation only locates bin and lib)
  • It can apply appropriate access-level restrictions
  • It can provide centralised logging

Writing a CommandSet

Implementations of these commands are found in packages, in these cases:

TWiki::Contrib::CommandSet::Plugin
TWiki::Contrib::CommandSet::Upgrade

  • TWiki::Contrib::CommandSet::Plugin provides commands to 'install' and 'deinstall'
  • TWiki::Contrib::CommandSet::Upgrade would capture the functionality in UpgradeTWiki.pl

I.e. we replace all shell scripts (currently dotted around the directory structure) with library implementations provided by extensions. Furthermore, those library implementations because they are bundled with extensions can use the same functionality exposed through the web. I can demonstrate this if you want.

Rafael has built a variety of CommandSet classes that he has bundled with the TWikiShellContrib. Some of these would be ideal for inclusion for developers only. The neat thing is that separate functionality goes in separate classes.

Dependencies

TWikiShellContrib has one CPAN dependency, Term::Shell. For me this has installed cleanly and without further complication/dependency on IndigoPerl on Windows and Debian Sarge Linux.

Bundling to make it useful

To be practical minimal CommandSet functionality does need be bundled: in our present case this need to be just enough to replicate the mklinks function:

twikishell plugin install all    or
twikishell plugin install set-a     
twikishell plugin install WysiwygPlugin

where set-a, all are tokens representing lists of extensions

-- MartinCleaver - 05 Oct 2005 -- RafaelAlvarez - 30 Oct 2004

Great suggestions. Exactly the sort of thing I had been looking for Martin. I've written my own script for performing an installation, and it makes good sense to provide this sort of functionality at the command line. I found your post while trying to find an integrated utility for generating TWiki topics. I've been creating TWiki formatted text files, but have had some trouble with RCS.

-- MartyBrandon - 27 Nov 2007

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-11-27 - MartyBrandon
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.