clixdev
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: clixdev | ||
| Version: 0.3.8.1 | ||
| Version: 0.3.8.2 | ||
| 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.1" | ||
| version = "0.3.8.2" | ||
| authors = [ | ||
@@ -10,0 +10,0 @@ { name="Eris Verne", email="erisverne7@gmail.com" }, |
| Metadata-Version: 2.1 | ||
| Name: clixdev | ||
| Version: 0.3.8.1 | ||
| Version: 0.3.8.2 | ||
| Summary: https://clix.dev command line tool. | ||
@@ -5,0 +5,0 @@ Author-email: Eris Verne <erisverne7@gmail.com> |
+22
-23
@@ -22,5 +22,4 @@ import os | ||
| # TODO some logic needed here | ||
| if os.path.exists(working_dir): | ||
| # sync() | ||
| # return True | ||
| shutil.rmtree(working_dir) | ||
@@ -30,9 +29,9 @@ os.makedirs(working_dir) | ||
| base_file_tree = { | ||
| 'README.md': README(), | ||
| 'manage.py': MANAGE(project_name), | ||
| 'requirements.txt': REQUIREMENTS(), | ||
| 'db.sqlite3': '', | ||
| 'static/': [], | ||
| project_name + '/': [('__init__.py', ''), ('wsgi.py', WSGI(project_name)), ('settings.py', SETTINGS(project_name, res.get('apps'), res.get('settings'), secret_key)), ('urls.py', URLS(res.get('apps')))], | ||
| } | ||
| # 'README.md': README(), | ||
| # 'requirements.txt': REQUIREMENTS(), | ||
| # 'db.sqlite3': '', | ||
| # 'static/': [], | ||
| # 'templates/': [], removed at beta | ||
@@ -54,9 +53,10 @@ # 'templates/admin/': [('base_site.html', """{% extends "admin/base_site.html" %}{% load static %}{% block extrahead %}<link rel="stylesheet" href="https://api.clix.dev/static/admin.css" type="text/css" />{% endblock %}""")], | ||
| # removed ('urls.py', APP_URLS(app)), ('models.py', MODELS(app)), ('admin.py', ADMIN(app)), ('apps.py', f"from django.apps import AppConfig\n\n\nclass AppConfig(AppConfig):\n\tname = '{app.get('name')}'"), ('tests.py', 'from django.test import TestCase'), because of beta | ||
| # removed 'migrations/': [('__init__.py', '')] for beta | ||
| for app in res.get('apps'): | ||
| file_extensions = { | ||
| '': [('__init__.py', ''), ('views.py', VIEWS(app))], | ||
| 'migrations/': [('__init__.py', '')], | ||
| } | ||
| # TODO can make this much simpler | ||
| for k, v in file_extensions.items(): | ||
| working_d = working_dir + app.get('name') + '/' + k | ||
| working_d = working_dir + 'clix' + '/' + k | ||
| os.mkdir(working_d) | ||
@@ -67,4 +67,4 @@ for file_name, file_content in v: | ||
| return True | ||
| sync(terminal_token, project_token, args) | ||
| return True | ||
@@ -85,15 +85,18 @@ except Exception as e: | ||
| import clixdev | ||
| if not os.path.exists(clixdev.__path__ + '/apps/clix'): | ||
| # os.mkdir(clixdev.__path__ + '/apps/clix') | ||
| os.mkdir(clixdev.__path__ + '/apps/clix/migrations') | ||
| 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') | ||
| f = open(clixdev.__path__ + '/apps' + '/__init__.py', 'w') | ||
| f = open(clixdev.__path__[0] + '/apps' + '/__init__.py', 'w') | ||
| f.write("") | ||
| f.close() | ||
| f = open(clixdev.__path__ + '/apps/clix' + '/__init__.py', 'w') | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/__init__.py', 'w') | ||
| f.write("") | ||
| f.close() | ||
| f = open(clixdev.__path__ + '/apps/clix/migrations' + '/__init__.py', 'w') | ||
| f = open(clixdev.__path__[0] + '/apps/clix/migrations' + '/__init__.py', 'w') | ||
| f.write("") | ||
@@ -103,11 +106,11 @@ f.close() | ||
| # write urls based on res -> api.clix.dev | ||
| f = open(clixdev.__path__ + '/apps/clix' + '/urls.py', 'w') | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/urls.py', 'w') | ||
| f.write(APP_URLS(res.get('apps')[0])) | ||
| f.close() | ||
| f = open(clixdev.__path__ + '/apps/clix' + '/models.py', 'w') | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/models.py', 'w') | ||
| f.write(MODELS(res.get('apps')[0])) | ||
| f.close() | ||
| f = open(clixdev.__path__ + '/apps/clix' + '/apps.py', 'w') | ||
| f = open(clixdev.__path__[0] + '/apps/clix' + '/apps.py', 'w') | ||
| f.write("""from django.apps import AppConfig | ||
@@ -125,6 +128,2 @@ | ||
| # f = open('/usr/local/.clix/projects.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() | ||
| return True |
@@ -10,6 +10,2 @@ import os | ||
| self.get_response = get_response | ||
| self.endpoints = [ | ||
| {"uri": "user/all/", "method": "GET", | ||
| "headers": {"Content-Type": "application/json"}} | ||
| ] | ||
@@ -26,11 +22,11 @@ def __call__(self, request): | ||
| has_errors = False | ||
| errors = { | ||
| "request": [], | ||
| "headers": [], | ||
| "params": [], | ||
| "body": [], | ||
| } | ||
| # has_errors = False | ||
| # errors = { | ||
| # "request": [], | ||
| # "headers": [], | ||
| # "params": [], | ||
| # "body": [], | ||
| # } | ||
| wrk_dr = "/usr/local/.clix/CDBCB8/" | ||
| # wrk_dr = "/usr/local/.clix/CDBCB8/" | ||
@@ -44,6 +40,6 @@ # if not os.path.exists(wrk_dr) or \ | ||
| f = open(wrk_dr + '_validators.txt') | ||
| app = json.load(f) | ||
| f.close() | ||
| app = json.loads(app)[0] | ||
| # f = open(wrk_dr + '_validators.txt') | ||
| # app = json.load(f) | ||
| # f.close() | ||
| # app = json.loads(app)[0] | ||
@@ -53,18 +49,18 @@ # request = detecting correct endpoint details based on Request URI (if not in list pass) | ||
| # validating request method | ||
| if str(request.method) != str(app['endpoints'][0]['request']['method']): | ||
| has_errors = True | ||
| errors['request'].append( | ||
| f"request {request.method} is not allowed") | ||
| # if str(request.method) != str(app['endpoints'][0]['request']['method']): | ||
| # has_errors = True | ||
| # errors['request'].append( | ||
| # f"request {request.method} is not allowed") | ||
| # validating request headers | ||
| for header in list(app['endpoints'][0]['headers']['body'].values()): | ||
| if header[0] not in request.headers.keys(): | ||
| has_errors = True | ||
| errors['headers'].append( | ||
| f"{header[0]} is missing from headers") | ||
| else: | ||
| if type(request.headers.keys()) != header[1]: | ||
| has_errors = True | ||
| errors['headers'].append( | ||
| f"{header[0]} should be {header[1]}") | ||
| # for header in list(app['endpoints'][0]['headers']['body'].values()): | ||
| # if header[0] not in request.headers.keys(): | ||
| # has_errors = True | ||
| # errors['headers'].append( | ||
| # f"{header[0]} is missing from headers") | ||
| # else: | ||
| # if type(request.headers.keys()) != header[1]: | ||
| # has_errors = True | ||
| # errors['headers'].append( | ||
| # f"{header[0]} should be {header[1]}") | ||
@@ -83,4 +79,4 @@ # validating request body type & payload | ||
| if has_errors: | ||
| return JsonResponse({"errors": errors}) if settings.DEBUG else JsonResponse(False, safe=False) | ||
| # if has_errors: | ||
| # return JsonResponse({"errors": errors}) if settings.DEBUG else JsonResponse(False, safe=False) | ||
@@ -87,0 +83,0 @@ response = self.get_response(request) |
@@ -22,4 +22,2 @@ def terminal(): | ||
| print(e) | ||
| return False | ||
| terminal() | ||
| return False |
@@ -273,3 +273,3 @@ def MANAGE(proj_name): | ||
| endpoints = app['endpoints'] | ||
| urls = [f"from django.urls import path\n\nfrom {app['name']}.views import *\n\nurlpatterns = ["] | ||
| urls = [f"from django.urls import path\n\nfrom clix.views import *\n\nurlpatterns = ["] | ||
@@ -289,3 +289,2 @@ for endpoint in endpoints: | ||
| def REQUIREMENTS(): | ||
@@ -292,0 +291,0 @@ return """""" |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
25779
-3.08%425
-1.85%