clixdev
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: clixdev | ||
| Version: 0.3.8.5 | ||
| Version: 0.3.8.6 | ||
| Summary: https://clix.dev command line tool. | ||
@@ -5,0 +5,0 @@ Author-email: Eris Verne <erisverne7@gmail.com> |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "clixdev" | ||
| version = "0.3.8.5" | ||
| version = "0.3.8.6" | ||
| authors = [ | ||
@@ -10,0 +10,0 @@ { name="Eris Verne", email="erisverne7@gmail.com" }, |
| Metadata-Version: 2.1 | ||
| Name: clixdev | ||
| Version: 0.3.8.5 | ||
| Version: 0.3.8.6 | ||
| Summary: https://clix.dev command line tool. | ||
@@ -5,0 +5,0 @@ Author-email: Eris Verne <erisverne7@gmail.com> |
+38
-31
@@ -13,10 +13,12 @@ import os | ||
| try: | ||
| res = requests.post('https://api.clix.dev/api/package/sync', | ||
| _dir = os.getcwd() | ||
| _res = requests.post('http://localhost:8000/api/package/sync', | ||
| data=json.dumps({ | ||
| 'terminal_token': terminal_token, | ||
| 'project_token': project_token, | ||
| 'local_path': _dir + '/' + args[0] + '/' if args[0] else _dir + '/', | ||
| })).json() | ||
| project_name = res.get('misc').get('project_name') | ||
| working_dir = os.getcwd() + '/' + args[0] + '/' + project_name + '/' if args[0] else os.getcwd() + '/' + project_name + '/' | ||
| project_name = _res.get('misc').get('project_name') | ||
| working_dir = _dir + '/' + args[0] + '/' + project_name + '/' if args[0] else _dir + '/' + project_name + '/' | ||
@@ -30,8 +32,8 @@ # TODO some logic needed here | ||
| 'manage.py': MANAGE(project_name), | ||
| project_name + '/': [('__init__.py', ''), ('wsgi.py', WSGI(project_name)), ('settings.py', SETTINGS(res.get('settings'),))], | ||
| project_name + '/': [('__init__.py', ''), ('wsgi.py', WSGI(project_name)), ('settings.py', SETTINGS(_res.get('settings'),))], | ||
| 'db.sqlite3': '', | ||
| } | ||
| # , ('urls.py', URLS(res.get('apps'))) | ||
| # , ('urls.py', URLS(_res.get('apps'))) | ||
| # 'README.md': README(), | ||
| # 'requirements.txt': REQUIREMENTS(), | ||
| # 'db.sqlite3': '', | ||
| # 'static/': [], | ||
@@ -55,3 +57,3 @@ # 'templates/': [], removed at beta | ||
| # removed 'migrations/': [('__init__.py', '')] for beta | ||
| for app in res.get('apps'): | ||
| for app in _res.get('apps'): | ||
| file_extensions = { | ||
@@ -78,3 +80,3 @@ '': [('__init__.py', ''), ('views.py', VIEWS(app))], | ||
| def sync(terminal_token, project_token, *args): | ||
| res = requests.post('https://api.clix.dev/api/package/sync', | ||
| _res = requests.post('http://localhost:8000/api/package/sync', | ||
| data=json.dumps({ | ||
@@ -87,55 +89,60 @@ 'terminal_token': terminal_token, | ||
| if not os.path.exists(clixdev.__path__[0] + '/apps'): | ||
| os.mkdir(clixdev.__path__[0] + '/apps') | ||
| if not os.path.exists(clixdev.__path__[0] + '/apps/clix'): | ||
| os.mkdir(clixdev.__path__[0] + '/apps/clix') | ||
| if not os.path.exists(clixdev.__path__[0] + '/apps/clix/migrations'): | ||
| os.mkdir(clixdev.__path__[0] + '/apps/clix/migrations') | ||
| os.mkdir(clixdev.__path__[0] + '/apps/clix/migrations') | ||
| if not os.path.exists(clixdev.__path__[0] + '/apps/clix'): | ||
| os.mkdir(clixdev.__path__[0] + '/apps/clix/migrations') | ||
| if not os.path.exists(clixdev.__path__[0] + '/apps/clix/migrations'): | ||
| os.mkdir(clixdev.__path__[0] + '/apps/clix/migrations') | ||
| f = open(clixdev.__path__[0] + '/apps' + '/__init__.py', 'w') | ||
| f.write("") | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps' + '/__init__.py', 777) | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/__init__.py', 'w') | ||
| f.write("") | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix' + '/__init__.py', 777) | ||
| f = open(clixdev.__path__[0] + '/apps/clix/migrations' + '/__init__.py', 'w') | ||
| f.write("") | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix/migrations' + '/__init__.py', 777) | ||
| # write urls based on res -> api.clix.dev | ||
| # write urls based on _res -> api.clix.dev | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/urls.py', 'w') | ||
| f.write(APP_URLS(res.get('apps')[0])) | ||
| f.write(APP_URLS(_res.get('apps')[0])) | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix' + '/urls.py', 777) | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/models.py', 'w') | ||
| f.write(BASE_MODELS(res.get('apps')[0])) | ||
| f.write(BASE_MODELS(_res.get('apps')[0])) | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix' + '/models.py', 777) | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/settings.py', 'w') | ||
| f.write(BASE_SETTINGS(res.get('misc').get('project_name'), res.get('misc').get('secret_key'))) | ||
| f.write(BASE_SETTINGS(_res.get('misc').get('project_name'), _res.get('misc').get('secret_key'))) | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix' + '/settings.py', 777) | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/apps.py', 'w') | ||
| f.write("""from django.apps import AppConfig | ||
| class AppConfig(AppConfig): | ||
| name = 'clixdev.apps.clix' | ||
| """) | ||
| f.write("""from django.apps import AppConfig\n\nclass AppConfig(AppConfig):\n\tname = 'clixdev.apps.clix'\n""") | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix' + '/apps.py', 777) | ||
| import clix | ||
| f = open(clix.__path__[0] + '/views.py', 'w') | ||
| # import clix | ||
| os.chmod('/Users/ramtinmir/Programing/Clix/cli/project_1/clix' + '/views.py', 777) | ||
| f = open(_res.get('misc').get('project_path') + '/clix/views.py', 'r+') | ||
| lines = f.readlines() | ||
| has_def = False | ||
| for row in lines: | ||
| word = 'def X4D20C' | ||
| if row.find(word) == 0: | ||
| f.write(f"""@csrf_exempt\ndef X4D20C(request, *args, **kwargs):\n\tbody = json.loads(request.body)\n\treturn JsonResponse({{}})\n\n""") | ||
| has_def = True | ||
| if not has_def: | ||
| f.write(f"""\n@csrf_exempt\ndef X4D20C(request, *args, **kwargs):\n\t# body = json.loads(request.body)\n\n\treturn JsonResponse({{}})\n\n""") | ||
| f.close() | ||
| # not sure about views yet | ||
| # f = open('projects/' + '/_validators.txt', 'w') | ||
| # f.write(json.dumps("""[{"name": "API", "base_url": "api", "endpoints": [{"misc": {"endpoint_id": "ae0937d9-95e4-4ea1-9ff5-76312209e948", "is_draft": false, "token": "rcxxday", "name": "Get all users", "description": "The description", "base_url": "api"}, "request": {"method": "GET", "host": "localhost", "uri": "users/all"}, "headers": {"authorization": true, "body": {"0": ["auth-token", "str"]}}, "params": {"0": ["d", "uuid"]}, "body": {"type": "none", "payload": {}}, "response": {"code": "200", "message": "OK"}}], "models": [{"table_name": "User", "fields": {"0": ["D372D1", "id", "UUIDField", null, null, false, false, false, true, true], "1": ["F8B9D7", "f_name", "CharField", null, null, true, true, true, false, false], "2": ["D0BA20", "l_name", "CharField", null, null, true, true, true, false, false], "3": ["21341C", "created_at", "DateTimeField", null, null, false, false, true, false, false]}}]}]""")) | ||
| # f.close() | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/validators.py', 'w') | ||
| f.write(json.dumps("""[{"name": "API", "base_url": "api", "endpoints": [{"misc": {"endpoint_id": "ae0937d9-95e4-4ea1-9ff5-76312209e948", "is_draft": false, "token": "rcxxday", "name": "Get all users", "description": "The description", "base_url": "api"}, "request": {"method": "GET", "host": "localhost", "uri": "users/all"}, "headers": {"authorization": true, "body": {"0": ["auth-token", "str"]}}, "params": {"0": ["id", "uuid"]}, "body": {"type": "none", "payload": {}}, "response": {"code": "200", "message": "OK"}}], "models": [{"table_name": "User", "fields": {"0": ["D372D1", "id", "UUIDField", null, null, false, false, false, true, true], "1": ["F8B9D7", "f_name", "CharField", null, null, true, true, true, false, false], "2": ["D0BA20", "l_name", "CharField", null, null, true, true, true, false, false], "3": ["21341C", "created_at", "DateTimeField", null, null, false, false, true, false, false]}}]}]""")) | ||
| f.close() | ||
| os.chmod(clixdev.__path__[0] + '/apps/clix' + '/validators.py', 777) | ||
| return True |
@@ -5,2 +5,3 @@ import os | ||
| from django.http import JsonResponse | ||
| # from clixdev.apps.clix import validators | ||
@@ -46,2 +47,16 @@ | ||
| """ | ||
| Sudo code: | ||
| if uri: | ||
| if method: | ||
| check headers (1.exist 2.type check) | ||
| check params (1.exist 2.type check) | ||
| check body* | ||
| check response* | ||
| else: | ||
| error method not allowed | ||
| else: | ||
| let django handle (endpoint doesn't exist) | ||
| """ | ||
| # validating request method | ||
@@ -48,0 +63,0 @@ # if str(request.method) != str(app['endpoints'][0]['request']['method']): |
@@ -128,3 +128,6 @@ def MANAGE(proj_name): | ||
| DEBUG = True | ||
| ALLOWED_HOSTS += [] | ||
| INSTALLED_APPS += [] | ||
| MIDDLEWARE += [] | ||
@@ -134,5 +137,2 @@ #### SETTINGS #### | ||
| INSTALLED_APPS += [] | ||
| MIDDLEWARE += [] | ||
| """ | ||
@@ -154,3 +154,3 @@ | ||
| endpoints = app['endpoints'] | ||
| defs = ["from django.http import JsonResponse\nfrom clixdev.apps.clix.models import *\nfrom django.views.decorators.csrf import csrf_exempt"] | ||
| defs = ["import json\nfrom django.http import JsonResponse\nfrom clixdev.apps.clix.models import *\nfrom django.views.decorators.csrf import csrf_exempt"] | ||
@@ -176,2 +176,3 @@ for endpoint in endpoints: | ||
| \treturn JsonResponse({{{responses}}}) | ||
| """) | ||
@@ -178,0 +179,0 @@ # removed for beta |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
26297
5%435
5.33%