Skip to content

Commit

Permalink
added publish command
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Kun committed Jun 1, 2016
1 parent afe9a86 commit cb15dde
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Empty file added hello/management/__init__.py
Empty file.
Empty file.
37 changes: 37 additions & 0 deletions hello/management/commands/publish.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import logging
import sys
from datetime import datetime

from django.core.management.base import BaseCommand

from hello import settings
from two1.commands import publish
from two1.server import rest_client


class Command(BaseCommand):
help = 'Publish your app to the marketplace'

def __init__(self):
super().__init__()
self._logger = logging.getLogger('hello.publish')
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
self._username = settings.TWO1_USERNAME
self._client = rest_client.TwentyOneRestClient(
username=self._username, wallet=settings.WALLET
)

def handle(self, *args, **options):
manifest_path = 'hello/manifest.yaml'
app_name = 'Hello 21'
try:
publish._publish(self._client, manifest_path, '21market', True, {})
self._logger.info(
'%s publishing %s - published: True, Timestamp: %s' %
(self._username, app_name, datetime.now())
)
except Exception as e:
self._logger.error(
'%s publishing %s - published: False, error: %s, Timestamp: %s' %
(self._username, app_name, e, datetime.now())
)

0 comments on commit cb15dde

Please sign in to comment.