gibson-cli 0.2.0__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/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 +0 -2
- 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/data/bash-completion.tmpl +1 -1
- {gibson_cli-0.2.0.dist-info → gibson_cli-0.3.0.dist-info}/METADATA +1 -1
- {gibson_cli-0.2.0.dist-info → gibson_cli-0.3.0.dist-info}/RECORD +22 -21
- gibson/command/Rewrite.py +0 -107
- /gibson/command/{Api.py → rewrite/Api.py} +0 -0
- {gibson_cli-0.2.0.dist-info → gibson_cli-0.3.0.dist-info}/WHEEL +0 -0
- {gibson_cli-0.2.0.dist-info → gibson_cli-0.3.0.dist-info}/entry_points.txt +0 -0
- {gibson_cli-0.2.0.dist-info → gibson_cli-0.3.0.dist-info}/top_level.txt +0 -0
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
@@ -6,10 +6,8 @@ from gibson.services.auth.Server import Server as AuthServer
|
|
6
6
|
class Login(BaseCommand):
|
7
7
|
def execute(self):
|
8
8
|
authenticated = self.configuration.login()
|
9
|
-
|
10
9
|
if authenticated:
|
11
10
|
self.conversation.message_login_success()
|
12
11
|
else:
|
13
12
|
self.conversation.message_login_failure()
|
14
|
-
|
15
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/data/bash-completion.tmpl
CHANGED
@@ -71,10 +71,10 @@ __gibson_completions() {
|
|
71
71
|
import) __gibson_generate_completion "api datastore" ;;
|
72
72
|
list) __gibson_generate_completion "entities" ;;
|
73
73
|
new) __gibson_generate_completion "project" ;;
|
74
|
+
rewrite) __gibson_generate_completion "api base models schemas tests" ;;
|
74
75
|
# create) __gibson_generate_completion "project module entity" ;;
|
75
76
|
# project) __gibson_generate_completion "create delete list" ;;
|
76
77
|
# rename) __gibson_generate_completion "entity" ;;
|
77
|
-
# rewrite) __gibson_generate_completion "api base models schemas tests" ;;
|
78
78
|
esac
|
79
79
|
|
80
80
|
return 0
|
@@ -3,39 +3,39 @@ bin/release.sh,sha256=LxPqH5kxhLKvzHaPRLBlq_ApaK7FHEteH4SzeRenidk,49
|
|
3
3
|
gibson/api/BaseApi.py,sha256=l_EsHdKRz-cXGXd3Ju5IFwmCRUkunba6ckB957S9DAk,2696
|
4
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,7 +56,8 @@ 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
62
|
gibson/core/Configuration.py,sha256=-L1MS2gkXPEpTcuFCnpuMKIinvBgxdE02RhRh4fnccY,15633
|
62
63
|
gibson/core/Conversation.py,sha256=gFP0fZCNiQ8K44qUQpAt9xokxJTft3_nfqiHmEoFlUE,8811
|
@@ -64,7 +65,7 @@ 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
|
@@ -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
|