A collection of sample configuration profiles aiming to demonstrate different aspects of the usage of ctgen
.
More information about ctgen
can be found here
Currently available samples and their purpose:
docs
: Creates a Markdown document describing the database structure.dump
: Creates a dump of thectgen
task context. Useful for debugging and exploration.prompts
: Demonstrates commonly used prompts and their properties and effects.rhai
: Demonstrates newly added rhai packages, likechrono
,fs
,url
andsci
.- More to come...
Assuming you already have ctgen
installed*0 (and the rest*1) and configured in your $PATH
.
- Go to the directory containing this README.
cd ~/path/to/ctgen-samples
- Use the following bash snippet to load all sample profiles into the
ctgen
profile registry:
for d in profiles/* ; do ctgen config add "$d"; done
or by manually adding the ones you're interested in using ctgen config add [path-to-profile]
.
-
Verify that the profiles are properly registered by running
ctgen config ls
-
Start an example MariaDB database server using docker by running:
docker-compose up -d
The example docker setup launches a MariaDB*2 instance running on port 3306
(might conflict with locally running instances) and phpMyAdmin on port 8888
for convenience*3.
- Since the
.env
file for the sample profiles is in the same directory, you can run each profile you want to test from here.
- Run the
dump
example:
ctgen run --profile dump
After answering all prompts you should get a file output/dump/dump.json
- Run the
docs
example:
ctgen run --profile docs
After answering all prompts you should get a file output/docs/db_example.md
and another one depending on the table you selected as a target table.
- Run the
prompts
example:
ctgen run --profile prompts
After answering all prompts you should get a file output/prompts/prompts_<table name>.md
depending on the table you selected as a target table.
- Run the
rhai
example:
ctgen run --profile rhai books
No prompts are defined for this template. You should get a file output/rhai/rhai.md
. The table you select does not matter.
- etc.
- Remove the example profiles from the registry:
for d in profiles/* ; do ctgen config rm "$d"; done
- Shutdown docker*2:
docker-compose down
- Go and create your first
ctgen
profile:
cd ~/path/to/where/youd/keep/this/shhh
ctgen init [profile name to create]
-
See how to install
ctgen
here -
To take full advantage of the provided samples you need
docker
,docker-compose
andjq
installed. If you don't usedocker
you can use the provided.docker/init.sql
to import in your own MariaDB instance and reconfigure the provided.env
file. -
After shutting down the example docker containers you might want to clean up the leftover data volume by running:
docker volume rm ctgen-samples_database-data
- To explore the database open localhost:8888