Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
579:42a5e78e782a | 580:c7ac7dc2fe73 |
---|---|
3 import logging | 3 import logging |
4 import hashlib | 4 import hashlib |
5 import fnmatch | 5 import fnmatch |
6 import datetime | 6 import datetime |
7 from colorama import Fore | 7 from colorama import Fore |
8 from piecrust import CACHE_DIR | |
8 from piecrust.baking.baker import Baker | 9 from piecrust.baking.baker import Baker |
9 from piecrust.baking.records import ( | 10 from piecrust.baking.records import ( |
10 BakeRecord, BakeRecordEntry, SubPageBakeInfo) | 11 BakeRecord, BakeRecordEntry, SubPageBakeInfo) |
11 from piecrust.chefutil import format_timed | 12 from piecrust.chefutil import format_timed |
12 from piecrust.commands.base import ChefCommand | 13 from piecrust.commands.base import ChefCommand |
55 action='store_true') | 56 action='store_true') |
56 parser.add_argument( | 57 parser.add_argument( |
57 '--show-timers', | 58 '--show-timers', |
58 help="Show detailed timing information.", | 59 help="Show detailed timing information.", |
59 action='store_true') | 60 action='store_true') |
61 parser.add_argument( | |
62 '--foodtruck', | |
63 help="Run the asset pipeline for FoodTruck.", | |
64 action='store_true') | |
60 | 65 |
61 def run(self, ctx): | 66 def run(self, ctx): |
67 if ctx.args.foodtruck: | |
68 if ctx.args.html_only: | |
69 raise Exception("`--foodtruck` and `--html-only` can't be " | |
70 "both specified.") | |
71 if ctx.args.output: | |
72 raise Exception("`--foodtruck` and `--output` can't be " | |
73 "both specified.") | |
74 | |
75 ctx.args.assets_only = True | |
76 ctx.args.output = os.path.join(ctx.app.root_dir, CACHE_DIR, | |
77 'foodtruck', 'server') | |
78 | |
62 out_dir = (ctx.args.output or | 79 out_dir = (ctx.args.output or |
63 os.path.join(ctx.app.root_dir, '_counter')) | 80 os.path.join(ctx.app.root_dir, '_counter')) |
64 | 81 |
65 success = True | 82 success = True |
66 ctx.timers = {} | 83 ctx.timers = {} |