Cookies.Oven
Class that deploys cookiecutter templates.
Usage
Cookies.Oven(
repo=None,
user=None,
project=None,
basic_project=False,
website=None,
db_repo="databases",
output_dir=os.getcwd(),
recipes=CookBook()
)Methods
| Name | Description |
|---|---|
| __init__() | Deploy custom cookiecutter templates: |
| bake_the_app() | Create an app. |
| bake_the_db_repo() | Create a database directory. |
| bake_the_project() | Create a project directory. |
| bake_the_repo() | Create a new repository using the repository cookiecutter template. |
| bake_the_research() | Create a directory for a new research project. |
| bake_the_user() | Create a new directory system for the active user. |
| bake_the_website() | Create a website using the new_website cookie. |
__init__()
Deploy custom cookiecutter templates:
Usage
__init__(
repo=None,
user=None,
project=None,
basic_project=False,
website=None,
db_repo="databases",
output_dir=os.getcwd(),
recipes=CookBook()
)The Oven uses the different Ingredients (parameters/attributes) and the Cook Book(cookiecutter templates) to bake_the_cookies in the Oven(class methods).
After the cookies cool, they are put in the cookie_jar (output directory).
Parameters
repo: str | None = None-
An ingredient representing the repository name.
user: str | None = None-
An ingredient representing the user name.
project: str | None = None-
An ingredient representing the project name.
basic_project: bool = False-
A secret ingredient ONLY for the basic project cookie.
website: str | None = None-
An ingredient representing the website name.
db_repo: str = "databases"-
Name for the database repository. Defaults to “databases”.
output_dir: str | Path = os.getcwd()-
The cookie jar for storing the cookies.
recipes: CookBook = CookBook()- An index for the different recipe templates.
bake_the_app()
Create an app.
Usage
bake_the_app(app, cookie_jar=None)Creates a new app directory using the app cookiecutter template.
Parameters
app: str-
Name of the app.
cookie_jar: str | Path | None = None- Output directory for the generated app. Defaults to self.cookie_jar.
bake_the_db_repo()
Create a database directory.
Usage
bake_the_db_repo(
db_config_file, db_path, cookie_jar=None, archive_flag=False, delete=False
)Creates a new database inside the users database directory using the database cookiecutter template.
Parameters
db_config_file: str | Path-
Configuration file for database setup.
db_path: str | Path-
Path where the database should be created.
cookie_jar: str | Path | None = None-
Output directory for the generated database. Defaults to self.cookie_jar.
archive_flag: bool = False-
Whether to archive existing database before creating new one. Defaults to False.
delete: bool = False- Whether to delete existing database. USE WITH CAUTION. Defaults to False.
bake_the_project()
Create a project directory.
Usage
bake_the_project(cookie_jar=None)Creates a new project inside the user’s project directory using the project cookiecutter template.
Parameters
cookie_jar: str | Path | None = None- Output directory for the generated project. Defaults to self.cookie_jar.
bake_the_repo()
Create a new repository using the repository cookiecutter template.
Usage
bake_the_repo(cookie_jar=None)This function creates a new repository. If a repository name is given to the class, then it is given a name. If not, cookiecutter takes input from the user.
The base class will be the only class that allows cookiecutters parameter no_input to be False.
Parameters
cookie_jar: str | Path | None = None- Output directory for the generated repository. Defaults to self.cookie_jar.
bake_the_research()
Create a directory for a new research project.
Usage
bake_the_research(research_type, research, cookie_jar=None)Creates a new research directory using the research cookiecutter template.
Parameters
research_type: str-
Type of research (e.g., ‘comparative_genetics’).
research: str-
Name of the research project.
cookie_jar: str | Path | None = None- Output directory for the generated research directory. Defaults to self.cookie_jar.
bake_the_user()
Create a new directory system for the active user.
Usage
bake_the_user(cookie_jar=None)This function uses the username given by our FLASK framework and creates a new directory system for the active user using our new_user cookiecutter template.
Parameters
cookie_jar: str | Path | None = None- Output directory for the generated user directory. Defaults to self.cookie_jar.
bake_the_website()
Create a website using the new_website cookie.
Usage
bake_the_website(host, port, website_path, cookie_jar=None)After creating the directory structure, the run_script function from cookiecutter finds the hooks folder which contains a post-cookiecutter-template-generation bash script. The bash script sets up the proper dependencies and environment variables for the website, and runs the website on the specified host and port.
Parameters
host: str-
Host address for the website server.
port: str | int-
Port number for the website server.
website_path: str | Path-
Path where the website should be created.
cookie_jar: str | Path | None = None- Output directory for the generated website. Defaults to self.cookie_jar.