-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update environment.lua #6
Conversation
Adds the possibility to change $PREFIX from os ENV
Thanks for taking the time to propose a PR! You rock :-) Hopefully you can proceed without the need for this given my response in #5. But to expand on that a bit, I don't think I'm the only one who has been bitten by programs that take arguments out of the environment that misbehave when they react to something I set for some other unrelated task weeks ago and forgot to remove from the environment when I changed tasks. Or by something that I had working for months break after staringt a fresh terminal because I lost some environment setting it was quietly depending on to work correctly. I much prefer the approach that |
…e: PREFIX="--local" ./build-aux/luke lukefile install all
Hello @gvvaughan See my proposal, it fetches luarocks config and give a way to switch to local; |
I worry about letting the environment PREFIX value deeply affect the operation of Or alternatively, since the output of $ prefix=$(lua -e "$(luarocks config)" -e 'for k, v in next,rocks_trees do if v.name == "user" then print(v.root) end end')
$ echo $prefix
/Users/gvv/.luarocks
$ build-aux/luke PREFIX=${PREFIX-"$prefix"} all install If you do this often, and don't want to type in all that code every time, you could put in your own wrapper script: $ cat ~/bin/luke
#! /bin/sh
case $1 in
--local) shift; name=user ;;
--global) shift; name=system ;;
esac
test -z "$name" || {
prefix=$(lua -e "$(luarocks config)" -e "for k, v in next,rocks_trees do if v.name == '$name' then print(v.root) end end")
set -- PREFIX=${PREFIX-"$prefix"} ${1+"$@"}
}
exec build-aux/luke ${1+"$@"}
$ ~/bin/luke --local all install |
Aside: In case you find it interesting, here's my subprocess handler: https://github.com/gvvaughan/specl/blob/master/lib/specl/shell.lua#L111-L134 |
Seems we reached the same approach for launching a process, nice shot with you shell script which is easier to read. Thanks a lot for your advices and comments. |
Adds the possibility to change $PREFIX from os ENV.
This responds to the doc $PREFIX and my need described in #5