changeset 653:466bbddd121e

admin: Run the asset pipeline before showing the admin panel. * This makes the compiled assets available for the site preview. * Remove unneeded `--foodtruck` option to `bake`.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 18 Feb 2016 20:54:37 -0800
parents 41e9714e3a5f
children 9c0092fae31d
files piecrust/commands/builtin/admin.py piecrust/commands/builtin/baking.py
diffstat 2 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/commands/builtin/admin.py	Tue Feb 16 22:32:58 2016 -0800
+++ b/piecrust/commands/builtin/admin.py	Thu Feb 18 20:54:37 2016 -0800
@@ -1,5 +1,6 @@
 import os
 import logging
+from piecrust import CACHE_DIR
 from piecrust.commands.base import ChefCommand
 
 
@@ -47,6 +48,12 @@
         return ctx.args.sub_func(ctx)
 
     def _runFoodTruck(self, ctx):
+        from piecrust.processing.pipeline import ProcessorPipeline
+        out_dir = os.path.join(
+                ctx.app.root_dir, CACHE_DIR, 'foodtruck', 'server')
+        proc = ProcessorPipeline(ctx.app, out_dir)
+        proc.run()
+
         from foodtruck import settings
         settings.FOODTRUCK_CMDLINE_MODE = True
         settings.FOODTRUCK_ROOT = ctx.app.root_dir
--- a/piecrust/commands/builtin/baking.py	Tue Feb 16 22:32:58 2016 -0800
+++ b/piecrust/commands/builtin/baking.py	Thu Feb 18 20:54:37 2016 -0800
@@ -58,24 +58,8 @@
                 '--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'))