jingerly¶
- jingerly.__clean(path)¶
Deletes the jingerly specific files, if they exist.
- jingerly.__filter_copy(path)¶
Jinja2 filter that reads the contents of the file at path and returns it.
- jingerly.__filter_download(url)¶
Jinja2 filter that downloads the file at url and returns its contents.
- jingerly.__make_env()¶
Creates a jinja2.Environment and prepares it to be used by jingerly. We use a jinja2.DebugUndefined undefined object so that when template variables are not provided they are left alone. This means we
can use jingerly to template projects that use Jinja2
- jingerly.__make_renderer(env, variables)¶
Returns a function that takes some text and creates and renders a template from it using env and variables
- jingerly.__make_variables(template_dir, output_dir, kwargs)¶
Returns a dictionary of the variables that will be passed into the template. Combines template_dir and output_dir with kwargs as ‘IN’ and ‘OUT’ repectively. Then processes output_dir/jingerly.env (if it exists).
- jingerly.__process_dirs(root, dirs, renderer)¶
Changes any directory name in dirs that needs changing (rendering).
- jingerly.__process_files(root, files, renderer)¶
Pass the contents of each file in files to renderer, changes the file name if needed.
- jingerly.__run_post(output_dir, renderer)¶
Runs the jingerly.post script
- jingerly.__run_pre(output_dir, renderer)¶
Runs the jingerly.pre script
- jingerly.__run_script(script_path, renderer)¶
Renders the script at script_path then calls it
- jingerly.__walk(root, ignore)¶
Replicates os.walk() but filters out any files or folders whose name is found in ignore.
- jingerly.find_variables(template_dir, _ignore=None)¶
jingerly.__walk() through every file and directory in template_dir returning a list of all of the variables. This is used for the interactive feature of the CLI.
- jingerly.render(template_dir, output_dir, _ignore=None, **kwargs)¶
jingerly.__walk() through every file and directory in template_dir, render it using variable values in kwargs, and save the output in output_dir. The order things happen in is:
- Copy entire template to output directory
- Read variables from jingerly.env
- Run jingerly.pre
- Walk through output_dir processings files and directories
- Run jingerly.post
- Clean up any jingerly specific files