Mercurial > piecrust2
comparison piecrust/commands/builtin/baking.py @ 868:8d25f76fce98
bake: Add ability to specify pipelines to exclude during the bake.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 12 Jun 2017 22:22:19 -0700 |
parents | 08e02c2a2a1a |
children | 3004ab31bb46 |
comparison
equal
deleted
inserted
replaced
867:757fba54bfd3 | 868:8d25f76fce98 |
---|---|
86 ctx.app.config.set('baker/workers', ctx.args.workers) | 86 ctx.app.config.set('baker/workers', ctx.args.workers) |
87 if ctx.args.batch_size > 0: | 87 if ctx.args.batch_size > 0: |
88 ctx.app.config.set('baker/batch_size', ctx.args.batch_size) | 88 ctx.app.config.set('baker/batch_size', ctx.args.batch_size) |
89 | 89 |
90 allowed_pipelines = None | 90 allowed_pipelines = None |
91 forbidden_pipelines = None | |
91 if ctx.args.html_only: | 92 if ctx.args.html_only: |
92 allowed_pipelines = ['page'] | 93 forbidden_pipelines = ['asset'] |
93 elif ctx.args.assets_only: | 94 elif ctx.args.assets_only: |
94 allowed_pipelines = ['asset'] | 95 allowed_pipelines = ['asset'] |
95 elif ctx.args.pipelines: | 96 elif ctx.args.pipelines: |
96 if allowed_pipelines: | 97 if allowed_pipelines or forbidden_pipelines: |
97 raise Exception( | 98 raise Exception( |
98 "Can't specify `--html-only` or `--assets-only` with " | 99 "Can't specify `--html-only` or `--assets-only` with " |
99 "`--pipelines`.") | 100 "`--pipelines`.") |
100 allowed_pipelines = ctx.args.pipelines | 101 for p in ctx.args.pipelines: |
102 if p[0] == '-': | |
103 forbidden_pipelines.append(p) | |
104 else: | |
105 allowed_pipelines.append(p) | |
101 | 106 |
102 baker = Baker( | 107 baker = Baker( |
103 ctx.appfactory, ctx.app, out_dir, | 108 ctx.appfactory, ctx.app, out_dir, |
104 force=ctx.args.force, | 109 force=ctx.args.force, |
105 allowed_pipelines=allowed_pipelines) | 110 allowed_pipelines=allowed_pipelines, |
111 forbidden_pipelines=forbidden_pipelines) | |
106 records = baker.bake() | 112 records = baker.bake() |
107 | 113 |
108 return records | 114 return records |
109 | 115 |
110 | 116 |