msanders / cider

Hassle-free bootstrapping with Homebrew.
https://pypi.python.org/pypi/cider/
MIT License
839 stars 25 forks source link

Allow to set environment variables in json files #16

Closed kaikuehne closed 10 years ago

kaikuehne commented 10 years ago

Hi! I'd like to install all my casks into /Applications, so it would be cool if there was a way to set the HOMEBREW_CASK_OPTS environment variable directly in cider. Can you add a section to the bootstrap.json file (maybe "env") that one can use to set various environment variables?

I would normally put that into my .bashrc but that file is not there when I restore the first time. So, something like:

"env": { "HOMEBREW_CASK_OPTS": "--appdir=/Applications", }

What do you think? Thanks.

msanders commented 10 years ago

Great idea, I'll look into adding it. As a workaround for now you should be able to add a before-script that does exports these variables for you before restoring.

kaikuehne commented 10 years ago

Hi, thanks for the suggestion. I tested this, but I think this does not work. If I create a shell script and call it using the before-script mechanic, the variable will only be exported in the context of the shell script and is not globally available, so it's not in the same scope of the brew-call. Sourcing the file might work, I will test it tomorrow.

msanders commented 10 years ago

Looks like you're right, sorry about that. Here's a workaround that should do the trick:

alias cider="HOMEBREW_CASK_OPTS=\"--appdir=/Applications\" cider"

This should definitely be supported though. Thanks for pointing it out.

msanders commented 10 years ago

Thanks again for the suggestion! Should be available in the next release, or now if you want to try it out on master: pip install https://github.com/msanders/cider/archive/master.zip.

kaikuehne commented 10 years ago

Thank you very much for your work.