gibson-cli 0.1.6__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gibson/api/BaseApi.py +9 -26
- gibson/api/Cli.py +2 -2
- gibson/command/Code.py +2 -2
- gibson/command/Import.py +2 -2
- gibson/command/Remove.py +2 -2
- gibson/command/Rename.py +2 -2
- gibson/command/Version.py +2 -1
- gibson/command/auth/Auth.py +5 -2
- gibson/command/auth/Login.py +4 -11
- gibson/command/auth/Logout.py +1 -0
- gibson/command/{Base.py → rewrite/Base.py} +0 -5
- gibson/command/{Models.py → rewrite/Models.py} +0 -4
- gibson/command/rewrite/Rewrite.py +124 -0
- gibson/command/{Schemas.py → rewrite/Schemas.py} +1 -5
- gibson/command/{Tests.py → rewrite/Tests.py} +1 -5
- gibson/core/Colors.py +64 -0
- gibson/core/CommandRouter.py +8 -38
- gibson/core/Configuration.py +43 -3
- gibson/core/Conversation.py +22 -3
- gibson/data/bash-completion.tmpl +12 -9
- gibson/lang/Python.py +5 -3
- gibson/lang/tests/test_lang_Python.py +2 -7
- gibson/services/code/customization/Authenticator.py +1 -1
- {gibson_cli-0.1.6.dist-info → gibson_cli-0.3.0.dist-info}/METADATA +1 -1
- {gibson_cli-0.1.6.dist-info → gibson_cli-0.3.0.dist-info}/RECORD +29 -28
- gibson/command/Rewrite.py +0 -107
- /gibson/command/{Api.py → rewrite/Api.py} +0 -0
- {gibson_cli-0.1.6.dist-info → gibson_cli-0.3.0.dist-info}/WHEEL +0 -0
- {gibson_cli-0.1.6.dist-info → gibson_cli-0.3.0.dist-info}/entry_points.txt +0 -0
- {gibson_cli-0.1.6.dist-info → gibson_cli-0.3.0.dist-info}/top_level.txt +0 -0
gibson/api/BaseApi.py
CHANGED
@@ -1,41 +1,18 @@
|
|
1
1
|
import os
|
2
|
+
|
2
3
|
import requests
|
3
4
|
|
4
5
|
from gibson.core.Configuration import Configuration
|
5
6
|
|
6
7
|
|
7
8
|
class BaseApi:
|
8
|
-
API_ENV = os.environ.get("GIBSONAI_API_ENV", "staging")
|
9
9
|
VERSION = "v1"
|
10
10
|
|
11
11
|
def __init__(self, configuration: Configuration):
|
12
12
|
self.configuration = configuration
|
13
13
|
|
14
|
-
def api_domain(self):
|
15
|
-
domains = {
|
16
|
-
"local": "http://localhost:8000",
|
17
|
-
"staging": "https://staging-api.gibsonai.com",
|
18
|
-
"production": "https://api.gibsonai.com",
|
19
|
-
}
|
20
|
-
return domains[self.API_ENV]
|
21
|
-
|
22
|
-
def app_domain(self):
|
23
|
-
domains = {
|
24
|
-
"local": "http://localhost:5173",
|
25
|
-
"staging": "https://staging-app.gibsonai.com",
|
26
|
-
"production": "https://app.gibsonai.com",
|
27
|
-
}
|
28
|
-
return domains[self.API_ENV]
|
29
|
-
|
30
14
|
def base_url(self):
|
31
|
-
return f"{self.api_domain()}/{self.VERSION}"
|
32
|
-
|
33
|
-
def client_id(self):
|
34
|
-
return {
|
35
|
-
"local": "9b0cbebd-3eb4-47be-89ac-4aa589316ff4",
|
36
|
-
"staging": "02459e16-f356-4c01-b689-59847ed04b0a",
|
37
|
-
"production": "da287371-240b-4b53-bfde-4b1581cca62a",
|
38
|
-
}[self.API_ENV]
|
15
|
+
return f"{self.configuration.api_domain()}/{self.VERSION}"
|
39
16
|
|
40
17
|
def get(self, endpoint):
|
41
18
|
r = requests.get(self.url(endpoint), headers=self.headers())
|
@@ -82,6 +59,7 @@ class BaseApi:
|
|
82
59
|
)
|
83
60
|
|
84
61
|
if r.status_code != 200:
|
62
|
+
self.configuration.set_auth_tokens(None, None)
|
85
63
|
return False
|
86
64
|
|
87
65
|
parsed = r.json()
|
@@ -96,12 +74,17 @@ class BaseApi:
|
|
96
74
|
return f"{self.base_url()}/{endpoint}"
|
97
75
|
|
98
76
|
def __raise_for_status(self, r):
|
77
|
+
if r.status_code == 401:
|
78
|
+
print("\n\nYou need to log in to continue. Please run:\n")
|
79
|
+
print(" gibson auth login\n\n")
|
80
|
+
print("and then try again.\n")
|
81
|
+
exit(1)
|
82
|
+
|
99
83
|
try:
|
100
84
|
r.raise_for_status()
|
101
85
|
except:
|
102
86
|
try:
|
103
87
|
message = r.json()
|
104
|
-
|
105
88
|
print("=" * 78)
|
106
89
|
print("Raw Response:\n")
|
107
90
|
print(message)
|
gibson/api/Cli.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from gibson.core.Configuration import Configuration
|
2
|
-
from gibson.lang.Python import Python
|
3
2
|
from gibson.core.Memory import Memory
|
3
|
+
from gibson.lang.Python import Python
|
4
4
|
|
5
5
|
from .BaseApi import BaseApi
|
6
6
|
|
@@ -61,7 +61,7 @@ class Cli(BaseApi):
|
|
61
61
|
|
62
62
|
def headers(self):
|
63
63
|
headers = {
|
64
|
-
"X-Gibson-Client-ID": self.client_id(),
|
64
|
+
"X-Gibson-Client-ID": self.configuration.client_id(),
|
65
65
|
"X-Gibson-API-Key": self.configuration.project.api.key,
|
66
66
|
}
|
67
67
|
|
gibson/command/Code.py
CHANGED
@@ -6,7 +6,7 @@ from string import Template
|
|
6
6
|
from gibson.api.Cli import Cli
|
7
7
|
from gibson.command.BaseCommand import BaseCommand
|
8
8
|
from gibson.command.Merge import Merge
|
9
|
-
from gibson.command.Rewrite import Rewrite
|
9
|
+
from gibson.command.rewrite.Rewrite import Rewrite
|
10
10
|
from gibson.core.Configuration import Configuration
|
11
11
|
from gibson.display.Header import Header
|
12
12
|
from gibson.display.WorkspaceFooter import WorkspaceFooter
|
@@ -129,7 +129,7 @@ class Code(BaseCommand):
|
|
129
129
|
Merge(self.configuration).execute()
|
130
130
|
self.conversation.unmute()
|
131
131
|
|
132
|
-
Rewrite(self.configuration, wipe=False).
|
132
|
+
Rewrite(self.configuration, wipe=False).write()
|
133
133
|
|
134
134
|
self.conversation.newline()
|
135
135
|
|
gibson/command/Import.py
CHANGED
@@ -5,7 +5,7 @@ from sqlalchemy.orm import sessionmaker
|
|
5
5
|
|
6
6
|
from gibson.api.Cli import Cli
|
7
7
|
from gibson.command.BaseCommand import BaseCommand
|
8
|
-
from gibson.command.Rewrite import Rewrite
|
8
|
+
from gibson.command.rewrite.Rewrite import Rewrite
|
9
9
|
from gibson.db.TableExceptions import TableExceptions
|
10
10
|
|
11
11
|
|
@@ -48,7 +48,7 @@ class Import(BaseCommand):
|
|
48
48
|
self.conversation.newline()
|
49
49
|
|
50
50
|
if write_code:
|
51
|
-
Rewrite(self.configuration).
|
51
|
+
Rewrite(self.configuration).write()
|
52
52
|
self.conversation.newline()
|
53
53
|
|
54
54
|
return True
|
gibson/command/Remove.py
CHANGED
@@ -2,7 +2,7 @@ import sys
|
|
2
2
|
|
3
3
|
from gibson.api.Cli import Cli
|
4
4
|
from gibson.command.BaseCommand import BaseCommand
|
5
|
-
from gibson.command.Rewrite import Rewrite
|
5
|
+
from gibson.command.rewrite.Rewrite import Rewrite
|
6
6
|
|
7
7
|
|
8
8
|
class Remove(BaseCommand):
|
@@ -63,7 +63,7 @@ class Remove(BaseCommand):
|
|
63
63
|
self.conversation.type(f"[Removed] {sys.argv[2]}\n")
|
64
64
|
self.conversation.newline()
|
65
65
|
|
66
|
-
Rewrite(self.configuration, header="Refactoring").
|
66
|
+
Rewrite(self.configuration, header="Refactoring").write()
|
67
67
|
|
68
68
|
self.conversation.newline()
|
69
69
|
|
gibson/command/Rename.py
CHANGED
@@ -2,7 +2,7 @@ import sys
|
|
2
2
|
|
3
3
|
from gibson.api.Cli import Cli
|
4
4
|
from gibson.command.BaseCommand import BaseCommand
|
5
|
-
from gibson.command.Rewrite import Rewrite
|
5
|
+
from gibson.command.rewrite.Rewrite import Rewrite
|
6
6
|
|
7
7
|
|
8
8
|
class Rename(BaseCommand):
|
@@ -53,7 +53,7 @@ class Rename(BaseCommand):
|
|
53
53
|
self.conversation.type(f"[Renamed] {sys.argv[2]} -> {sys.argv[3]}\n")
|
54
54
|
self.conversation.newline()
|
55
55
|
|
56
|
-
Rewrite(self.configuration, header="Refactoring").
|
56
|
+
Rewrite(self.configuration, header="Refactoring").write()
|
57
57
|
|
58
58
|
self.conversation.newline()
|
59
59
|
|
gibson/command/Version.py
CHANGED
gibson/command/auth/Auth.py
CHANGED
@@ -3,6 +3,7 @@ import sys
|
|
3
3
|
from gibson.command.auth.Login import Login
|
4
4
|
from gibson.command.auth.Logout import Logout
|
5
5
|
from gibson.command.BaseCommand import BaseCommand
|
6
|
+
from gibson.core.Colors import argument, command, hint, subcommand
|
6
7
|
|
7
8
|
|
8
9
|
class Auth(BaseCommand):
|
@@ -18,8 +19,10 @@ class Auth(BaseCommand):
|
|
18
19
|
|
19
20
|
def usage(self):
|
20
21
|
self.conversation.type(
|
21
|
-
f"usage: {self.configuration.command} auth login\n"
|
22
|
-
|
22
|
+
f"usage: {command(self.configuration.command)} {subcommand('auth')} {argument('login')} {hint('login to Gibson')} \n"
|
23
|
+
)
|
24
|
+
self.conversation.type(
|
25
|
+
f" or: {command(self.configuration.command)} {subcommand('auth')} {argument('logout')} {hint('logout of Gibson')}\n"
|
23
26
|
)
|
24
27
|
self.conversation.newline()
|
25
28
|
exit(1)
|
gibson/command/auth/Login.py
CHANGED
@@ -5,16 +5,9 @@ from gibson.services.auth.Server import Server as AuthServer
|
|
5
5
|
|
6
6
|
class Login(BaseCommand):
|
7
7
|
def execute(self):
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
if access_token is None or refresh_token is None:
|
12
|
-
self.conversation.newline()
|
13
|
-
self.conversation.type(
|
14
|
-
"Login failed, please try again with `gibson auth login`."
|
15
|
-
)
|
8
|
+
authenticated = self.configuration.login()
|
9
|
+
if authenticated:
|
10
|
+
self.conversation.message_login_success()
|
16
11
|
else:
|
17
|
-
self.
|
18
|
-
self.conversation.type(f"Welcome! You are now logged in.")
|
19
|
-
|
12
|
+
self.conversation.message_login_failure()
|
20
13
|
self.conversation.newline()
|
gibson/command/auth/Logout.py
CHANGED
@@ -6,11 +6,6 @@ from gibson.dev.Dev import Dev
|
|
6
6
|
|
7
7
|
class Base(BaseCommand):
|
8
8
|
def execute(self):
|
9
|
-
entities = self.memory.recall_merged()
|
10
|
-
if len(entities) == 0:
|
11
|
-
self.conversation.cant_no_entities(self.configuration.project.name)
|
12
|
-
exit(1)
|
13
|
-
|
14
9
|
time_keeper = TimeKeeper()
|
15
10
|
dev = Dev(self.configuration)
|
16
11
|
|
@@ -11,10 +11,6 @@ class Models(BaseCommand):
|
|
11
11
|
for entity in self.memory.entities:
|
12
12
|
entities.append(entity["name"])
|
13
13
|
|
14
|
-
if len(entities) == 0:
|
15
|
-
self.conversation.cant_no_entities(self.configuration.project.name)
|
16
|
-
exit(1)
|
17
|
-
|
18
14
|
time_keeper = TimeKeeper()
|
19
15
|
|
20
16
|
cli = Cli(self.configuration)
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import os
|
2
|
+
import shutil
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from gibson.core.Colors import arguments, command, hint, subcommand
|
6
|
+
from gibson.core.Configuration import Configuration
|
7
|
+
from gibson.core.TimeKeeper import TimeKeeper
|
8
|
+
from gibson.services.code.customization.CustomizationManager import CustomizationManager
|
9
|
+
|
10
|
+
from ..BaseCommand import BaseCommand
|
11
|
+
from .Api import Api
|
12
|
+
from .Base import Base
|
13
|
+
from .Models import Models
|
14
|
+
from .Schemas import Schemas
|
15
|
+
from .Tests import Tests
|
16
|
+
|
17
|
+
|
18
|
+
class Rewrite(BaseCommand):
|
19
|
+
def __init__(
|
20
|
+
self,
|
21
|
+
configuration: Configuration,
|
22
|
+
header="Writing Code",
|
23
|
+
wipe=True,
|
24
|
+
with_header=False,
|
25
|
+
):
|
26
|
+
super().__init__(configuration)
|
27
|
+
self.wipe = wipe
|
28
|
+
self.with_header = with_header
|
29
|
+
self.arguments = ["api", "base", "models", "schemas", "tests"]
|
30
|
+
|
31
|
+
def execute(self):
|
32
|
+
if len(sys.argv) != 3:
|
33
|
+
self.write()
|
34
|
+
elif sys.argv[2] in self.arguments:
|
35
|
+
self.write(sys.argv[2])
|
36
|
+
else:
|
37
|
+
self.usage()
|
38
|
+
|
39
|
+
def write(self, argument=None):
|
40
|
+
if len(self.memory.recall_merged()) == 0:
|
41
|
+
self.conversation.cant_no_entities(self.configuration.project.name)
|
42
|
+
exit(1)
|
43
|
+
|
44
|
+
if self.with_header is True:
|
45
|
+
self.conversation.display_project(self.configuration.project.name)
|
46
|
+
|
47
|
+
customization_manager = CustomizationManager(self.configuration).preserve()
|
48
|
+
|
49
|
+
try:
|
50
|
+
if self.wipe is True:
|
51
|
+
for root, dirs, files in os.walk(
|
52
|
+
os.path.expandvars(self.configuration.project.dev.base.path)
|
53
|
+
):
|
54
|
+
for file in files:
|
55
|
+
os.unlink(os.path.join(root, file))
|
56
|
+
|
57
|
+
for dir_ in dirs:
|
58
|
+
shutil.rmtree(os.path.join(root, dir_))
|
59
|
+
|
60
|
+
self.conversation.type("Writing Code\n")
|
61
|
+
|
62
|
+
if argument is None or argument == "api":
|
63
|
+
time_keeper = TimeKeeper()
|
64
|
+
self.conversation.type(" API ")
|
65
|
+
self.conversation.mute()
|
66
|
+
# Disable customization management here so we don't process this twice (see finally block)
|
67
|
+
Api(self.configuration).disable_customization_management().execute()
|
68
|
+
self.conversation.unmute()
|
69
|
+
self.conversation.type(time_keeper.get_display())
|
70
|
+
self.conversation.newline()
|
71
|
+
|
72
|
+
if argument is None or argument == "base":
|
73
|
+
time_keeper = TimeKeeper()
|
74
|
+
self.conversation.type(" Base ")
|
75
|
+
self.conversation.mute()
|
76
|
+
Base(self.configuration).execute()
|
77
|
+
self.conversation.unmute()
|
78
|
+
self.conversation.type(time_keeper.get_display())
|
79
|
+
self.conversation.newline()
|
80
|
+
|
81
|
+
if argument is None or argument == "models":
|
82
|
+
time_keeper = TimeKeeper()
|
83
|
+
self.conversation.type(" Models ")
|
84
|
+
self.conversation.mute()
|
85
|
+
Models(self.configuration).execute()
|
86
|
+
self.conversation.unmute()
|
87
|
+
self.conversation.type(time_keeper.get_display())
|
88
|
+
self.conversation.newline()
|
89
|
+
|
90
|
+
if argument is None or argument == "schemas":
|
91
|
+
time_keeper = TimeKeeper()
|
92
|
+
self.conversation.type(" Schemas ")
|
93
|
+
self.conversation.mute()
|
94
|
+
Schemas(self.configuration).execute()
|
95
|
+
self.conversation.unmute()
|
96
|
+
self.conversation.type(time_keeper.get_display())
|
97
|
+
self.conversation.newline()
|
98
|
+
|
99
|
+
if argument is None or argument == "tests":
|
100
|
+
time_keeper = TimeKeeper()
|
101
|
+
self.conversation.type(" Tests ")
|
102
|
+
self.conversation.mute()
|
103
|
+
Tests(self.configuration).execute()
|
104
|
+
self.conversation.unmute()
|
105
|
+
self.conversation.type(time_keeper.get_display())
|
106
|
+
self.conversation.newline()
|
107
|
+
finally:
|
108
|
+
customization_manager.restore()
|
109
|
+
|
110
|
+
if self.with_header is True:
|
111
|
+
self.conversation.newline()
|
112
|
+
|
113
|
+
return self
|
114
|
+
|
115
|
+
def usage(self):
|
116
|
+
self.conversation.display_project(self.configuration.project.name)
|
117
|
+
self.conversation.type(
|
118
|
+
f"usage: {command(self.configuration.command)} {subcommand('rewrite')} {hint('rewrite all code')} \n"
|
119
|
+
)
|
120
|
+
self.conversation.type(
|
121
|
+
f" or: {command(self.configuration.command)} {subcommand('rewrite')} {arguments(self.arguments)} {hint('rewrite only the specified code')}\n"
|
122
|
+
)
|
123
|
+
self.conversation.newline()
|
124
|
+
exit(1)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from gibson.api.Cli import Cli
|
2
|
-
from gibson.dev.Dev import Dev
|
3
2
|
from gibson.command.BaseCommand import BaseCommand
|
4
3
|
from gibson.core.TimeKeeper import TimeKeeper
|
4
|
+
from gibson.dev.Dev import Dev
|
5
5
|
|
6
6
|
|
7
7
|
class Schemas(BaseCommand):
|
@@ -11,10 +11,6 @@ class Schemas(BaseCommand):
|
|
11
11
|
for entity in self.memory.entities:
|
12
12
|
entities.append(entity["name"])
|
13
13
|
|
14
|
-
if len(entities) == 0:
|
15
|
-
self.conversation.cant_no_entities(self.configuration.project.name)
|
16
|
-
exit(1)
|
17
|
-
|
18
14
|
time_keeper = TimeKeeper()
|
19
15
|
|
20
16
|
cli = Cli(self.configuration)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from gibson.api.Cli import Cli
|
2
|
-
from gibson.dev.Dev import Dev
|
3
2
|
from gibson.command.BaseCommand import BaseCommand
|
4
3
|
from gibson.core.TimeKeeper import TimeKeeper
|
4
|
+
from gibson.dev.Dev import Dev
|
5
5
|
|
6
6
|
|
7
7
|
class Tests(BaseCommand):
|
@@ -11,10 +11,6 @@ class Tests(BaseCommand):
|
|
11
11
|
for entity in self.memory.entities:
|
12
12
|
entities.append(entity["name"])
|
13
13
|
|
14
|
-
if len(entities) == 0:
|
15
|
-
self.conversation.cant_no_entities(self.configuration.project.name)
|
16
|
-
exit(1)
|
17
|
-
|
18
14
|
time_keeper = TimeKeeper()
|
19
15
|
|
20
16
|
cli = Cli(self.configuration)
|
gibson/core/Colors.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
class Color:
|
2
|
+
BLACK = "\033[30m"
|
3
|
+
BLACK_BG = "\033[40m"
|
4
|
+
BLINK = "\033[5m"
|
5
|
+
BLINK2 = "\033[6m"
|
6
|
+
BLUE = "\033[34m"
|
7
|
+
BLUE_BG = "\033[44m"
|
8
|
+
BLUE_BG2 = "\033[104m"
|
9
|
+
BLUE2 = "\033[94m"
|
10
|
+
BOLD = "\033[1m"
|
11
|
+
CYAN = "\033[36m"
|
12
|
+
CYAN_BG = "\033[46m"
|
13
|
+
CYAN_BG2 = "\033[106m"
|
14
|
+
CYAN2 = "\033[96m"
|
15
|
+
END = "\033[0m"
|
16
|
+
GREEN = "\033[32m"
|
17
|
+
GREEN_BG = "\033[42m"
|
18
|
+
GREEN_BG2 = "\033[102m"
|
19
|
+
GREEN2 = "\033[92m"
|
20
|
+
GREY = "\033[90m"
|
21
|
+
GREY_BG = "\033[100m"
|
22
|
+
ITALIC = "\033[3m"
|
23
|
+
RED = "\033[31m"
|
24
|
+
RED_BG = "\033[41m"
|
25
|
+
RED_BG2 = "\033[101m"
|
26
|
+
RED2 = "\033[91m"
|
27
|
+
SELECTED = "\033[7m"
|
28
|
+
UNDERLINE = "\033[4m"
|
29
|
+
VIOLET = "\033[35m"
|
30
|
+
VIOLET_BG = "\033[45m"
|
31
|
+
VIOLET_BG2 = "\033[105m"
|
32
|
+
VIOLET2 = "\033[95m"
|
33
|
+
WHITE = "\033[37m"
|
34
|
+
WHITE_BG = "\033[47m"
|
35
|
+
WHITE_BG2 = "\033[107m"
|
36
|
+
WHITE2 = "\033[97m"
|
37
|
+
YELLOW = "\033[33m"
|
38
|
+
YELLOW_BG = "\033[43m"
|
39
|
+
YELLOW_BG2 = "\033[103m"
|
40
|
+
YELLOW2 = "\033[93m"
|
41
|
+
|
42
|
+
|
43
|
+
def colorize(text, color):
|
44
|
+
return f"{color}{text}{Color.END}"
|
45
|
+
|
46
|
+
|
47
|
+
def command(text):
|
48
|
+
return colorize(text, Color.GREEN)
|
49
|
+
|
50
|
+
|
51
|
+
def subcommand(text):
|
52
|
+
return colorize(text, Color.YELLOW)
|
53
|
+
|
54
|
+
|
55
|
+
def argument(text):
|
56
|
+
return colorize(text, Color.VIOLET)
|
57
|
+
|
58
|
+
|
59
|
+
def arguments(list):
|
60
|
+
return f"[{'|'.join(map(lambda x: argument(x), list))}]"
|
61
|
+
|
62
|
+
|
63
|
+
def hint(text):
|
64
|
+
return colorize(text, Color.GREY)
|
gibson/core/CommandRouter.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import sys
|
2
2
|
|
3
|
-
from gibson.command.Api import Api
|
4
3
|
from gibson.command.auth.Auth import Auth
|
5
|
-
from gibson.command.Base import Base
|
6
4
|
from gibson.command.Build import Build
|
7
5
|
from gibson.command.Code import Code
|
8
6
|
from gibson.command.Conf import Conf
|
@@ -13,7 +11,6 @@ from gibson.command.Import import Import
|
|
13
11
|
from gibson.command.List import List
|
14
12
|
from gibson.command.Merge import Merge
|
15
13
|
from gibson.command.Model import Model
|
16
|
-
from gibson.command.Models import Models
|
17
14
|
from gibson.command.Modify import Modify
|
18
15
|
from gibson.command.Module import Module
|
19
16
|
from gibson.command.New import New
|
@@ -21,12 +18,15 @@ from gibson.command.OpenApi import OpenApi
|
|
21
18
|
from gibson.command.Question import Question
|
22
19
|
from gibson.command.Remove import Remove
|
23
20
|
from gibson.command.Rename import Rename
|
24
|
-
from gibson.command.
|
21
|
+
from gibson.command.rewrite.Api import Api
|
22
|
+
from gibson.command.rewrite.Base import Base
|
23
|
+
from gibson.command.rewrite.Models import Models
|
24
|
+
from gibson.command.rewrite.Rewrite import Rewrite
|
25
|
+
from gibson.command.rewrite.Schemas import Schemas
|
26
|
+
from gibson.command.rewrite.Tests import Tests
|
25
27
|
from gibson.command.Schema import Schema
|
26
|
-
from gibson.command.Schemas import Schemas
|
27
28
|
from gibson.command.Show import Show
|
28
29
|
from gibson.command.Test import Test
|
29
|
-
from gibson.command.Tests import Tests
|
30
30
|
from gibson.command.Tree import Tree
|
31
31
|
from gibson.command.Version import Version
|
32
32
|
from gibson.command.WarGames import WarGames
|
@@ -49,18 +49,10 @@ class CommandRouter:
|
|
49
49
|
dev_on = "*"
|
50
50
|
|
51
51
|
commands = {
|
52
|
-
"api": {
|
53
|
-
"description": "write the API code for the project",
|
54
|
-
"memory": "stored",
|
55
|
-
},
|
56
52
|
"auth": {
|
57
53
|
"description": "login | logout",
|
58
54
|
"memory": None,
|
59
55
|
},
|
60
|
-
"base": {
|
61
|
-
"description": "write the base code for the project",
|
62
|
-
"memory": "stored",
|
63
|
-
},
|
64
56
|
"build": {
|
65
57
|
"description": "create the entities in the datastore",
|
66
58
|
"memory": "stored",
|
@@ -96,10 +88,6 @@ class CommandRouter:
|
|
96
88
|
"description": "write the model code for an entity",
|
97
89
|
"memory": "stored",
|
98
90
|
},
|
99
|
-
"models": {
|
100
|
-
"description": "write all the model code",
|
101
|
-
"memory": "stored",
|
102
|
-
},
|
103
91
|
"modify": {
|
104
92
|
"description": "change an entity using natural language",
|
105
93
|
"memory": "last > stored",
|
@@ -116,26 +104,18 @@ class CommandRouter:
|
|
116
104
|
"memory": "last > stored",
|
117
105
|
},
|
118
106
|
"rewrite": {
|
119
|
-
"description": "rewrite
|
107
|
+
"description": "rewrite code",
|
120
108
|
"memory": "stored",
|
121
109
|
},
|
122
110
|
"schema": {
|
123
111
|
"description": "write the schema code for an entity",
|
124
112
|
"memory": "stored",
|
125
113
|
},
|
126
|
-
"schemas": {
|
127
|
-
"description": "write all the schema code",
|
128
|
-
"memory": "stored",
|
129
|
-
},
|
130
114
|
"show": {"description": "display an entity", "memory": "last > stored"},
|
131
115
|
"test": {
|
132
116
|
"description": "write the unit tests for an entity",
|
133
117
|
"memory": "stored",
|
134
118
|
},
|
135
|
-
"tests": {
|
136
|
-
"description": "write all the unit tests",
|
137
|
-
"memory": "stored",
|
138
|
-
},
|
139
119
|
"tree": {"description": "illustrate the project layout", "memory": None},
|
140
120
|
"? | q": {"description": "ask a question", "memory": None},
|
141
121
|
}
|
@@ -187,12 +167,8 @@ class CommandRouter:
|
|
187
167
|
Env().verify(self.configuration)
|
188
168
|
|
189
169
|
command = None
|
190
|
-
if sys.argv[1] == "
|
191
|
-
command = Api(self.configuration)
|
192
|
-
elif sys.argv[1] == "auth":
|
170
|
+
if sys.argv[1] == "auth":
|
193
171
|
command = Auth(self.configuration)
|
194
|
-
elif sys.argv[1] == "base":
|
195
|
-
command = Base(self.configuration)
|
196
172
|
elif sys.argv[1] == "build":
|
197
173
|
command = Build(self.configuration)
|
198
174
|
elif sys.argv[1] == "code":
|
@@ -213,8 +189,6 @@ class CommandRouter:
|
|
213
189
|
command = Merge(self.configuration)
|
214
190
|
elif sys.argv[1] == "model":
|
215
191
|
command = Model(self.configuration)
|
216
|
-
elif sys.argv[1] == "models":
|
217
|
-
command = Models(self.configuration)
|
218
192
|
elif sys.argv[1] == "modify":
|
219
193
|
command = Modify(self.configuration)
|
220
194
|
elif sys.argv[1] == "module":
|
@@ -231,14 +205,10 @@ class CommandRouter:
|
|
231
205
|
command = Rewrite(self.configuration, with_header=True)
|
232
206
|
elif sys.argv[1] == "schema":
|
233
207
|
command = Schema(self.configuration)
|
234
|
-
elif sys.argv[1] == "schemas":
|
235
|
-
command = Schemas(self.configuration)
|
236
208
|
elif sys.argv[1] == "show":
|
237
209
|
command = Show(self.configuration)
|
238
210
|
elif sys.argv[1] == "test":
|
239
211
|
command = Test(self.configuration)
|
240
|
-
elif sys.argv[1] == "tests":
|
241
|
-
command = Tests(self.configuration)
|
242
212
|
elif sys.argv[1] == "tree":
|
243
213
|
command = Tree(self.configuration)
|
244
214
|
elif sys.argv[1] in ["?", "q"]:
|
gibson/core/Configuration.py
CHANGED
@@ -6,11 +6,12 @@ import sys
|
|
6
6
|
import time
|
7
7
|
|
8
8
|
from gibson.conf.Dependencies import Dependencies
|
9
|
+
from gibson.conf.Paths import ConfigPaths
|
9
10
|
from gibson.conf.Platform import Platform
|
10
11
|
from gibson.conf.Project import Project
|
11
|
-
from gibson.conf.Paths import ConfigPaths
|
12
12
|
from gibson.core.Completions import Completions
|
13
13
|
from gibson.core.Conversation import Conversation
|
14
|
+
from gibson.services.auth.Server import Server as AuthServer
|
14
15
|
|
15
16
|
|
16
17
|
class Configuration:
|
@@ -37,6 +38,29 @@ class Configuration:
|
|
37
38
|
|
38
39
|
Completions().write().install()
|
39
40
|
|
41
|
+
def api_domain(self):
|
42
|
+
domains = {
|
43
|
+
"local": "http://localhost:8000",
|
44
|
+
"staging": "https://staging-api.gibsonai.com",
|
45
|
+
"production": "https://api.gibsonai.com",
|
46
|
+
}
|
47
|
+
return domains[self.API_ENV]
|
48
|
+
|
49
|
+
def app_domain(self):
|
50
|
+
domains = {
|
51
|
+
"local": "http://localhost:5173",
|
52
|
+
"staging": "https://staging-app.gibsonai.com",
|
53
|
+
"production": "https://app.gibsonai.com",
|
54
|
+
}
|
55
|
+
return domains[self.API_ENV]
|
56
|
+
|
57
|
+
def client_id(self):
|
58
|
+
return {
|
59
|
+
"local": "9b0cbebd-3eb4-47be-89ac-4aa589316ff4",
|
60
|
+
"staging": "02459e16-f356-4c01-b689-59847ed04b0a",
|
61
|
+
"production": "da287371-240b-4b53-bfde-4b1581cca62a",
|
62
|
+
}[self.API_ENV]
|
63
|
+
|
40
64
|
def append_project_to_conf(self, project_name, project_description):
|
41
65
|
self.project.api.key = "FIXME"
|
42
66
|
self.project.name = project_name
|
@@ -269,7 +293,7 @@ class Configuration:
|
|
269
293
|
|
270
294
|
def get_my_settings(self):
|
271
295
|
return self.settings[self.project.name]
|
272
|
-
|
296
|
+
|
273
297
|
def get_refresh_token(self):
|
274
298
|
try:
|
275
299
|
with open(f"{self.paths.auth}/{self.API_ENV}", "r") as f:
|
@@ -282,7 +306,15 @@ class Configuration:
|
|
282
306
|
|
283
307
|
def initialize(self):
|
284
308
|
self.conversation.message_welcome()
|
285
|
-
|
309
|
+
|
310
|
+
authenticated = self.login()
|
311
|
+
if authenticated is False:
|
312
|
+
self.conversation.message_login_failure()
|
313
|
+
exit(1)
|
314
|
+
else:
|
315
|
+
self.conversation.message_login_success()
|
316
|
+
|
317
|
+
self.conversation.message_project_setup()
|
286
318
|
project_name = self.conversation.prompt_project()
|
287
319
|
project_description = self.conversation.prompt_description(project_name)
|
288
320
|
|
@@ -308,6 +340,14 @@ class Configuration:
|
|
308
340
|
|
309
341
|
return self
|
310
342
|
|
343
|
+
def login(self):
|
344
|
+
access_token, refresh_token = AuthServer(self.app_domain()).get_tokens()
|
345
|
+
if access_token is None or refresh_token is None:
|
346
|
+
return False
|
347
|
+
|
348
|
+
self.set_auth_tokens(access_token, refresh_token)
|
349
|
+
return True
|
350
|
+
|
311
351
|
def read_config(self):
|
312
352
|
try:
|
313
353
|
with open(self.project.paths.config, "r") as f:
|
gibson/core/Conversation.py
CHANGED
@@ -123,6 +123,16 @@ class Conversation:
|
|
123
123
|
self.type('Last item of business, if you need help just type "gibson help".\n')
|
124
124
|
return self
|
125
125
|
|
126
|
+
def message_login_failure(self):
|
127
|
+
self.newline()
|
128
|
+
self.type("Login failed, please try again.\n")
|
129
|
+
return self
|
130
|
+
|
131
|
+
def message_login_success(self):
|
132
|
+
self.newline()
|
133
|
+
self.type("Nice! You're now logged in.\n")
|
134
|
+
return self
|
135
|
+
|
126
136
|
def message_new_project(self, project_name):
|
127
137
|
self.type(
|
128
138
|
f"\n{project_name} is going to be huge! Congratulations on the new project.\n\n"
|
@@ -134,11 +144,20 @@ class Conversation:
|
|
134
144
|
print(pyfiglet.figlet_format("GibsonAI", font="big").rstrip(), end="")
|
135
145
|
print(f" ...CLI v{Version.num}...")
|
136
146
|
self.newline()
|
147
|
+
self.type("Welcome to Gibson!\n")
|
137
148
|
self.pause()
|
138
|
-
self.
|
149
|
+
self.newline()
|
150
|
+
self.type("First, let's get you logged in.\n")
|
139
151
|
self.pause()
|
152
|
+
self.newline()
|
153
|
+
self.type("We're opening your web browser to the login page.\n")
|
154
|
+
self.type("Please log in and then return to this window.\n")
|
155
|
+
return self
|
156
|
+
|
157
|
+
def message_project_setup(self):
|
158
|
+
self.newline()
|
140
159
|
self.type(
|
141
|
-
"
|
160
|
+
"Now let's set up your first project. Give me the name of the project you're working on.\n"
|
142
161
|
)
|
143
162
|
self.type(
|
144
163
|
"Don't worry, once we get to know each other you'll be able to modify this\n"
|
@@ -182,7 +201,7 @@ class Conversation:
|
|
182
201
|
self.newline()
|
183
202
|
|
184
203
|
def pause(self):
|
185
|
-
time.sleep(
|
204
|
+
time.sleep(1)
|
186
205
|
|
187
206
|
def project_already_exists(self, project_name):
|
188
207
|
self.type(f'\nA project called "{project_name}" already exists.\n')
|
gibson/data/bash-completion.tmpl
CHANGED
@@ -47,18 +47,16 @@ __gibson_commands_and_options() {
|
|
47
47
|
tree
|
48
48
|
q
|
49
49
|
'
|
50
|
+
SHORT_OPTIONS='-v'
|
51
|
+
LONG_OPTIONS='--version'
|
52
|
+
OPTIONS="${SHORT_OPTIONS} ${LONG_OPTIONS}"
|
50
53
|
|
51
54
|
case "${current_word}" in
|
52
|
-
-*)
|
55
|
+
-*) __gibson_generate_completion "${OPTIONS}" ;;
|
53
56
|
*) __gibson_generate_completion "${COMMANDS}" ;;
|
54
57
|
esac
|
55
58
|
}
|
56
59
|
|
57
|
-
__gibson_options() {
|
58
|
-
OPTIONS='--version -v'
|
59
|
-
__gibson_generate_completion "${OPTIONS}"
|
60
|
-
}
|
61
|
-
|
62
60
|
__gibson_completions() {
|
63
61
|
declare previous_word
|
64
62
|
previous_word="${COMP_WORDS[COMP_CWORD - 1]}"
|
@@ -66,12 +64,17 @@ __gibson_completions() {
|
|
66
64
|
case "${previous_word}" in
|
67
65
|
gibson) __gibson_commands_and_options ;;
|
68
66
|
auth) __gibson_generate_completion "login logout" ;;
|
69
|
-
|
67
|
+
code) __gibson_generate_completion "entity" ;;
|
68
|
+
conf) __gibson_generate_completion "api::key code::custom::model::class code::custom::path datastore::uri" ;;
|
69
|
+
dev) __gibson_generate_completion "on off" ;;
|
70
|
+
forget) __gibson_generate_completion "stored last all" ;;
|
71
|
+
import) __gibson_generate_completion "api datastore" ;;
|
72
|
+
list) __gibson_generate_completion "entities" ;;
|
73
|
+
new) __gibson_generate_completion "project" ;;
|
74
|
+
rewrite) __gibson_generate_completion "api base models schemas tests" ;;
|
70
75
|
# create) __gibson_generate_completion "project module entity" ;;
|
71
|
-
# new) __gibson_generate_completion "project module entity" ;;
|
72
76
|
# project) __gibson_generate_completion "create delete list" ;;
|
73
77
|
# rename) __gibson_generate_completion "entity" ;;
|
74
|
-
# rewrite) __gibson_generate_completion "api base models schemas tests" ;;
|
75
78
|
esac
|
76
79
|
|
77
80
|
return 0
|
gibson/lang/Python.py
CHANGED
@@ -43,10 +43,12 @@ class Python:
|
|
43
43
|
|
44
44
|
return path
|
45
45
|
|
46
|
-
|
47
|
-
"
|
48
|
-
+ f" export PYTHONPATH=$PYTHONPATH:{os_path}\n"
|
46
|
+
print(
|
47
|
+
"Cannot make import path. Please execute the following command in your terminal:\n\n"
|
49
48
|
)
|
49
|
+
print(f" export PYTHONPATH=$PYTHONPATH:{os_path}\n\n")
|
50
|
+
print("and then try again.\n")
|
51
|
+
exit(1)
|
50
52
|
|
51
53
|
def make_python_path(self, path):
|
52
54
|
pythonpath = os.environ["PYTHONPATH"].split(":")
|
@@ -32,15 +32,10 @@ def test_define_python_path():
|
|
32
32
|
|
33
33
|
|
34
34
|
def test_make_import_path_exceptions():
|
35
|
-
with pytest.raises(
|
35
|
+
with pytest.raises(SystemExit) as e:
|
36
36
|
Python().make_import_path("/a/b/c")
|
37
37
|
|
38
|
-
assert
|
39
|
-
"""cannot make import path; please execute:
|
40
|
-
|
41
|
-
export PYTHONPATH=$PYTHONPATH:/a/b/c
|
42
|
-
"""
|
43
|
-
)
|
38
|
+
assert e.value.code == 1
|
44
39
|
|
45
40
|
|
46
41
|
def test_make_import_path():
|
@@ -1,41 +1,41 @@
|
|
1
1
|
bin/build.sh,sha256=H3TAd349BECbcK3_t_jW9VzoLInMNrXtaLnXMEVanew,49
|
2
2
|
bin/release.sh,sha256=LxPqH5kxhLKvzHaPRLBlq_ApaK7FHEteH4SzeRenidk,49
|
3
|
-
gibson/api/BaseApi.py,sha256=
|
4
|
-
gibson/api/Cli.py,sha256=
|
3
|
+
gibson/api/BaseApi.py,sha256=l_EsHdKRz-cXGXd3Ju5IFwmCRUkunba6ckB957S9DAk,2696
|
4
|
+
gibson/api/Cli.py,sha256=n2mmhZs1MFKhrDRVRWkDeHJtsun5ZwGfpTWpPngpkKE,7160
|
5
5
|
gibson/bin/gibson.py,sha256=N1mAWaww9pw8s5u0et87FC5cFHVU6JzN4Kls3lDn-xw,354
|
6
|
-
gibson/command/Api.py,sha256=sSvAqEJXdgQjYcu0uiM6ndHE3GnfkfVL6eqP2Otkbww,1002
|
7
|
-
gibson/command/Base.py,sha256=eqp9e3XlCpGt4j_aR2htsQnICgkZT6GWeQblCFM792g,819
|
8
6
|
gibson/command/BaseCommand.py,sha256=mmWUO0FxjMCbv3cHWnnasfAWnU_hTuGHUsRVJ4hUcqM,777
|
9
7
|
gibson/command/Build.py,sha256=ATKN6HJs5egheDKJ_7eYxuxdYLDJHEZjEZLZ5bdlS54,2571
|
10
|
-
gibson/command/Code.py,sha256=
|
8
|
+
gibson/command/Code.py,sha256=02zg8YrOMZPap_7d_IgXzTWKnuiKSRObWNRE65D1fZQ,6830
|
11
9
|
gibson/command/Conf.py,sha256=Wy8ybYAAnEtO6qPUyhVPAZdMayI0GHZNjMDTKSaIKsU,2390
|
12
10
|
gibson/command/Count.py,sha256=xsYPRXP8TrW0T8P6uhjuovc28oR2iQgukL81eLoMpOc,976
|
13
11
|
gibson/command/Dev.py,sha256=Vc9gnJ2gl_vmlS51Wksk7z46I4i3MGkEAS3ZCg-aEI0,4238
|
14
12
|
gibson/command/Forget.py,sha256=iM8SdUMMdiw8Vbn3bJ6dgdnNXg-MIt3VM4G1ix3Kei4,1058
|
15
|
-
gibson/command/Import.py,sha256=
|
13
|
+
gibson/command/Import.py,sha256=8atZJKqrEuJwIwh-AU_YmcFYdT46d_QazOxwR3pI9_w,3696
|
16
14
|
gibson/command/List.py,sha256=QgY2ycBxd6-z-qwXJ6JbCL1W_E0EiwAC8lTYCZ-Xgvg,2174
|
17
15
|
gibson/command/Merge.py,sha256=zJme8FIVbabJCPFhRjR1J3R7TDoqtGJtLsnErkx5Uw0,1089
|
18
16
|
gibson/command/Model.py,sha256=wBGBCdTJo7Y1nSzGyFbXuoV6vSNQVYm5V8I9CPuYuV8,1229
|
19
|
-
gibson/command/Models.py,sha256=I_OdeN0n-CSsc7-EnHKskeq7RNs76QYrN8aMdnbxrZY,931
|
20
17
|
gibson/command/Modify.py,sha256=y1rnHW9UEe9Y2u6xDy1tmO-ys4kZLSGyknlhzPsXqdE,1276
|
21
18
|
gibson/command/Module.py,sha256=ZaiRiv_kVCRpWwwpDyDrvloocwH_wcL0XXyRldIpj00,1280
|
22
19
|
gibson/command/New.py,sha256=aiWzoZc3Zj7OC2GhnS4pzPHZ-sduDV1-TOng2giE7TM,1157
|
23
20
|
gibson/command/OpenApi.py,sha256=c9LM_sXJr5W7hInur02kNGbUK9i3ZBROzKgy_oThXWI,4341
|
24
21
|
gibson/command/Question.py,sha256=bfAkfhSdNAfFqWp18Nv4CzdtFTCDW5BQaLxEci6V8H0,3748
|
25
|
-
gibson/command/Remove.py,sha256=
|
26
|
-
gibson/command/Rename.py,sha256=
|
27
|
-
gibson/command/Rewrite.py,sha256=IfKdMOmHYy_oXBASXLwBftUIwDc-yZKi1P6A1u3iyZM,3132
|
22
|
+
gibson/command/Remove.py,sha256=bM3G-1iRU_7OdaGBTCGmTTEtScVWnptc5aHMvUnAY5k,2398
|
23
|
+
gibson/command/Rename.py,sha256=TSwGTPBAmWE06SMtCtg6TX9aBNOX--kiiTS-0xj-epY,2226
|
28
24
|
gibson/command/Schema.py,sha256=w47Z2klLAUSGx8Ln6iCWCVuZtz6cHBMc_i4ru7DqhyI,1233
|
29
|
-
gibson/command/Schemas.py,sha256=QHuRG0PIYFuZqa-lSZ6KXTHcqrI_TuK9nZid6YaqepM,934
|
30
25
|
gibson/command/Show.py,sha256=oNGKeNfEo6Qz1n4rJIRjlLuHWHWs5lB0TWE8Vn3hE2U,1190
|
31
26
|
gibson/command/Test.py,sha256=7M7zVo9_dPGZ_hWlN9HcvuqHdpw1-Lc4--eK2fS7j10,1228
|
32
|
-
gibson/command/Tests.py,sha256=4aMGYCn-VQ5anQdPMDR6cNSR9I3LvMDywplXBWNmfas,931
|
33
27
|
gibson/command/Tree.py,sha256=JWvUimeHWY5-6vEh6axTkhAdI-dVTxbKSjx_4isAAx8,3041
|
34
|
-
gibson/command/Version.py,sha256=
|
28
|
+
gibson/command/Version.py,sha256=4St_HMM_ub8CHG61Zh2UZPzXawNabmtlRHZdvekdfd8,270
|
35
29
|
gibson/command/WarGames.py,sha256=V0KIpz-Z546qtQaOPdIVHQ6wp2n3r3M3tgKx-GRQzzU,1300
|
36
|
-
gibson/command/auth/Auth.py,sha256=
|
37
|
-
gibson/command/auth/Login.py,sha256=
|
38
|
-
gibson/command/auth/Logout.py,sha256=
|
30
|
+
gibson/command/auth/Auth.py,sha256=aOD5f4Ob9ZZ_eoodO2BgJ2-pNNE-BzoqwrYz-UGJHKo,956
|
31
|
+
gibson/command/auth/Login.py,sha256=b43OfV76i6aGdOwj1NK64ZOdYlNyc08g3lZGQ_37KDw,437
|
32
|
+
gibson/command/auth/Logout.py,sha256=V01q4TdbiBqCnIrM6IA4T25fO6ws0UpXp42I3pwHZVM,248
|
33
|
+
gibson/command/rewrite/Api.py,sha256=sSvAqEJXdgQjYcu0uiM6ndHE3GnfkfVL6eqP2Otkbww,1002
|
34
|
+
gibson/command/rewrite/Base.py,sha256=YJ2a5Hl0f9NXHUBBPvlt-dUIqEPWQz5vH6-1EHmbFbA,640
|
35
|
+
gibson/command/rewrite/Models.py,sha256=eoUpZHpR0qwNgX60EWfcNz49GHmBw_FGfBuHH2ueZqY,799
|
36
|
+
gibson/command/rewrite/Rewrite.py,sha256=1B6xRhWWXqZvwZND-pUtPeSW1AD_sWiec_jwAlFWdcg,4661
|
37
|
+
gibson/command/rewrite/Schemas.py,sha256=zZ1gjmOJg77gh70t5y2WkzHWSAvEKx5-gqRN9OcsCXA,802
|
38
|
+
gibson/command/rewrite/Tests.py,sha256=HO1WM6pSToVKsuJn7nUA_I5qrfBN0cgKgBzjlm2Qxt8,799
|
39
39
|
gibson/command/tests/test_command_BaseCommand.py,sha256=hSbBfLFI3RTp_DdEHtm5oOLWoN6drI6ucFJypi7xxV8,364
|
40
40
|
gibson/command/tests/test_command_Conf.py,sha256=NhN8tIZ_lwP0fV4jtplaxJbO3GTozsQVmiV5j1BNbxQ,583
|
41
41
|
gibson/conf/Api.py,sha256=GM9okYs1A8ujPjDwzziOoQpqRYFkr-dz5pgkfb6j4DI,59
|
@@ -56,15 +56,16 @@ gibson/conf/dev/Model.py,sha256=HbHRX3VDxR7hXlzuxkKw4Bf7FH6XMfQ96k9BeIUoBf4,73
|
|
56
56
|
gibson/conf/dev/Schema.py,sha256=kOSlX1jEyVb82xd8TO8jEAimLcaefIFJr6d2JYvyTqg,74
|
57
57
|
gibson/conf/tests/test_conf_Dependencies.py,sha256=LITeeYiqXM5rKkyWFBqcnMvUR5pzDRuHVAngH372jWc,116
|
58
58
|
gibson/conf/tests/test_conf_Platform.py,sha256=Zc53IsZmV-hT9VRrZEPNrsuehSdWnJXWKGMmOhEqWHo,138
|
59
|
-
gibson/core/
|
59
|
+
gibson/core/Colors.py,sha256=Us7C_SiPySogZABytlktw871gJGgETNFYcNeVyvtsjU,1363
|
60
|
+
gibson/core/CommandRouter.py,sha256=7U9eUsEPTwKHZEdeCcMXB_qmDXx6X9wCY_OUPBRyt8M,8477
|
60
61
|
gibson/core/Completions.py,sha256=N-mfeImSzw-d3Lrpu1KVnt0geMuKkbTaHpYTMYcPcAQ,1152
|
61
|
-
gibson/core/Configuration.py,sha256
|
62
|
-
gibson/core/Conversation.py,sha256=
|
62
|
+
gibson/core/Configuration.py,sha256=-L1MS2gkXPEpTcuFCnpuMKIinvBgxdE02RhRh4fnccY,15633
|
63
|
+
gibson/core/Conversation.py,sha256=gFP0fZCNiQ8K44qUQpAt9xokxJTft3_nfqiHmEoFlUE,8811
|
63
64
|
gibson/core/Env.py,sha256=7HFKGah25KjLelyOjYS8ylR6yDScT6utyZe7HdB3aRE,431
|
64
65
|
gibson/core/Memory.py,sha256=Anauq7vx883Bg5djoZCVyvAJBQeMtqQLzZtNecJMpZc,3921
|
65
66
|
gibson/core/TimeKeeper.py,sha256=0mzs04wizjGEJbiQFWZyi4ja4XgeJaDqc0JzPCHp9po,250
|
66
67
|
gibson/core/utils.py,sha256=KTnPvA3sUYnLFTZG7Tke5YEdls8Da0rNbeaOm8hapiU,408
|
67
|
-
gibson/data/bash-completion.tmpl,sha256=
|
68
|
+
gibson/data/bash-completion.tmpl,sha256=8XYbLMjyKlbaY4RVutxDqcwNLh5HNjTVDmZ3_Eci2xU,2726
|
68
69
|
gibson/data/default-ref-table.tmpl,sha256=cVqjTsmHDjmTGrbDEpNHaDG-GX1iWMzsQDXk5TASEXg,123
|
69
70
|
gibson/data/default-table.tmpl,sha256=4t7SmXBuZN4nV5SjuQp6PBdo0-c3hdRnl8TQ2wdaS3w,247
|
70
71
|
gibson/db/TableExceptions.py,sha256=F1NGHDhusg9E_3tLez1_abrbANtWyR0UtC_wE9CwNFE,137
|
@@ -76,8 +77,8 @@ gibson/display/WorkspaceHeader.py,sha256=1oyyhZJF6C0SUCY2Cs_VkXt5Plp8xLb51XWa278
|
|
76
77
|
gibson/display/tests/test_display_Header.py,sha256=I1GmB9RRa80rcYtgm3YXtpugdp5obca94zBVjmREYCY,324
|
77
78
|
gibson/display/tests/test_display_WorkspaceFooter.py,sha256=96syJutXZWbGOLiAS5SkRZjwEAgj0E0t-uTT85BJe_w,359
|
78
79
|
gibson/display/tests/test_display_WorkspaceHeader.py,sha256=9FuNLOkCAyFSDaonZbLQhLJSizc7bI2HAz3z1ifJlYs,316
|
79
|
-
gibson/lang/Python.py,sha256=
|
80
|
-
gibson/lang/tests/test_lang_Python.py,sha256=
|
80
|
+
gibson/lang/Python.py,sha256=WNbCTFhDh9qXVbeySyfaP-6m-c0wllSCZw8A-r_Z0Oo,1764
|
81
|
+
gibson/lang/tests/test_lang_Python.py,sha256=YpdqYOGAssg-jP9GuzfoU4Y4L7Boj0vAUAJgjuZvedo,1862
|
81
82
|
gibson/services/auth/Server.py,sha256=j8pjO8R6AUeFJnK2GI9H-C5YQcMlg1rliR08H4qy_CI,1953
|
82
83
|
gibson/services/code/context/schema/DataDictionary.py,sha256=zWLzxOzW8iMHxfXPEwnnbruEAtFa8j1UpghNd4AHzfA,369
|
83
84
|
gibson/services/code/context/schema/EntityKeys.py,sha256=rmCABPloMckvzfq9Gwx6DRP-RdmEwXarkpMR4boIQwQ,1569
|
@@ -85,7 +86,7 @@ gibson/services/code/context/schema/Manager.py,sha256=I_xcPrcE2nFJmBEXcIoJQ9lxKf
|
|
85
86
|
gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py,sha256=YkWrE1lzpR0amIeQC7lTUCSp54FRMGJrkfmu1FeOI7M,364
|
86
87
|
gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py,sha256=i--xVPHNw7Ks8kkuv9GmSbpp0BuMMKTGtPBY1HwT-60,2114
|
87
88
|
gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py,sha256=FiQFpFmJjv9g46QjmBjGVF3yz1GF0Q42j0fvZm5ZOYw,1230
|
88
|
-
gibson/services/code/customization/Authenticator.py,sha256=
|
89
|
+
gibson/services/code/customization/Authenticator.py,sha256=wSXKYyJQW129ImNe_ll_ecQct3Ql8tgvkbcCyoyNlBs,1597
|
89
90
|
gibson/services/code/customization/BaseCustomization.py,sha256=9a3S6KQEVXevqIv7q9BrPTP-luB2FsM0ULkSxEkYVrs,293
|
90
91
|
gibson/services/code/customization/CustomizationManager.py,sha256=wCwmN1S5lVQVsZyg2_Rwb7NW5kq-loWoJ466bUw6UVw,584
|
91
92
|
gibson/services/code/customization/tests/test_code_customization_Authenticator.py,sha256=kKExkLfKPpRA2NQH3fvRCuBEMhCGhR-IvNJqXuyBz3c,1949
|
@@ -103,8 +104,8 @@ gibson/structure/tests/test_Entity.py,sha256=Gl9f1NcEKdpWCx4W3takFFzp18mLhCYWKrd
|
|
103
104
|
gibson/tests/test_Env.py,sha256=DPWmP0-aEelducq9bAwv7rKoY2NjWXUeCrzfJDQkn2M,369
|
104
105
|
gibson/tests/test_Memory.py,sha256=YP7owToABAk_-s7fD5UG0HTc4lamDjdA39JUlLnk3Fg,2574
|
105
106
|
gibson/tests/test_utils.py,sha256=r_y-EG05YTCNtL8MWiAK1KmPsmeoMgypKsQC_lVgOtM,559
|
106
|
-
gibson_cli-0.
|
107
|
-
gibson_cli-0.
|
108
|
-
gibson_cli-0.
|
109
|
-
gibson_cli-0.
|
110
|
-
gibson_cli-0.
|
107
|
+
gibson_cli-0.3.0.dist-info/METADATA,sha256=VkuCt6nfzRP3AkFR1QtSmy-gbOG9-mkrrcM9bkm1sz4,11437
|
108
|
+
gibson_cli-0.3.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
109
|
+
gibson_cli-0.3.0.dist-info/entry_points.txt,sha256=j5VUvq3AzL21xPvVC24zMoXFt-I5lUWulr66nL3OAPM,50
|
110
|
+
gibson_cli-0.3.0.dist-info/top_level.txt,sha256=RFaUY7VXGiqkMwo1Rj7pM4kGvxkhhnfo-2LmPpuL_fs,11
|
111
|
+
gibson_cli-0.3.0.dist-info/RECORD,,
|
gibson/command/Rewrite.py
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import shutil
|
3
|
-
|
4
|
-
from gibson.core.Configuration import Configuration
|
5
|
-
from gibson.core.TimeKeeper import TimeKeeper
|
6
|
-
from gibson.services.code.customization.CustomizationManager import CustomizationManager
|
7
|
-
|
8
|
-
from .Api import Api
|
9
|
-
from .Base import Base
|
10
|
-
from .BaseCommand import BaseCommand
|
11
|
-
from .Models import Models
|
12
|
-
from .Schemas import Schemas
|
13
|
-
from .Tests import Tests
|
14
|
-
|
15
|
-
|
16
|
-
class Rewrite(BaseCommand):
|
17
|
-
def __init__(
|
18
|
-
self,
|
19
|
-
configuration: Configuration,
|
20
|
-
header="Writing Code",
|
21
|
-
wipe=True,
|
22
|
-
with_header=False,
|
23
|
-
):
|
24
|
-
super().__init__(configuration)
|
25
|
-
self.wipe = wipe
|
26
|
-
self.with_header = with_header
|
27
|
-
|
28
|
-
def execute(self):
|
29
|
-
if self.with_header is True:
|
30
|
-
self.conversation.display_project(self.configuration.project.name)
|
31
|
-
|
32
|
-
customization_manager = CustomizationManager(self.configuration).preserve()
|
33
|
-
|
34
|
-
try:
|
35
|
-
if self.wipe is True:
|
36
|
-
for root, dirs, files in os.walk(
|
37
|
-
os.path.expandvars(self.configuration.project.dev.base.path)
|
38
|
-
):
|
39
|
-
for file in files:
|
40
|
-
os.unlink(os.path.join(root, file))
|
41
|
-
|
42
|
-
for dir_ in dirs:
|
43
|
-
shutil.rmtree(os.path.join(root, dir_))
|
44
|
-
|
45
|
-
self.conversation.type("Writing Code\n")
|
46
|
-
|
47
|
-
time_keeper = TimeKeeper()
|
48
|
-
|
49
|
-
self.conversation.type(" API ")
|
50
|
-
|
51
|
-
self.conversation.mute()
|
52
|
-
Api(self.configuration).disable_customization_management().execute()
|
53
|
-
self.conversation.unmute()
|
54
|
-
|
55
|
-
self.conversation.type(time_keeper.get_display())
|
56
|
-
self.conversation.newline()
|
57
|
-
|
58
|
-
time_keeper = TimeKeeper()
|
59
|
-
|
60
|
-
self.conversation.type(" Base ")
|
61
|
-
|
62
|
-
self.conversation.mute()
|
63
|
-
Base(self.configuration).execute()
|
64
|
-
self.conversation.unmute()
|
65
|
-
|
66
|
-
self.conversation.type(time_keeper.get_display())
|
67
|
-
self.conversation.newline()
|
68
|
-
|
69
|
-
time_keeper = TimeKeeper()
|
70
|
-
|
71
|
-
self.conversation.type(" Models ")
|
72
|
-
|
73
|
-
self.conversation.mute()
|
74
|
-
Models(self.configuration).execute()
|
75
|
-
self.conversation.unmute()
|
76
|
-
|
77
|
-
self.conversation.type(time_keeper.get_display())
|
78
|
-
self.conversation.newline()
|
79
|
-
|
80
|
-
time_keeper = TimeKeeper()
|
81
|
-
|
82
|
-
self.conversation.type(" Schemas ")
|
83
|
-
|
84
|
-
self.conversation.mute()
|
85
|
-
Schemas(self.configuration).execute()
|
86
|
-
self.conversation.unmute()
|
87
|
-
|
88
|
-
self.conversation.type(time_keeper.get_display())
|
89
|
-
self.conversation.newline()
|
90
|
-
|
91
|
-
time_keeper = TimeKeeper()
|
92
|
-
|
93
|
-
self.conversation.type(" Tests ")
|
94
|
-
|
95
|
-
self.conversation.mute()
|
96
|
-
Tests(self.configuration).execute()
|
97
|
-
self.conversation.unmute()
|
98
|
-
|
99
|
-
self.conversation.type(time_keeper.get_display())
|
100
|
-
self.conversation.newline()
|
101
|
-
finally:
|
102
|
-
customization_manager.restore()
|
103
|
-
|
104
|
-
if self.with_header is True:
|
105
|
-
self.conversation.newline()
|
106
|
-
|
107
|
-
return self
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|