journal_manager.cli.commands.build module

class journal_manager.cli.commands.build.BuildHttpServer(**kwargs)[source]

Bases: BuildStep

Sets up the http server that will serve the journals.

The http server structure is composed of:
  1. An http server written in node.js + express

  2. A file monitor script using entr

  3. A file monitor action to rebuild journals that are updated

The http server and the file monitor run independently. Whenever a markdown file is modified, the file monitor triggers the file monitor action scripts that rebuilds only the journal affected. The http server will automatically reflect the changes.

build(**kwargs)[source]
class journal_manager.cli.commands.build.BuildIndexPage(**kwargs)[source]

Bases: BuildStep

Build the index page with links to all rendered journals.

assets = PosixPath('/home/runner/work/journal-manager/journal-manager/.tox/docs/lib/python3.8/site-packages/danoan/journal_manager/assets/templates/material-index/assets')
build(**kwargs)[source]
class journal_manager.cli.commands.build.BuildJournals(build_instructions: BuildInstructions, **kwargs)[source]

Bases: BuildStep

Build html static pages from journals using mkdocs

Parameters:

build_instructions (BuildInstructions) –

build(**kwargs)[source]
class journal_manager.cli.commands.build.BuildStep(**kwargs)[source]

Bases: object

Base class for a build step in the process of building a journal.

This class defined the interface and also the basic implementations of the methods that made the BuildStep interface.

The design of the journal build process expects build steps to be called in a chain. For example:

MyFirstBuildStep(some_parameters) .build() .next(MySecondBuildStep(another_parameters))

The parameters passed to a build step persist in following steps. If a parameter of same name had been set before, it will be overwritten.

build(**kwargs)[source]
next(build_step_class)[source]
class journal_manager.cli.commands.build.FailedStep(build_step: BuildStep, msg: str)[source]

Bases: BuildStep

BuildStep to be returned whenever an error is detected.

Parameters:
build(**kwargs)[source]
next(build_step)[source]
journal_manager.cli.commands.build.build(build_instructions: BuildInstructions)[source]

Build html static pages from journals.

Parameters:

build_instructions (BuildInstructions) –

journal_manager.cli.commands.build.get_journals_names_to_build(build_instructions: BuildInstructions) List[str][source]

Read the build instructions and collect the journal names to build.

There are four ways to build journals:
  1. Giving a list of journal names;

  2. Giving a list of journal locations;

  3. Giving a directory that contains journal folders and build all of them;

  4. Saying nothing and then all registered journals are built.

This function reads the build instructions and extracts the journals names accordingly with the chosen method.

Parameters:

build_instructions (BuildInstructions) – A BuildInstructions object.

Returns:

A list of journal names to build.

Raises:
  • InvalidName if invalid journal names are given.

  • InvalidLocation if invalid journal locations are given.

  • InvalidIncludeAllFolder if invalid include_all_folder location

  • is given.

Return type:

List[str]

journal_manager.cli.commands.build.get_parser(subparser_action=None)[source]