# HG changeset patch # User Ludovic Chabant # Date 1465536378 25200 # Node ID 6db54bed24179d941c4da30beda3ec9a04490206 # Parent 5336e146ac8d3519cb5722ca0d5723687d82fbc8 init: Use a better config template when creating websites. diff -r 5336e146ac8d -r 6db54bed2417 piecrust/commands/builtin/util.py --- a/piecrust/commands/builtin/util.py Thu Jun 09 22:25:16 2016 -0700 +++ b/piecrust/commands/builtin/util.py Thu Jun 09 22:26:18 2016 -0700 @@ -4,7 +4,7 @@ import codecs import logging import yaml -from piecrust import CACHE_DIR +from piecrust import CACHE_DIR, RESOURCES_DIR from piecrust.app import CONFIG_PATH, THEME_CONFIG_PATH from piecrust.commands.base import ChefCommand @@ -39,18 +39,13 @@ if not os.path.isdir(os.path.dirname(config_path)): os.makedirs(os.path.dirname(config_path), 0o755) - config_text = yaml.dump({ - 'site': { - 'title': "My New Website", - 'description': "A website recently generated with PieCrust", - 'pretty_urls': True - }, - 'smartypants': { - 'enable': True - } - }, - default_flow_style=False) - with codecs.open(config_path, 'w', 'utf-8') as fp: + tpl_path = os.path.join(RESOURCES_DIR, 'webinit', CONFIG_PATH) + if ctx.args.theme: + tpl_path = os.path.join(RESOURCES_DIR, 'webinit', THEME_CONFIG_PATH) + with open(tpl_path, 'r', encoding='utf-8') as fp: + config_text = fp.read() + + with open(config_path, 'w', encoding='utf-8') as fp: fp.write(config_text) diff -r 5336e146ac8d -r 6db54bed2417 piecrust/resources/webinit/config.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piecrust/resources/webinit/config.yml Thu Jun 09 22:26:18 2016 -0700 @@ -0,0 +1,8 @@ + +# For more settings, see: https://bolt80.com/piecrust/en/latest/docs/reference/website-configuration/ + +site: + title: My New Website + description: A website recently generated with PieCrust + pretty_urls: true + diff -r 5336e146ac8d -r 6db54bed2417 piecrust/resources/webinit/theme_config.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piecrust/resources/webinit/theme_config.yml Thu Jun 09 22:26:18 2016 -0700 @@ -0,0 +1,9 @@ + +theme: + name: MyNewTheme + url: https://example.org + description: A PieCrust theme. + +site: + pretty_urls: true +