Mercurial > piecrust2
comparison garcon/benchsite.py @ 990:22cf13b86cc3
cm: Upgrade Garcon tasks to the latest PyInvoke version.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 19 Nov 2017 14:29:52 -0800 |
parents | 79aefe82c6b6 |
children |
comparison
equal
deleted
inserted
replaced
989:8adc27285d93 | 990:22cf13b86cc3 |
---|---|
70 class PieCrustBechmarkSiteGenerator(BenchmarkSiteGenerator): | 70 class PieCrustBechmarkSiteGenerator(BenchmarkSiteGenerator): |
71 def initialize(self): | 71 def initialize(self): |
72 posts_dir = os.path.join(self.out_dir, 'posts') | 72 posts_dir = os.path.join(self.out_dir, 'posts') |
73 if not os.path.isdir(posts_dir): | 73 if not os.path.isdir(posts_dir): |
74 os.makedirs(posts_dir) | 74 os.makedirs(posts_dir) |
75 | |
76 config_path = os.path.join(self.out_dir, 'config.yml') | |
77 if not os.path.exists(config_path): | |
78 with open(config_path, 'w') as fp: | |
79 fp.write('\n') | |
75 | 80 |
76 def writePost(self, post_info): | 81 def writePost(self, post_info): |
77 out_dir = os.path.join(self.out_dir, 'posts') | 82 out_dir = os.path.join(self.out_dir, 'posts') |
78 slug = post_info['slug'] | 83 slug = post_info['slug'] |
79 dtstr = post_info['datetime'].strftime('%Y-%m-%d') | 84 dtstr = post_info['datetime'].strftime('%Y-%m-%d') |
218 main() | 223 main() |
219 else: | 224 else: |
220 from invoke import task | 225 from invoke import task |
221 | 226 |
222 @task | 227 @task |
223 def genbenchsite(engine, out_dir, post_count=100, tag_count=10): | 228 def genbenchsite(ctx, engine, out_dir, post_count=100, tag_count=10): |
224 generate(engine, out_dir, | 229 generate(engine, out_dir, |
225 post_count=post_count, | 230 post_count=post_count, |
226 tag_count=tag_count) | 231 tag_count=tag_count) |
227 | 232 |