+
Skip to content

Split up unify info multiple packages #36

@llakala

Description

@llakala

Mainly writing this to actually figure out what I want to do, and how fine-grainly I want to split up the package.

First, reasoning - unify is the longest script by far, and it's become harder to maintain as a result of this. I'd like it to become a bit more modular.

Before this, we must first understand what Unify does, to figure out how to split up its concerns.

At its core, Unify runs nix flake update and rbld. That's it. Everything else is a wrapper around that functionality.

So, what wraps that? Well:

What does Unify do?

  1. First, Unify switches branches for you to a main/master branch, based on the value of -b or UNIFY_PRIMARY_BRANCHES. It will swap back after execution, no matter how Unify exits.
  2. Then, Unify runs nix flake update, and checks whether you care about any of the inputs that updated. If you did care about any of them, Unify continues running. If they didn't, Unify reverts the flake.lock changes, and exits early.
  3. If you got this far, unify runs a rebuild, exiting early if the rebuild fails.
  4. Unify commits the changes and pushes them.

I like almost all of these. EXCEPT for the second one. fuiska didn't exist when I first came up with unify. I truly think fuiska is a better way of solving the problem that unify solves with the automated solution. BUT, I don't want to rip out the automated functionality just because I found a new toy. Ideally, it should be optional. But, perhaps more importantly, Unify should be maintainable.

Here's a basic proposal on splitting Unify in two. Or three, I guess.

The wrapper and the implementation

The implementation is step 2. I want this to be swappable. You could choose an implementation that always updates when you run Unify - that's what I personally want. Or, you could choose the existing implementation, where it checks your important inputs. This makes it a simple if/else, for which command gets run. Unify becomes a little lighter. It's not MUCH - this will still leave Unify as a pretty long file. But, I want to START with this.

Okay, time to go implement it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载