facio.template

class facio.template.Template(origin)[source]
COPY_ATTEMPT = 1
COPY_ATTEMPT_LIMIT = 5
copy(callback=None)[source]

Copy template from origin path to state.get_project_root().

Parameters:callback (function – default None) – A callback function to be called after copy is complete
Returns:bool
error(message)

Print error that does not result in an exit (Red)

Parameters:message (str) – Message to print to user
gather(message)

Common message prompting for gathering input form the end user.

Parameters:message (str) – Message to print to user
get_copy_ignore_globs()[source]

Returns ignore globs list at time of call.

Returns:list
get_render_ignore_files(files)[source]

Returns a list of files to ignore for rendering based on get_render_ignore_globs patterns.

Parameters:files (list) – List of files to check against
Returns:list – list of filenames
get_render_ignore_globs()[source]

Returns ignore globs list at time of call.

Returns:list
out(message, color=<function blue at 0x7f9c287a5848>)

Print message information to user (Blue)

Parameters:message (str) – Message to print to user

** Optional Key Word Arguments **

Parameters:color – Clint color function to use
Type:function – default blue
rename()[source]

Runs the two rename files and rename directories methods.

rename_direcories()[source]

Renames directories that are named after context variables, for example: {{PROJECT_NAME}}.

Returns:generator
rename_files()[source]

Rename files that are named after context variables, for example: {{PROJECT_NAME}}.py

Returns:generator
render()[source]

Reads the template and uses Jinja 2 to replace context variables with their real values.

success(message)

Print a success message (Green)

Parameters:message (str) – Message to print to user
update_copy_ignore_globs(globs)[source]

Update the ignore glob patterns to include the list provided.

** Usage: **

from facio.template import Template
t = Template('foo', '/path/to/foo')
globs = [
    '*.png',
    '*.gif',
]
t.update_copy_ignore_globs(globs)
Parameters:globs (list) – A list of globs
update_render_ignore_globs(globs)[source]

Update the render ignore glob patterns to include the list provided.

** Usage: **

from facio.template import Template
t = Template('foo', '/path/to/foo')
globs = [
    '*.png',
    '*.gif',
]
t.update_render_ignore_globs(globs)
Parameters:globs (list) – A list of globs
warning(message)

Print a warning message (Yellow)

Parameters:message (str) – Message to print to user

Related Topics

This Page