-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
126 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,109 @@ | ||
# geny | ||
An extendable file generator | ||
|
||
 | ||
 | ||
 | ||
 | ||
 | ||
|
||
|
||
- [geny](#geny) | ||
- [Installation](#installation) | ||
- [Extending the CLI](#extending-the-cli) | ||
- [Dependencies](#dependencies) | ||
- [Interactive Docs](#interactive-docs) | ||
- [To Do](#to-do) | ||
- [Pull requests](#pull-requests) | ||
- [LICENSE](#license) | ||
|
||
## Installation | ||
Install via [pip](https://pypi.org/project/geny): | ||
```bash | ||
pip install geny | ||
``` | ||
|
||
After installation, the CLI will expose the binary with the name: | ||
``` | ||
geny | ||
``` | ||
|
||
## Extending the CLI | ||
|
||
Currently, there are two main ways of extending the functionality of the CLI: | ||
1. Adding your own commands/plugins | ||
2. Overriding the provided resource templates | ||
|
||
### Including your own commands | ||
|
||
If you would like to extend the functionality of this CLI, you can include your own `plugins/commands` by | ||
setting an environment variable: `GENY_PLUGINS`. Simply set this variable to the path where your plugins are. | ||
|
||
Plugin commands are auto-discovered if they are placed under the plugins directory, | ||
but please be sure to do the following for this to work: | ||
1. **Name your package and click command the same**. That is, a package called `get`, for example, should define a `get` command. | ||
2. **Place the command definition within the package's `main.py` module**. For example: | ||
```python | ||
# get/main.py | ||
import click | ||
|
||
|
||
@click.command() | ||
@click.pass_context | ||
def get(ctx): | ||
pass | ||
``` | ||
3. **Sub-commands should be added to the top-most command group in the package's `main.py` module.** | ||
```python | ||
# get/main.py | ||
import click | ||
|
||
|
||
@click.group() # <- group | ||
@click.pass_context | ||
def get(ctx): | ||
pass | ||
|
||
|
||
@click.command() | ||
@click.pass_context | ||
def foo(ctx): | ||
pass | ||
|
||
|
||
get.add_command(foo) | ||
``` | ||
4. **Access your commands via your top-most command group.** | ||
``` | ||
django-clite get foo | ||
``` | ||
|
||
**NOTE:** If you would like to skip a plugin/command from being auto-discovered, simply rename the package by either | ||
prepending or appending any number of underscores (`_`). Any code contained within the package will be ignored. | ||
|
||
### Overriding the templates | ||
|
||
The flag `--templates-dir` can be used to configure an additional path wherein the CLI can look for resource templates. | ||
Alternatively, you can use the environment variable `GENY_TEMPLATES_DIR` for the same purpose. | ||
|
||
## Development | ||
|
||
### Install from source: | ||
``` | ||
git clone https://github.com/oleoneto/geny.git | ||
cd geny | ||
pip install --editable . | ||
``` | ||
|
||
### Dependencies | ||
Check out [pyproject.toml](pyproject.toml) for all installation dependencies. | ||
|
||
## To Do | ||
[Check out our open issues](https://github.com/oleoneto/geny/issues). | ||
|
||
## Pull requests | ||
Found a bug? See a typo? Have an idea for new command? | ||
Feel free to submit a pull request with your contributions. They are much welcome and appreciated. | ||
|
||
## LICENSE | ||
**geny** is [BSD Licensed](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,58 @@ | ||
# These settings are provided for development purposes only. Not suitable for production. | ||
|
||
version: '3' | ||
|
||
{% if 'database' in services %} | ||
volumes: | ||
database: | ||
{% endif %} | ||
|
||
|
||
services: | ||
app: | ||
container_name: "{{ project }}_web" | ||
labels: | ||
com.{{ project }}.web.description: "{{ project }}: Web Application" | ||
build: | ||
context: . | ||
# command: "gunicorn {{ project }}.wsgi:application --bind 0.0.0.0:{{ port }} --workers {{ workers }}" | ||
volumes: | ||
- .:/app | ||
env_file: | ||
- .env | ||
environment: | ||
DJANGO_ENV: docker | ||
entrypoint: /docker-entrypoint.sh | ||
command: "gunicorn {{ project }}.wsgi:application --bind 0.0.0.0:{{ port }} --workers {{ workers }}" | ||
ports: | ||
- 8007:8000 # host:docker | ||
{%- if services %} | ||
depends_on: | ||
{%- for service in services %} | ||
- {{ service }} | ||
{% endfor %} | ||
{% endif %} | ||
- database | ||
- celery-worker | ||
|
||
|
||
{%- if 'database' in services %} | ||
database: | ||
container_name: "{{ project }}_database" | ||
image: postgres:12-alpine | ||
labels: | ||
com.database.description: "{{ project }}: Database service" | ||
image: postgres:15-alpine | ||
volumes: | ||
- ./database:/var/lib/postgresql/data/ | ||
ports: | ||
- 5437:5432 # host:docker | ||
env_file: | ||
- .env | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_ready -U postgres"] | ||
interval: 10s | ||
timeout: 83s | ||
retries: 40 | ||
restart: always | ||
{% endif %} | ||
restart: unless-stopped | ||
|
||
{%- if 'redis' in services %} | ||
redis: | ||
container_name: "{{ project }}_redis" | ||
image: redis:latest | ||
labels: | ||
com.redis.description: "{{ project }}: Redis cache service" | ||
ports: | ||
- 6377:6379 # host:docker | ||
restart: always | ||
{% endif %} | ||
restart: unless-stopped | ||
|
||
{%- if 'celery' in services %} | ||
celery_worker: | ||
container_name: "{{ project }}_celery_worker" | ||
labels: | ||
com.celery.description: "{{ project }}: Celery Worker" | ||
build: | ||
context: . | ||
command: celery worker --app {{ project }} --concurrency=20 -linfo -E | ||
# command: celery worker --app {{ project }} --concurrency=20 -linfo -E | ||
depends_on: | ||
- redis | ||
env_file: | ||
- .env | ||
restart: on-failure | ||
stop_grace_period: 5s | ||
{% endif %} | ||
|
||
|
||
# These settings are provided for development purposes only. Not suitable for production. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
# Example variables that could be in an environment file. | ||
# Commit only the .env-example file, not the .env file. Use the example file to illustrate | ||
# what variables your environment uses, but be sure to not commit this file with any sensitive information. | ||
# what variables need to be in your application environment, but be sure to not commit this file | ||
# as it may contain sensitive information. | ||
|
||
DEBUG=True | ||
SERVER_EMAIL="[email protected]" | ||
REDIS_URL="redis://[:password]@127.0.0.1:6379" | ||
DATABASE_URL="postgres://username:password@localhost:5432/database" | ||
|
||
ADMINS=# i.e (('Admin', '[email protected]'),) | ||
|
||
SECRET_KEY= | ||
|
||
SERVER_EMAIL=# i.e [email protected] | ||
EMAIL_HOST= | ||
EMAIL_HOST_USER= | ||
EMAIL_HOST_PASSWORD= | ||
|
||
REDIS_URL=# i.e. redis://[:password]@127.0.0.1:6379 | ||
|
||
DATABASE_URL=postgres://u:p@service:5432/service | ||
SECRET_KEY="" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.