diff --git a/hyde/engine.py b/hyde/engine.py index 00d334e..53f4aaa 100644 --- a/hyde/engine.py +++ b/hyde/engine.py @@ -150,7 +150,7 @@ class Engine(Application): @subcommand('publish', help='Publish the website') @store('-c', '--config-path', default='site.yaml', dest='config', help='The configuration used to generate the site') - @store('-p', '--publisher', dest='publisher', required=True, + @store('-p', '--publisher', dest='publisher', default='default', help='Points to the publisher configuration.') @store('-m', '--message', dest='message', help='Optional message.') diff --git a/hyde/publisher.py b/hyde/publisher.py index 6d68fa8..7eea9b2 100644 --- a/hyde/publisher.py +++ b/hyde/publisher.py @@ -34,16 +34,25 @@ class Publisher(object): @staticmethod def load_publisher(site, publisher, message): + logger = getLoggerWithNullHandler('hyde.engine.publisher') try: settings = attrgetter("publisher.%s" % publisher)(site.config) except AttributeError: - logger = getLoggerWithNullHandler('hyde.engine.publisher') - logger.error( - "Cannot find the publisher configuration: %s" % publisher) - raise + # Find the first configured publisher + settings = False + + if not settings: + try: + settings = site.config.publisher.__dict__.itervalues().next() + except (AttributeError, StopIteration): + logger.error( + "Cannot find the publisher configuration: %s" % publisher) + raise + if not hasattr(settings, 'type'): logger.error( "Publisher type not specified: %s" % publisher) raise Exception("Please specify the publisher type in config.") + pub_class = load_python_object(settings.type) return pub_class(site, settings, message) \ No newline at end of file