NoTeX 1.0.0
A modern noteworthy LaTeX template
Loading...
Searching...
No Matches
notex::Installer Class Reference

Deploys the NoTeX LaTeX template and fonts onto the system. More...

#include <notex/installer.hpp>

Static Public Member Functions

static bool install_global (const Environment &environment, bool force=false)
 Installs the template globally, using environment to resolve the target directories inside the TeX tree.
static bool install_local (const std::filesystem::path &target_dir, bool force=false)
 Installs the template locally into target_dir.
static bool uninstall_global (const Environment &environment, bool force=false)
 Removes a global installation: every embedded LaTeX and font file's target directory inside environment's TeX tree, then refreshes the TeX filename database (a failure there is downgraded to a warning, as in install_global()). Never touches anything outside those directories.
static bool uninstall_local (const std::filesystem::path &target_dir, bool force=false)
 Removes a local installation: target_dir's settings/ and fonts/ directories, then clears installation_type in .notex/notex.json if present. Never touches the project's own documents.
static bool installation_differs (const std::filesystem::path &latex_dir, const std::filesystem::path &fonts_dir)
 Reports whether an installation at latex_dir/fonts_dir differs from what would be freshly installed.

Detailed Description

Deploys the NoTeX LaTeX template and fonts onto the system.

Every method is static: an installation is really about its target directory, not about any state an Installer instance would hold between calls, so instances of this class serve no purpose.

Definition at line 22 of file installer.hpp.

Member Function Documentation

◆ install_global()

bool notex::Installer::install_global ( const Environment & environment,
bool force = false )
static

Installs the template globally, using environment to resolve the target directories inside the TeX tree.

Writes every embedded LaTeX and font file into the TeX tree, creating intermediate directories as needed, and refreshes the TeX filename database afterwards; a failure to do so is downgraded to a warning rather than propagated, since some environments lack mktexlsr. If a previous installation already exists there and differs from what would be written, the user is asked to confirm before overwriting, unless force is set.

Parameters
environmentResolved TeX environment to install into.
forceSkip the confirmation prompt when overwriting a differing installation.
Returns
True if the installation was performed; false if the user declined the confirmation prompt.

Definition at line 91 of file installer.cpp.

References notex::assets::font_files(), notex::Environment::global_fonts_dir(), notex::Environment::global_latex_dir(), notex::assets::latex_files(), notex::system::run_command(), notex::Environment::texmf_home(), and notex::ui::warning().

◆ install_local()

bool notex::Installer::install_local ( const std::filesystem::path & target_dir,
bool force = false )
static

Installs the template locally into target_dir.

Writes every embedded LaTeX file into <target_dir>/settings/ and every font into <target_dir>/fonts/, then records the local installation in <target_dir>/.notex/notex.json, creating that directory (with an otherwise-empty configuration) if target_dir is not already a NoTeX project, and preserving its existing configuration if it is.

Parameters
target_dirDirectory to install into.
forceSkip the confirmation prompt when overwriting a differing installation.
Returns
True if the installation was performed; false if the user declined the confirmation prompt.

Definition at line 117 of file installer.cpp.

References notex::Manager::config(), notex::assets::font_files(), notex::ProjectConfig::installation_type, notex::assets::latex_files(), and notex::Manager::write_config().

◆ installation_differs()

bool notex::Installer::installation_differs ( const std::filesystem::path & latex_dir,
const std::filesystem::path & fonts_dir )
static

Reports whether an installation at latex_dir/fonts_dir differs from what would be freshly installed.

Used by checkhealth to note installation drift (e.g. a hand-customised local install) without needing to actually reinstall anything.

Parameters
latex_dirDirectory to compare the embedded LaTeX files against.
fonts_dirDirectory to compare the embedded font files against.
Returns
True if any embedded file is missing from, or differs from, its counterpart in latex_dir or fonts_dir.

Definition at line 200 of file installer.cpp.

References notex::assets::font_files(), and notex::assets::latex_files().

◆ uninstall_global()

bool notex::Installer::uninstall_global ( const Environment & environment,
bool force = false )
static

Removes a global installation: every embedded LaTeX and font file's target directory inside environment's TeX tree, then refreshes the TeX filename database (a failure there is downgraded to a warning, as in install_global()). Never touches anything outside those directories.

Parameters
environmentResolved TeX environment to uninstall from.
forceSkip the confirmation prompt.
Returns
True if the uninstall was performed; false if the user declined the confirmation prompt.

Definition at line 144 of file installer.cpp.

References notex::ui::confirm(), notex::Environment::global_fonts_dir(), notex::Environment::global_latex_dir(), notex::system::run_command(), notex::Environment::texmf_home(), and notex::ui::warning().

◆ uninstall_local()

bool notex::Installer::uninstall_local ( const std::filesystem::path & target_dir,
bool force = false )
static

Removes a local installation: target_dir's settings/ and fonts/ directories, then clears installation_type in .notex/notex.json if present. Never touches the project's own documents.

Parameters
target_dirDirectory to uninstall from.
forceSkip the confirmation prompt.
Returns
True if the uninstall was performed; false if the user declined the confirmation prompt.

Definition at line 174 of file installer.cpp.

References notex::Manager::config(), notex::ui::confirm(), notex::ProjectConfig::installation_type, notex::Manager::save(), and notex::ui::warning().


The documentation for this class was generated from the following files: