Skip to content

Commit

Permalink
Merge pull request #7 from yuuki-arc/set-cask-directory
Browse files Browse the repository at this point in the history
modify the default installation locations of Cask packages
  • Loading branch information
rcmdnk committed Oct 15, 2014
2 parents c24ea69 + 8e12be1 commit d0fdfeb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -83,6 +83,12 @@ in your setup file (e.g. .bashrc), like:

export HOMEBREW_BREWFILE=~/.brewfile

You can also modify the default installation locations of Cask packages.
To make this settings, it is the same as issuing [How to Use Homebrew-cask#Options](https://github.com/caskroom/homebrew-cask/blob/master/USAGE.md#options).
you might want to add the following line to your .bash_profile or .zshenv:

export HOMEBREW_CASK_OPTS="--caskroom=/etc/Caskroom"

If there is no Brewfile, Brew-file ask you if you want to initialize Brewfile
with installed packages.
You can also make it with `-i` option.
Expand Down
10 changes: 9 additions & 1 deletion bin/brew-file
Expand Up @@ -51,6 +51,12 @@ class BrewFile:

def __init__(self):
"""initialization."""
import re
cask_opts = {"--caskroom" : ""}
env_cask_opts = os.environ.get("HOMEBREW_CASK_OPTS", "")
if env_cask_opts != "":
cask_opts = dict(map(lambda x: x.split("="),
re.split(r'(?<!\\)\s*', env_cask_opts)))

self.opt = {}

Expand All @@ -66,7 +72,9 @@ class BrewFile:
self.opt["initialized"] = False
self.opt["tap_dir"] = self.opt["brew_repo"] + "/Library/Taps"
self.opt["cache_dir"] = self.proc("brew --cache", False, False)[1][0]
self.opt["caskroom"] = "/opt/homebrew-cask/Caskroom"
self.opt["caskroom"] = cask_opts["--caskroom"] \
if cask_opts["--caskroom"] != "" \
else "/opt/homebrew-cask/Caskroom"
self.opt["cask_pack"] = "brew-cask"
self.opt["cask_repo"] = "caskroom/cask"
self.opt["pip_pack"] = "brew-pip"
Expand Down

0 comments on commit d0fdfeb

Please sign in to comment.