Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paq 2.0 #157

Merged
merged 32 commits into from
Oct 20, 2023
Merged

Paq 2.0 #157

merged 32 commits into from
Oct 20, 2023

Conversation

saccarosium
Copy link
Collaborator

@saccarosium saccarosium commented Oct 7, 2023

BREAKING CHANGES:

  • The run option is deprecated. Use build instead.
  • Similarly, the PaqRunHook is deprecated in favor of PaqBuild.
  • The paq/register function was removed.

I think we are ready to ship paq 2.0. We need to made some small modifications but I think we are there.

I have some questions regarding the documentation. If we are gonna annotate the source with emmylua comment, what documentation generator we'll going to use? mini.doc or lemmy-help?

When I've tried do documentation with emmylua comments, I found myself unwrapping a lot of the code since parsers didn't play nicely with things such as metatables. Also is worth noting that most of the documentation, found in the paq-nvim.txt, doesn't really belong anywhere in the codebase. Leading to having pretty big wall of comments at the begin and end of the file and nothing in the middle.


saccarosium and others added 28 commits August 25, 2023 13:14
Instead of having of having a separate key to evaluate if the directory
is installed or not I've made the following changes to status enum:
- INSTALLED: equivalent to the old exists key
- LISTED: a package is in the paq list but it isn't yet been installed
- CLONED: equivalent to what installed used to mean, a package was
  recently cloned (aka installed) on the machine.

Also to simplify the filtering of packaging based on the status I've
made a new table called 'filters' that help filter packages both in
'vim.tbl_filter' and regular if statements.
Instead of saving the state on the function 'exe_op' I save the state on
every individual function that alter the state. I find this to be more
reliable.
Public API:
- Rename `run` option to `build`.
- Rename `PaqRunHook` command to `PaqBuild`.

Paq will print a deprecation notice if the old names are used.
The reason for renaming these is explained in #143.

Internals:
- Refactor build related functions to ensure builds are executed after
  all packages have been installed/updated and loaded:
  - If the hook is a function, it might require a module inside a
    recently installed package.
  - If a is package is installed successfully and the build fails,
    it's better to notify that in two separate messages, instead of
    notifying the install failed.

- Rename `run_hook` to `run_build`, and refactor to make it clear
  there's 3 possible cases: function, ex command, shell commmand.

- Refactor `new_counter` to take a callback (passed in `exe_op`).
- Refactor `report` and `counter` to have (almost) the same signature.
- Refactor the weird logic used to handle `PaqSync` messages.
Since sync needs a reference to self, it must be called with the ':'.
This makes it impossible to reference it in a table.
When a branch or a remote is changed, Paq will remove the old plugin and
reinstall the new one with the appropriate changes. I've opted for this
solution because there are too many variables when dealing with git, so
easiest solution is just to reinstall the plugin.
Now we have a clear distinction between the `Lock` and `Diff` table.
Now they both have their own set of functions to deal specifically with
them. For example all function that mutates `Lock` are prefixed with
`lock_*`.
Now the file is categorize in 'sections' by using 'foldmethod=marker'.
@savq
Copy link
Owner

savq commented Oct 9, 2023

Also is worth noting that most of the documentation, found in the paq-nvim.txt, doesn't really belong anywhere in the codebase.

Yeah, fortunately the public API is rather small. I'd really like for Paq to be one file, but not even vim-plug embeds the docs. I don't think this is blocking, and I'll move the doc ideas out of the tracking issue.

@saccarosium
Copy link
Collaborator Author

Hi @savq,
I've tried to add some emmylua comments to make the codebase a little more readable and approciable looking for your feedback. After that I will merge and do the release.

@saccarosium saccarosium marked this pull request as ready for review October 19, 2023 13:19
@saccarosium
Copy link
Collaborator Author

Pretty happy with the result. I think we are ready to ship it.

Copy link
Owner

@savq savq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finished checking all the changes.

I think there's only a tiny change needed, otherwise we're good to go!

lua/paq.lua Show resolved Hide resolved
@savq savq merged commit 07eb567 into master Oct 20, 2023
@savq
Copy link
Owner

savq commented Oct 20, 2023

Thank you @saccarosium for all the work you've done.

I don't think there's any more breaking changes or big changes to make, so we can continue working on smaller stuff in separate PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants