# Path: staticgen/tasks.py
# @shared_task
# def publish_pages():
#     message = _('Received task to publish/update all registered pages.')
#     logger.info(force_text(message))
#     LogEntry.objects.log_action(message)
# 
#     start_time = time.time()
# 
#     publisher = StaticgenPublisher()
#     publisher.publish(sync=True)
# 
#     elapsed_time = time.time() - start_time
#     message = _('Published or updated all registered pages successfully, '
#                 'in {elapsed_time:.2f} seconds.').format(elapsed_time=elapsed_time)
#     logger.info(message)


from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
from staticgen.tasks import publish_pages
# -*- coding: utf-8 -*-

from __future__ import unicode_literals




class Command(BaseCommand):

    help = 'Publish/update all registered pages to Amazon S3 via a Celery task.'

    def handle(self, *args, **options):

# Path: staticgen/tasks.py
# @shared_task
# def publish_pages():
#     message = _('Received task to publish/update all registered pages.')
#     logger.info(force_text(message))
#     LogEntry.objects.log_action(message)
# 
#     start_time = time.time()
# 
#     publisher = StaticgenPublisher()
#     publisher.publish(sync=True)
# 
#     elapsed_time = time.time() - start_time
#     message = _('Published or updated all registered pages successfully, '
#                 'in {elapsed_time:.2f} seconds.').format(elapsed_time=elapsed_time)
#     logger.info(message)


# Path: staticgen/management/commands/staticgen_publish_async.py
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
from staticgen.tasks import publish_pages

# -*- coding: utf-8 -*-

from __future__ import unicode_literals




class Command(BaseCommand):

    help = 'Publish/update all registered pages to Amazon S3 via a Celery task.'

    def handle(self, *args, **options):

        publish_pages.delay()