changeset 625:7f95c5e91a31

docs: Add documentation about the `publish` command.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 08 Feb 2016 21:52:46 -0800
parents b45fb2137a07
children a1697b1066bc
files docs/docs/10_publishing.md docs/docs/99_reference/06_publishers.md
diffstat 2 files changed, 117 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/docs/docs/10_publishing.md	Mon Feb 08 21:29:35 2016 -0800
+++ b/docs/docs/10_publishing.md	Mon Feb 08 21:52:46 2016 -0800
@@ -7,41 +7,82 @@
 > completely static website**. For how to deploy a PieCrust website as a dynamic
 > CMS, see the [deployment documentation][deploy].
 
+To publish your website, you need to "_bake_" it, and then place the output of
+this bake on a public server somewhere.
+
+
 ## Baking
 
-To publish your content as a static website, you need to "_bake_" it, _i.e._
-generate all the pages, posts, assets, and other pieces of content:
+When you "_bake_" your website, PieCrust will generate all the pages, posts,
+assets, and other pieces of content you made into simple files on disk. To do
+this, simply run:
 
     $ chef bake
 
-You should then see some information about how many pages PieCrust baked, how
-much time it took to do so, etc. Without any arguments, the output is located
-inside the `_counter` directory at the root of your website.
+You should see some information about how many pages PieCrust baked, how much
+time it took to do so, etc. Without any arguments, the output is placed inside
+the `_counter` directory at the root of your website.
 
 You can specify another output directory:
 
     $ chef bake -o /path/to/my/output
 
-For other parameters, refer to the help page for the `bake` command.
+For other parameters, refer to the help page for the `bake` command by running
+`chef help bake`.
 
-At this point, you only need to _publish_ it, _i.e._ copy or upload the output
-files (everything inside `_counter`, or whatever other output directory you
-specified) to a place where people will be able to access them. This is
-typically a public directory on machine that will serve it _via_ HTTP using
-software like [Apache][] or [Nginx][].
-
-
-[apache]: http://httpd.apache.org/
-[nginx]: http://nginx.org/
+At this point, you only need to copy or upload the output files (everything
+inside `_counter`, or whatever other output directory you specified) to a place
+where people will be able to access them. This is typically a public directory
+on machine that will serve it _via_ HTTP using software like [Apache][] or
+[Nginx][].
 
 
 ## Publishing
 
-At the moment, there are no publishing features included in PieCrust -- you just
-run `chef bake` as mentioned above directly on the server (pointing it to the
-public directory), or locally and then upload the output via (S)FTP.
+PieCrust is also capable of publishing your website more or less automatically
+for the most common types of setup. This is done with the `publish` command.
+
+You can specify various "_publish targets_" in your website configuration. By
+default, a target will first bake your website into a temporary directory, and
+then execute some steps that depend on the target type.
+
+For example, the following configuration has one target (`upload`) that runs
+`rsync` to copy the output of the bake to some web server:
+
+```
+publish:
+    upload:
+        type: rsync
+        destination: user@example.org:/home/user/www
+```
+
+You can then run:
 
-More publishing features will be included in the future.
+```
+$ chef publish upload
+Deploying to upload
+[   863.1 ms] baked 4 user pages.
+[     5.3 ms] baked 1 theme pages.
+[    79.2 ms] baked 0 taxonomy pages.
+[    84.8 ms] processed 3 assets.
+[  1210.9 ms] Baked website.
+building file list ... done
+
+sent 29965 bytes  received 20 bytes  19990.00 bytes/sec
+total size is 22189128  speedup is 740.01
+[   991.5 ms] Ran publisher rsync
+[  2203.3 ms] Deployed to upload
+```
+
+Of course, the output will vary based on your website, your target, whether you
+previously published that target or wiped the PieCrust cache, etc.
+
+For more information about the different types of publish targets available in
+PieCrust, refer to the [publishers reference][pubs].
+
 
 [deploy]: {{docurl('deploying')}}
+[pubs]: {{docurl('reference/publishers')}}
+[apache]: http://httpd.apache.org/
+[nginx]: http://nginx.org/
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/docs/99_reference/06_publishers.md	Mon Feb 08 21:52:46 2016 -0800
@@ -0,0 +1,57 @@
+---
+title: "Appendix 6: Publishers"
+short_title: "Publishers"
+---
+
+Here's a list of website publishers that ship by default with PieCrust.
+
+Publishers are declared and configured in the website configuration like so:
+
+```
+publish:
+    <target_name>:
+        type: <publisher_type>
+        <config1>: <value1>
+        <config2>: <value2>
+```
+
+Note that apart for the `type` setting, all publishers also share a few common
+configuration settings:
+
+* `bake` (`true`): Unless set to `false`, PieCrust will first bake your website
+  into a temporary folder (`_cache/pub/<target_name>`). The publisher will then
+  by default pick it up from there.
+
+In addition to specifying publish targets via configuration settings, you can
+also (if you don't need anything fancy) specify some of them via a simple
+URL-like line:
+
+```
+publish:
+    <target_name>: <something://foo/bar>
+```
+
+The URL-like format is specified below on a per-publisher basis.
+
+
+## Shell Command
+
+This simple publisher runs the specified command from inside your website root
+directory.
+
+* `type`: `shell`.
+* `command`: The command to run.
+
+
+## Rsync
+
+This publisher will run `rsync` to copy or upload your website's bake output to
+a given destination.
+
+* `type`: `rsync`.
+* `destination`: The destination given to the `rsync` executable.
+* `source` (`_cache/pub/<target_name>`): The source given to the `rsync`
+  executable. It defaults to the automatic pre-publish bake output folder.
+* `options` (`-avc --delete`): The options to pass to the `rsync` executable. By
+  default, those will run `rsync` in "mirroring" mode.
+