diff --git a/CHANGELOG.md b/CHANGELOG.md index 86fd41f..bfbade7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,6 @@ All notable changes to WuttJamaican will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## v0.28.4 (2026-01-03) - -### Fix - -- refactor InstallHandler slightly, for easier customization - ## v0.28.3 (2026-01-03) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 7fc6e5f..be897e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "WuttJamaican" -version = "0.28.4" +version = "0.28.3" description = "Base package for Wutta Framework" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}] diff --git a/src/wuttjamaican/install.py b/src/wuttjamaican/install.py index 6627b81..44ee3ac 100644 --- a/src/wuttjamaican/install.py +++ b/src/wuttjamaican/install.py @@ -161,17 +161,6 @@ class InstallHandler(GenericHandler): any problem is found the installer should exit with code 2. This is normally called by :meth:`run()`. - - The default logic here just calls :meth:`check_appdir()`. - """ - self.check_appdir() - - def check_appdir(self): - """ - Check if the :term:`app dir` already exists; exit with code 2 - if so. - - This is normally called from :meth:`sanity_check()`. """ # appdir must not yet exist appdir = os.path.join(sys.prefix, "app") @@ -351,48 +340,19 @@ class InstallHandler(GenericHandler): File templates for this come from ``wuttjamaican:templates/install`` by default. - - This method calls - :meth:`~wuttjamaican.app.AppHandler.make_appdir()` for the - basic structure and then :meth:`write_all_config_files()` for - the gory details. """ # app handler makes appdir proper appdir = appdir or self.app.get_appdir() self.app.make_appdir(appdir) # but then we also generate some files... - self.write_all_config_files(appdir, context) - self.rprint(f"\n\tappdir created at: [bold green]{appdir}[/bold green]") - - def write_all_config_files(self, appdir, context): - """ - This method should write all config files within the app dir. - It's called from :meth:`make_appdir()`. - - Subclass can override this for specialized installers. - - Note that the app dir may or may not be newly-created, when - this method is called. Some installers may support a - "refresh" of the existing app dir. - - Default logic (over)writes 3 files: - - * ``wutta.conf`` - * ``web.cof`` - * ``upgrade.sh`` - """ - self.write_wutta_conf(appdir, context) - self.write_web_conf(appdir, context) - self.write_upgrade_sh(appdir, context) - - def write_wutta_conf(self, appdir, context): + # wutta.conf self.make_config_file( "wutta.conf.mako", os.path.join(appdir, "wutta.conf"), **context ) - def write_web_conf(self, appdir, context): + # web.conf web_context = dict(context) web_context.setdefault("beaker_key", context.get("pkg_name", "poser")) web_context.setdefault("beaker_secret", "TODO_YOU_SHOULD_CHANGE_THIS") @@ -402,7 +362,7 @@ class InstallHandler(GenericHandler): "web.conf.mako", os.path.join(appdir, "web.conf"), **web_context ) - def write_upgrade_sh(self, appdir, context): + # upgrade.sh template = self.templates.get_template("upgrade.sh.mako") output_path = os.path.join(appdir, "upgrade.sh") self.render_mako_template(template, context, output_path=output_path) @@ -411,6 +371,8 @@ class InstallHandler(GenericHandler): stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH, ) + self.rprint(f"\n\tappdir created at: [bold green]{appdir}[/bold green]") + def render_mako_template( self, template,