comparison piecrust/commands/builtin/baking.py @ 220:84e2bc2d16cb

bake: Change arguments to selectively bake to make them symmetrical.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 03 Feb 2015 08:20:30 -0800
parents 10f24c62b05b
children f82262f59600
comparison
equal deleted inserted replaced
219:d7a548ebcd58 220:84e2bc2d16cb
30 parser.add_argument( 30 parser.add_argument(
31 '-f', '--force', 31 '-f', '--force',
32 help="Force re-baking the entire website.", 32 help="Force re-baking the entire website.",
33 action='store_true') 33 action='store_true')
34 parser.add_argument( 34 parser.add_argument(
35 '--no-assets', 35 '--assets-only',
36 help="Don't process assets (only pages).", 36 help="Only bake the assets (don't bake the web pages).",
37 action='store_true')
38 parser.add_argument(
39 '--html-only',
40 help="Only bake HTML files (don't run the asset pipeline).",
37 action='store_true') 41 action='store_true')
38 42
39 def run(self, ctx): 43 def run(self, ctx):
40 out_dir = (ctx.args.output or 44 out_dir = (ctx.args.output or
41 os.path.join(ctx.app.root_dir, '_counter')) 45 os.path.join(ctx.app.root_dir, '_counter'))
42 46
43 success = True 47 success = True
44 start_time = time.clock() 48 start_time = time.clock()
45 try: 49 try:
46 # Bake the site sources. 50 # Bake the site sources.
47 success = success & self._bakeSources(ctx, out_dir) 51 if not ctx.args.assets_only:
52 success = success & self._bakeSources(ctx, out_dir)
48 53
49 # Bake the assets. 54 # Bake the assets.
50 if not ctx.args.no_assets: 55 if not ctx.args.html_only:
51 success = success & self._bakeAssets(ctx, out_dir) 56 success = success & self._bakeAssets(ctx, out_dir)
52 57
53 # All done. 58 # All done.
54 logger.info('-------------------------') 59 logger.info('-------------------------')
55 logger.info(format_timed(start_time, 'done baking')) 60 logger.info(format_timed(start_time, 'done baking'))