July 28, 2006
MarkBernstein.org
 
Follow me on Twitter

AutoFetch

Many Tinderbox features turn out to be useful in unexpected ways. Autofetch is perhaps the outstanding example.

Originally, Autofetch was intended to make it easier to do two jobs:

So is Autofetch a spare wheel? No! Autofetch turns out to be a terrific way to spread information between Tinderbox documents.

For example, from type to time we release a new version of Tinderbox. This information gets used in lots of places. In the old days, we had to change the version number each time we mentioned it -- and that led to mistakes. Now, whenever we want to mention the current version, we just say

^include(/config/version)

(Or, more likely, we put that in a macro and say ^do(TinderboxVersion). You get the idea.)

But different sites use different Tinderbox files! How do we make sure that all the different sites get the news about a new version? We can use AutoFetch. The Tinderbox site exports its configuration notes in simple text format; for example, the current Tinderbox version is always at

http://www.eastgate.com/Tinderbox/config/version.

Other Tinderbox documents can simply AutoFetch from this URL and get the current price.

What happens if I'm offline? When I'm working on a plane or in the forest, Autofetch can't check the version, so it uses the old version. All is well.