Skip to content

Commit 392dd40

Browse files
authored
Merge pull request #60 from oleoneto/v0.19.1rc
0.19.1
2 parents 58e6024 + 3ef6321 commit 392dd40

File tree

153 files changed

+680
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+680
-620
lines changed

.husky/commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
3-
npx --no-install commitlint --edit "$1"
3+
#npx --no-install commitlint --edit "$1"

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base image
2-
FROM python:3.13.0a1-alpine
2+
FROM python:3.13.0a4-alpine
33

44
LABEL MAINTAINER="Leo Neto"
55

@@ -17,4 +17,4 @@ COPY . .
1717
# Install dependencies
1818
RUN apk add gcc musl-dev linux-headers && pip install -e .
1919

20-
ENTRYPOINT ["django-clite"]
20+
CMD ["django-clite"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ prepending or appending any number of underscores (`_`). Any code contained with
8787
The flag `--templates-dir` can be used to configure an additional path wherein the CLI can look for resource templates.
8888
Alternatively, you can use the environment variable `DJANGO_CLITE_TEMPLATES_DIR` for the same purpose.
8989

90-
Take a look at the [template files directory](src/cli/template_files) for a reference of what files can be overriden. The
90+
Take a look at the [template files directory](django_clite/cli/template_files) for a reference of what files can be overriden. The
9191
paths of the templates you wish to override need to match the provided template. For example, if you wish to override the
92-
model template, which is defined under [`src/cli/template_files/models/model.tpl`](src/cli/template_files/models/model.tpl),
92+
model template, which is defined under [`src/cli/template_files/models/model.tpl`](django_clite/cli/template_files/models/model.tpl),
9393
you should define your own model template under your desired directory, i.e `/path/to/templates/models/model.tpl`.
9494

9595
## Development
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
django-clite: a cli tool that handles creating and managing Django projects
44
"""
55
import os
6+
from .constants import PLUGINS_ENV_VAR
67

7-
__version__ = "0.19.0"
88
__license__ = "BSD 3-Clause"
99
__author__ = "Leo Neto"
1010
__copyright__ = "Copyright 2019-2023 Leo Neto"
1111

1212
COMMANDS_FOLDER = os.path.join(os.path.dirname(__file__), "commands")
1313

14-
PLUGINS_FOLDER = os.environ.get("DJANGO_CLITE_PLUGINS", None)
15-
16-
VERSION = __version__
14+
PLUGINS_FOLDER = os.environ.get(PLUGINS_ENV_VAR, None)

django_clite/cli/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# django_clite:cli

src/cli/app.py renamed to django_clite/cli/cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
import logging
33
from pathlib import Path
44

5-
from cli.extensions.combined import AliasedAndDiscoverableGroup
5+
from django_clite.extensions.combined import AliasedAndDiscoverableGroup
66
from geny.core.filesystem.finder import core_project_files, project_and_app_names
77
from geny.core.templates.template import TemplateParser
88

9-
from cli import VERSION
10-
from cli.constants import (
9+
from django_clite.constants import (
1110
DJANGO_FILES_KEY,
1211
ENABLE_DRY_RUN_KEY,
1312
ENABLE_DEBUG_KEY,
1413
ENABLE_FORCE_KEY,
1514
ENABLE_VERBOSITY_KEY,
1615
PROJECT_NAME_KEY,
1716
APPLICATION_NAME_KEY,
17+
TEMPLATES_DIRECTORY_ENV_VAR,
1818
)
1919

2020

@@ -23,18 +23,18 @@
2323
)
2424
@click.option("--debug", is_flag=True, help="Enable debug logs.")
2525
@click.option("--dry", is_flag=True, help="Do not modify the file system.")
26-
@click.option("-f", "--force", is_flag=True, help="Override any conflicting files.")
26+
@click.option("-f", "--force", is_flag=True, envvar=ENABLE_FORCE_KEY, help="Override any conflicting files.")
2727
@click.option("--verbose", is_flag=True, help="Enable verbosity.")
2828
@click.option("--project", help="Project name.")
2929
@click.option("--app", help="Application name.")
3030
@click.option(
3131
"--templates-dir",
3232
"-t",
33-
envvar="DJANGO_CLITE_TEMPLATES_DIR",
33+
envvar=TEMPLATES_DIRECTORY_ENV_VAR,
3434
help="Template directory.",
3535
type=click.Path(),
3636
)
37-
@click.version_option(version=VERSION)
37+
@click.version_option(package_name="django-clite")
3838
@click.pass_context
3939
def cli(ctx, debug, dry, force, verbose, project, app, templates_dir):
4040
"""
@@ -86,7 +86,7 @@ def cli(ctx, debug, dry, force, verbose, project, app, templates_dir):
8686
django_files = core_project_files()
8787
project_name, app_name = project_and_app_names(django_files)
8888

89-
templates = [Path(__file__).resolve().parent / "template_files"]
89+
templates = [Path(__file__).resolve().parent.parent / "template_files"]
9090

9191
if templates_dir is not None:
9292
templates.append(Path(templates_dir))

django_clite/commands/callbacks.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django_clite.cli.utils import sanitized_string
2+
from django_clite.core.field_parser.factory import AttributeFactory
3+
4+
5+
def sanitized_string_callback(_ctx, _param, value):
6+
return sanitized_string(value)
7+
8+
9+
def fields_callback(ctx, _param, values):
10+
return AttributeFactory().parsed_fields(values)

0 commit comments

Comments
 (0)