diff piecrust/commands/builtin/baking.py @ 580:c7ac7dc2fe73

bake: Add option to bake assets for FoodTruck. This is likely temporary.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 30 Dec 2015 14:47:23 -0800
parents 456db44dcc53
children 466bbddd121e
line wrap: on
line diff
--- a/piecrust/commands/builtin/baking.py	Wed Dec 30 14:46:51 2015 -0800
+++ b/piecrust/commands/builtin/baking.py	Wed Dec 30 14:47:23 2015 -0800
@@ -5,6 +5,7 @@
 import fnmatch
 import datetime
 from colorama import Fore
+from piecrust import CACHE_DIR
 from piecrust.baking.baker import Baker
 from piecrust.baking.records import (
         BakeRecord, BakeRecordEntry, SubPageBakeInfo)
@@ -57,8 +58,24 @@
                 '--show-timers',
                 help="Show detailed timing information.",
                 action='store_true')
+        parser.add_argument(
+                '--foodtruck',
+                help="Run the asset pipeline for FoodTruck.",
+                action='store_true')
 
     def run(self, ctx):
+        if ctx.args.foodtruck:
+            if ctx.args.html_only:
+                raise Exception("`--foodtruck` and `--html-only` can't be "
+                                "both specified.")
+            if ctx.args.output:
+                raise Exception("`--foodtruck` and `--output` can't be "
+                                "both specified.")
+
+            ctx.args.assets_only = True
+            ctx.args.output = os.path.join(ctx.app.root_dir, CACHE_DIR,
+                                           'foodtruck', 'server')
+
         out_dir = (ctx.args.output or
                    os.path.join(ctx.app.root_dir, '_counter'))