Appendix B. Migrating projects from G-Cows 0.x

G-Cows 1.0 is the first version of G-Cows not completely backward compatible. So, if you created a site with one of the older versions you'll need some changes in you project in order to have it working with G-Cows 1.0.

If this is your first approach to G-Cows simply forget this chapter and jump to the introduction.

Breaking backward compatibility is never a good thing, but I feel that it's better to take this decision with the first complete release than waiting further. Moreover, upgrading a medium-sized project will take you only a few minutes.

I'll go very quickly, since if you're migrating a project, you already know G-Cows. Otherwise, jump to the introduction.

Cows-mkgen, by default, used to read a file called makefile.tmpl (if any) and create 2 files: makefile and makefile.sources. From version 1.0, the input file is called Makefile.cm and generated files are called Makefile and Makefile.sources (note that the trailing M is now capitalized). So you have to:

Another change involves the tag syntax: tags are now case sensitive in order to follow xml specifications, so you have to choose between the following:

Other forms like <COWS /> are no longer allowed. These tags will be ignored when switching from HTML to Cows, but will raise an error in case of nested tags since the Cows interpreter won't accept them as a valid input.

These are the most important changes, since if you don't do them, everything will apparently work, but you won't get the intended result since Cows-mkgen won't see the file makefile.tmpl (now Makefile.cm). Moreover, both Cows and Cows-mkgen will miss cows scripts included within cows tags with capital letters and display the script instead of its output.

The other changes involves G-Cows syntax: some functions (undef(), echo(), print(), verbatim(), include()) allowed, when called with a single argument, to avoid parentheses: the following statements are both allowed in G-Cows 0.x:

print "string";
print ("string");

From G-Cows 1.0 parentheses are alway necessary, so the first statement above will raise an error.

These changes are less critical since you can't' miss them: Cows will raise errors as the old syntax is found so there are no chances to forget them.

Now, two words about the motivations of these small changes. When you list files, those with uppercase letters are listed before others, so generating Makefile is smarter than generating makefile since the file describing the project is listed first. Users with large projects with many files in the root directory probably like having the Makefile listed before their sources.

The name makefile.tmpl was very misleading: this was referred to as makefile template but it's' not a real template, since you don't use it as a model to build makefiles, but to give some hints to Cows-mkgen. At the beginning it wasn't' a big problem, but with version 0.7 manual started talking about templates for web pages. This created a lot of confusion so let's use a better name. Makefile.cm is a better choice even because its extension describe the tool needed to process it (cm stands for Cows-mkgen).

The tags issue reveals a big design mistake in the 0.x versions. Xml compliance is a very important issue, it should have been taken into account from the beginning.

Finally, the parentheses issue: the very first version of G-Cows had only a pair of commands, with a simple syntax (print "Hello World!";). As its complexity started to grow, new functions needed more arguments; with version 0.8 only four functions allowed the old syntax without parentheses. So, to improve consistency, I decide to remove this deprecated form before releasing the first official 1.0 version.

This manual can be downloaded from http://www.g-cows.org/.