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

Feature Request: Post install action #13

Open
Integralist opened this issue Jul 3, 2017 · 9 comments
Open

Feature Request: Post install action #13

Integralist opened this issue Jul 3, 2017 · 9 comments

Comments

@Integralist
Copy link

Heya,

So I'm noticing a lot of plugins using this sort of 'post-install' action:

https://github.com/junegunn/vim-plug#example

One such example being:

https://github.com/roxma/nvim-cm-tern

Is this something you think might be useful to include, or does it push the 'minimalism' focus of voom a bit too much.

Just asking as I could look to open a PR at some point if you thought it would be interesting to include

@airblade
Copy link
Owner

airblade commented Jul 3, 2017

Sounds like a slippery slope ;)

I don't use any plugins requiring a post-install step but if I did I'd probably want voom to support that. We would need to figure out:

  • The syntax for the manifest
  • Update the manifest's syntax highlighting
  • Modify the code to detect and execute a post-install step
  • Decide a policy for what to do if the post-install step fails

@Integralist
Copy link
Author

OK, cool. I'll have a think about it and put some further comments here when I do.

@Rycieos
Copy link
Contributor

Rycieos commented Jul 3, 2017

I have a feature for the same problem in my voom inspired profile-manager, if I can give my input.

An example config:

dot-files() {
  repo_url="https://github.com/Rycieos/dot-files.git"
  files=(
    ["profile-manager/config"]="~/.config/profile-manager/config"
  )
  dot-files_post_update() {
    example command
  }
}

I have both a post_update hook and a post_install hook, which run after their respective actions.

For voom, this would be much trickier, since right now the config only has plugin names specified. I would think that the config format would have to change completely to make it work.

@eNV25
Copy link
Contributor

eNV25 commented Oct 21, 2022

Maybe this could be done with git hooks? https://git-scm.com/docs/githooks

@eNV25
Copy link
Contributor

eNV25 commented Oct 21, 2022

Example:

example/plugin post-merge:"make" post-merge:"echo Finished building plugin"

Would generate:

#!/bin/sh
# ~/.vim/pack/voom/start/plugin/.git/hooks/post-merge
make
echo Finished building plugin

@airblade
Copy link
Owner

@eNV25 Presumably that would mean creating a directory for the plugin before cloning, writing the hook files, then cloning – instead of just cloning. It feels a little too fiddly to me. I like your example syntax though.

How about something like:

example/plugin post-install:"..." post-update:"..."

Or using = instead of :.

@Integralist @Rycieos Would that work for you?

@Integralist
Copy link
Author

Oh hey 👋 I see I opened this 5 years ago. I'm afraid I've moved on since then. So best not to wait on my input. Thanks ♥️

@Rycieos
Copy link
Contributor

Rycieos commented Oct 22, 2022

Looks good to me.

@eNV25
Copy link
Contributor

eNV25 commented Oct 22, 2022

@eNV25 Presumably that would mean creating a directory for the plugin before cloning, writing the hook files, then cloning – instead of just cloning. It feels a little too fiddly to me. I like your example syntax though.

I didn't think about that at first. Anyway, it seems git has the perfect option --template for this.

tmpdir="$(mktemp -d)"
mkdir -p "$tmpdir/hooks/"
echo ... > "$tmpdir/hooks/pre-merge"
git clone https://git.example.com/repo.git repo --template="$tmpdir" # or
GIT_TEMPLATE_DIR="$tmpdir" git clone https://git.example.com/repo.git repo
rm -rf "$tmpdir"

How about something like:

example/plugin post-install:"..." post-update:"..."

Or using = instead of :.

That would be fine too. I used the name post-merge above because it's the name of the git hook that needs to be created, but a more intuitive name is probably better.

I would assume post-install is executed once after install (without a hook), and post-update is run every time after git pull. The hook for post-update should probably be updated before first install $ voom, and before update $ voom update.

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

No branches or pull requests

4 participants