Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
HushmKun authored Apr 14, 2024
2 parents 767c4d1 + 4ff13d4 commit 34841ad
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ venv/
*vscode/

# JetBrains
.idea/
.idea/

# vscodium
*vscode/

17 changes: 17 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Lint using flake8",
"type": "shell",
"command": "flake8 artec --ignore=E101,W191"
},
{
"label": "Format using black",
"type": "shell",
"command": "black artec"
},
]
}
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved error reporting

### Fixed

- Fixed Issue [#8](https://github.com/HushmKun/Artec/issues/8)
- Fixed error building structure if the source starts with a file.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ $ vim structure.json
"pyproject.toml"
]
}
```
How to execute
```
Expand Down
3 changes: 2 additions & 1 deletion artec/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, appVersion):

def setup(self):
group = self.add_mutually_exclusive_group()

group.add_argument(
"-s",
"--source-file",
Expand All @@ -58,6 +58,7 @@ def setup(self):
required=False,
)


self.add_argument(
"-o",
"--output-directory",
Expand Down
1 change: 1 addition & 0 deletions artec/boiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _source_temp(self, template) -> list[dict[str, str]]:
try:
if template in templates:
structure = format_project_structure(templates[template], self.target)

else:
raise ex.InValidTemplate()

Expand Down
134 changes: 134 additions & 0 deletions artec/templates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
from . import exceptions as ex


class static_list(list):
def format(self, name):
try:
for _ in self:
for i, j in _.items():
_[i] = j.format(name)
return self
except AttributeError:
raise ex.NotValidJson()


PYTHON = static_list(
[
{"folder": "{}"},
{"file": "{}/__init__.py"},
{"folder": "test"},
{"file": "test/__init__.py"},
{"file": "README.md"},
{"file": "LICENSE"},
{"file": "setup.py"},
{"file": "setup.cfg"},
{"file": "pyproject.toml"},
]
)

FLASK = static_list(
[
{"folder": "{}"},
{"file": "{}/__init__.py"},
{"file": "{}/db.py"},
{"file": "{}/schema.py"},
{"file": "{}/auth.py"},
{"file": "{}/blog.py"},
{"folder": "{}/templates"},
{"file": "{}/templates/base.html"},
{"folder": "{}/templates/auth/"},
{"file": "{}/templates/auth/login.html"},
{"file": "{}/templates/auth/register.html"},
{"folder": "{}/blog"},
{"file": "{}/blog/create.html"},
{"file": "{}/blog/index.html"},
{"file": "{}/blog/update.html"},
{"folder": "{}/static"},
{"file": "{}/static/style.css"},
{"folder": "test"},
{"file": "test/__init__.py"},
{"file": "test/conftest.py"},
{"file": "test/data.sql"},
{"file": "test/test_db.py"},
{"file": "test/test_auth.py"},
{"file": "test/test_blog.py"},
{"file": "README.md"},
{"file": "LICENSE"},
{"file": "setup.py"},
{"file": "pyproject.toml"},
]
)

NODE_JS = static_list(
[
{"folder": "src"},
{"folder": "src/api"},
{"folder": "src/api/controllers"},
{"folder": "src/api/controllers/user"},
{"folder": "src/api/controllers/user/auth"},
{"file": "src/api/controllers/user/auth/forgot-password.js"},
{"file": "src/api/controllers/user/auth/login.js"},
{"file": "src/api/controllers/user/auth/logout.js"},
{"file": "src/api/controllers/user/auth/refresh-token.js"},
{"file": "src/api/controllers/user/auth/register.js"},
{"file": "src/api/controllers/user/auth/send-verification-code.js"},
{"file": "src/api/controllers/user/auth/verify-email.js"},
{"folder": "src/api/controllers/user/edit"},
{"file": "src/api/controllers/user/edit/change-password.js"},
{"file": "src/api/controllers/user/edit/edit-user.js"},
{"file": "src/api/controllers/user/delete-user.js"},
{"file": "src/api/controllers/user/get-user.js"},
{"file": "src/api/controllers/user/index.js"},
{"folder": "src/api/middlewares"},
{"folder": "src/api/middlewares/auth"},
{"file": "src/api/middlewares/auth/check-auth.js"},
{"file": "src/api/middlewares/auth/check-authority.js"},
{"file": "src/api/middlewares/image-upload.js"},
{"file": "src/api/middlewares/index.js"},
{"file": "src/api/middlewares/object-id-control.js"},
{"file": "src/api/middlewares/rate-limiter.js"},
{"folder": "src/api/routes"},
{"file": "src/api/routes/index.js"},
{"file": "src/api/routes/user.js"},
{"folder": "src/api/validators"},
{"file": "src/api/validators/index.js"},
{"file": "src/api/validators/user.validator.js"},
{"folder": "src/config"},
{"file": "src/config/index.js"},
{"folder": "src/loaders"},
{"file": "src/loaders/index.js"},
{"file": "src/loaders/express.js"},
{"file": "src/loaders/mongoose.js"},
{"folder": "src/models"},
{"file": "src/models/index.js"},
{"file": "src/models/log.js"},
{"file": "src/models/token.js"},
{"file": "src/models/user.js"},
{"folder": "src/utils"},
{"folder": "src/utils/helpers"},
{"file": "src/utils/helpers/error-helper.js"},
{"file": "src/utils/helpers/generate-random-code.js"},
{"file": "src/utils/helpers/ip-helper.js"},
{"file": "src/utils/helpers/jwt-token-helper.js"},
{"file": "src/utils/helpers/local-text-helper.js"},
{"folder": "src/utils/lang"},
{"file": "src/utils/lang/en.json"},
{"file": "src/utils/lang/get-text.json"},
{"file": "src/utils/lang/tr.json"},
{"file": "src/utils/index.js"},
{"file": "src/utils/logger.js"},
{"file": "src/utils/send-code-to-email.js"},
{"file": "src/app.js"},
{"file": ".env.sample"},
{"file": "README.md"},
{"file": "LICENSE"},
{"file": "package.json"},
{"file": "package-lock.json"},
]
)

templates = {
"python": PYTHON,
"node.js": NODE_JS,
"flask": FLASK,
}
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Build Tools"
]

dependencies = [
"GitPython"
]
Expand Down
2 changes: 1 addition & 1 deletion test/resources/structure.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"setup.py",
"pyproject.toml"
]
}
}
1 change: 1 addition & 0 deletions test/test_boiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import git
from pathlib import Path
from artec.boiler import boiler_builder

from artec.temp import *

VAILD_JSON = Path("./test/resources/structure.json")
Expand Down

0 comments on commit 34841ad

Please sign in to comment.