]> scripts.mit.edu Git - wizard.git/commitdiff
Update documentation to use the new API.
authorEdward Z. Yang <ezyang@mit.edu>
Wed, 25 Nov 2009 07:51:36 +0000 (02:51 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Wed, 25 Nov 2009 07:51:36 +0000 (02:51 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
doc/create.rst

index c040f5513c7849da2f9abd8a2653dcb28df55f2c..4c5573f5ce6ddfec7f7db67deaa7de49c4d2065a 100644 (file)
@@ -358,21 +358,16 @@ is stored: a quick grep tells us that it's in :file:`wp-includes/version.php`:
 We could now grab the :mod:`re` module and start constructing a regex to grab ``2.0.4``, but it
 turns out this isn't necessary: :meth:`wizard.app.php.re_var` does this for us already!
 
-With this function in hand, writing a version detection function is pretty straightforward.
-There is one gotcha: the value that ``re_var`` returns as the second subpattern is quoted (the reasons for this
-will become clear shortly), so you will need to trim off the last and first characters or
-use :mod:`shlex`.  In the case of version numbers, there are probably no escape characters
-in the string, so the former is relatively safe.
+With this function in hand, writing a version detection function is pretty straightforward:
+we have a helper function that takes a file and a regex, and matches out the version number
+for us.
 
 .. code-block:: python
 
     class Application(app.Application):
         # ...
         def detectVersion(self, deployment):
-            contents = open("wp-includes/version.php").read()
-            match = php.re_var("wp_version").search(contents)
-            if not match: return None
-            return distutils.version.LooseVersion(match.group(2)[1:-1])
+            return self.detectVersionFromFile("wp-includes/version.php", php.re_var("wp_version"))
 
 :attr:`~wizard.app.Application.parametrized_files` is a simple list of files that the
 program's installer wrote or touched during the installation process.
@@ -539,11 +534,11 @@ Further reading
 You've only implemented a scriptsified version for only a single version; most applications
 have multiple versions--you will have to do this process again.  Fortunately, the most
 time consuming parts (implementing logic for :class:`wizard.app.Application`) are already,
-done so you'll only have to tweak these algorithms if the application changes their
-format.
+done so the process of :doc:`creating upgrades <upgrade>` is much simpler.
+
+There is still functionality yet undone: namely the methods for actually performing an
+upgrade are not yet implemented.
 
 .. todo::
 
-    Ultimately, we should have another condensed page that describes how to craft
-    an update (with emphasis on what tests to perform to make sure things still
-    work), and pages on how to implement upgrades and backups.
+    This needs a document.