-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeremy Kun
committed
Jun 1, 2016
1 parent
afe9a86
commit cb15dde
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
) |