image

RubyFrontier Documentation

User Settings

Frontier provided a way to let you make settings that would be in common for rendering all your Web sites (unless overridden by a setting within a site). For example, if you know that in a lot of different sites you’d like to say “apple” as a shortcut for “http://www.apple.com” in links, it seems silly to make you redefine this in a #glossary hash for every source folder. So you need a place where you can define “apple” to mean “http://www.apple.com” just once, and have this definition available in any page in any Web site you render.

The idea of a user.rb file originated as a way for RubyFrontier to handle the need for such global user settings.

In addition, it was soon observed in practice that — Ruby being Ruby — it would be convenient to use the user.rb file for a second purpose, namely to let the user inject custom code into RubyFrontier’s own classes.

The Two user.rb Files

There are actually two ways to supply a user.rb file (there was originally just one such way, but it became clear after a while that a second was needed):

What a user.rb File Can Do

When a user.rb file is loaded, here are the sorts of thing it can do:

Note concerning the “user templates”: Frontier had a mechanism of “user templates”; any templates kept in the user table could be referred to by name in any site. RubyFrontier imitates this only to the extent of including two “user templates” that can be referred to by name. But they are actually inside the RubyFrontier bundle and so the user templates mechanism is not really open to your use, unless you want to reach right inside the RubyFrontier bundle and put additional templates in there. In future, if there is demand, I am certainly open to restoring a more convenient user templates mechanism; but up to now I have not done so because I haven’t felt the need for it.

Next: Bundle Commands

This documentation prepared by Matt Neuburg, phd = matt at tidbits dot com (http://www.apeth.net/matt/), using RubyFrontier.
Download RubyFrontier from GitHub.