Storage and packaging of PersonalMoinMoin application, settings and documents
See also:
/AdminInterface /MockHelp /OtherSoftware /StorageAndPackaging |
General
MoinMoin contains 3 parts: application, application settings and the farm. After installation, the user create some configuration, for example, one wiki. The wiki is like a document the user saved, it can be anywhere, and only MoinMoin need access to it. The Application can be anywhere the user installed it, it can be in the user home or in the machine Applications or Program Files directory.
- Configuration files should NOT be saved with the application, but in the native location for configuration and preferences.
The user should be able to delete the MoinMoin package and install a new one without effecting the current configured wikis - without any installer or script. Just drag Application to trash, put new one.
MoinMoin should find the configuration files without any user interaction in the expected location on the platform.
Application
Will be packaged as bundle, exe or directory:
MoinMoin package (standard distribution)
- Underlay dir, will be used by all wikis, no need to copy
- htdocs - static files
- startup script, based on moin.py, will run standalone server
- Python - for platforms which does not have standard install of python
The MoinMoin package will bot be installed, and the startup script will simply load it from the application bundle by setting the python system path.
Since underlay and htdocs are at constant location, there is no need to configure those, although we can support custom configuration if we like.
Application settings
- Settings saved today in moin.py - docs, port, etc.
- Saved in the native location for the user
- Reference to the farm or all farm configuration, depending on how farm configuration is saved.
Farm configuration data
Here are several alternatives for storage:
- Option 1: save all the configuration in one place, farm data in another place
~/Library/Application Support/MoinMoin/ farm_config - contain farm configuration bluewiki_config - blue wiki configuration redwiki_config - .. ~/Whatever - this is user specified location, we don't care BlueWiki/ pages user plugin RedWiki/ pages user plugin
- Option 2: save farm configuration in one place, and each wiki configuration inside the wiki directory, so each wiki contain all the needed data and setup files. Farm configuration should now only the location of each wiki directory.
~/Library/Application Support/MoinMoin/ config - contain farm configuration and the path to whatever ~/Whatever - this is user specified location, we don't care BlueWiki/ config pages user plugin RedWiki/ config pages user plugin
- Option 3: save both farm data and configuration in one place, for example:
~/Library/Application Support/MoinMoin/ config BlueWiki/ config pages user plugin RedWiki/ config pages user plugin
In the last option may be too restricting, maybe the user want to put the wikis on a different disk, or just like a more accessible location. But on the other hand, it make it safer for the user, we hide the stuff that the user should not play with, still allowing power users to do what they like. This is the way Mozilla Thunderbird working, your mail is saved by default in C:\\Document and Settings\blabla..., but you can change the location if you like.
- Option 4: save farm settings in the application settings, and reference to any wiki which is part of the farm, that can be anywhere:
~/Library/Application Support/MoinMoin/ config - contain farm configuration and the path to all wikis /Here/BlueWiki - this is user specified location, we don't care config pages user plugin /There/RedWiki/ config pages user plugin
The problem here is that a user might deactivate a wiki by accident by moving or renaming the wiki directory. Its too easy to shoot your self in the foot.
OS X
Application
There are several ways to use the application.
- Standard application - start by double click, app sits in the doc, stop from the application menu. The
Background application - start by double click, the application adds a status item menu in the menu bar (like classic), stop from that menu. Examples: SSHKeychain
Preference pane - application is packaged as a preference page, install in the Library/Preferences Panes/, then activation and configuration is done from a page in the System Preferences application. Examples: CocoAspell
The application might want to be started automatically on startup, its not hard to do by adding a script to the system startup directory (needs admin rights).
Application settings
Desktop application in OS X save the user preferences inside the user Library folder.
On Mac OS X, a wiki can be packaged as a bundle, and look like single document, for example RedWiki.wiki or RedWiki.moinmoin. The wiki document can be assosiated with MoinMoin and automatically run MoinMoin application on double click, activating the wiki. In this case, MoinMoin does not need to know where are the wikis located, you simply open a wiki to make it active, and close to deactivate. With this setup, one can move wikis around, MoinMoin does not care. The problem is this behavior is Mac OS X only.
Using Cocoa Defaults
Preferences managed by Cocoa defaults system are automatically saved in ~/Library/Preferencess in the file with the application signature. These files have names like: com.apple.Safari.plist and use xml format. Cocoa defaults system let you add, remove and query keys saved in those files and in other domains. Using PyObjc, we can manage all kind of settings without writing even one line of IO code.
We can save all farm configuration, including all wiki data using org.moin.MoinMoin.plist. Then on startup, load the values and create configuration classes as if we imported real farmconfig and wikiconfig mordules.
Example of plist file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>ActivitiesStartExpanded</key> <true/> <key>AddressBarIncludesAddBookmark</key> <false/> <key>AddressBarIncludesGoogle</key> <true/> <key>AddressBarIncludesReportBug</key> <false/> <key>AddressBarIncludesTextSizing</key> <true/>
Defaults are handled with: http://developer.apple.com/documentation/Cocoa/Conceptual/UserDefaults/index.html
You set a default with setObject:forKey: and get them with objectForKey:, using PyObjc.
Special files
Applications that want to manage bigger data sets, for example few separate support files, use ~/Library/Application Support/Application Name.
If we keep the current or similar configuration setup, we might save it in ~/Library/Application Support/MoinMoin.
The main difference from current code - we load all the configuration on startup from hardcoded location, there is no need for playing with Python system path.
Linux
Are there any standards for keeping user configuration files?
- ~/.moinmoin directory?
Winodows
- Registery?
- Documents and Settings sub directory?
Discussion
Seems that the best solution for a multiplatform setup while keeping minimal platform specific code is use a hardcoded location in the file system to save configuration, so we can use exactly the same code to load or save the configuration.