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

Force magic to reload the file .tea.yaml on git hook post-checkout #20

Open
4brunu opened this issue Jul 31, 2023 · 6 comments
Open

Force magic to reload the file .tea.yaml on git hook post-checkout #20

4brunu opened this issue Jul 31, 2023 · 6 comments

Comments

@4brunu
Copy link

4brunu commented Jul 31, 2023

Hi,

I want to force magic to reload the .tea.yaml on the git hook post-checkout, to ensure the I'm using the correct version of each tool mentioned in the .tea.yaml.

Doing cd . in the terminal works, but not on the Makefile, nor on a script file.

Is there any way to force maging to reload the .tea.yaml?

Thanks

@mxcl
Copy link
Member

mxcl commented Jul 31, 2023

source <(tea -E) or equivalent for your shell, I think the best way with bash is eval "$(tea -E)"

@mxcl
Copy link
Member

mxcl commented Jul 31, 2023

nice trick too, we should document this.

oh actually the magic actually executes: source <(tea +tea.xyz/magic -Esk --chaste env) if you want to be completely correct. This adds the TEA_REWIND env to ensure the env can be undone.

-k for keep going so it doesn't fail in directories that have no env, --chaste to prevent it downloading packages, -s for silent.

I'm in the process of standardzing this weird-ass command to something more normal.

@4brunu
Copy link
Author

4brunu commented Jul 31, 2023

Hi, thanks for the quick answer.
I'm using zsh on macOS.

source <(tea +tea.xyz/magic -Esk --chaste env) works on the terminal, but fails on the Makefile with the following error:

source <(tea +tea.xyz/magic -Esk --chaste env)
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `source <(tea +tea.xyz/magic -Esk --chaste env)'

source <(tea -E) has the same error on the Makefile.

eval "$(tea -E)" has no effect on the Makefile.

@4brunu
Copy link
Author

4brunu commented Aug 1, 2023

I also tried to run eval "$(tea +tea.xyz/magic -Esk --chaste env)" or bash -c "source <(tea +tea.xyz/magic -Esk --chaste env)" from the Makefile, to it has no effect.

@mxcl
Copy link
Member

mxcl commented Sep 11, 2023

/bin/sh is bash v3 on macOS which cannot handle that syntax. You can use eval "$(tea stuff)" instead.

v1 has changed things, dev will work in the terminal, but not in a Makefile. This should be fixed, and we will do so. In the meantime for a Makefile you can use tea as a runner eg. tea [email protected]. Not ideal in that you have to repeat version info, but it'll work for now.

edit: apologies for the late response, I've been preparing tea 1.0 release for weeks!

@4brunu
Copy link
Author

4brunu commented Sep 11, 2023

Hey, thanks for the response and for the work on tea 1.0.

Can we keep this issue open, while tea/magic doesn't support this use case in the Makefile?

@mxcl mxcl transferred this issue from pkgxdev/pkgx Jan 15, 2025
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

2 participants