Skip to content

Commit

Permalink
fixed for Homebrew 1.0.0
Browse files Browse the repository at this point in the history
fixed get cask list for the first migration
added brew_prefix for homebrew 1.0.0
  • Loading branch information
rcmdnk committed Sep 28, 2016
1 parent f922607 commit a3f47dc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ before_install:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ];then openssl aes-256-cbc -K $encrypted_63171a4b9582_key -iv $encrypted_63171a4b9582_iv -in .travis_rsa.tar.enc -out .travis_rsa.tar -d; tar xvf .travis_rsa.tar; cp .travis_rsa_$PYTHON_VERSION ~/.ssh/id_rsa; chmod 600 ~/.ssh/id_rsa; echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config; fi'
- version=""
- 'if [ $TRAVIS_BRANCH = master ];then version="--HEAD";elif [ $TRAVIS_BRANCH = bash ];then version="--bash";fi'
- sw_vers
- brew --version
- brew update
- brew --version
install:
- testaccount=rcmdnk
- testreponame=BrewfileTest_$PYTHON_VERSION
- testrepo=$testaccount/$testreponame
- testrepodir=${testaccount}_${testreponame}
- testrepofulldir=$HOME/.brewfile/$testrepodir
- testfile=$testrepofulldir/Brewfile
- sw_vers
- brew list > brewlist.orig
- brew install rcmdnk/file/brew-file $version
- brew tap homebrew/dupes # needed, as current travis environment is old and has some packages which are now under dupes, but travis environment doesn't have dupes tap.
Expand Down Expand Up @@ -96,6 +98,7 @@ script:
- mkdir -p $(dirname "$brewfile")
- touch "$brewfile"
- coverage run --parallel-mode $exe init -y
- echo $(brew --repository)
- coverage run --parallel-mode $exe update -y -V 2 # better to use verbose mode, because the update takes so long time that travis will end up with no output error if no output is written out at update...
- coverage run --parallel-mode $exe test -V 2
- coverage run --parallel-mode $exe install --no_appstore --preupdate -y -V 2
Expand All @@ -105,9 +108,9 @@ script:
- coverage run --parallel-mode $exe brew help
- coverage run --parallel-mode $exe brew noinit list
- coverage run --parallel-mode $exe brew info bash
- coverage run --parallel-mode $exe brew install wget --HEAD --with-iri
# - coverage run --parallel-mode $exe brew install wget --HEAD --with-iri
- coverage run --parallel-mode $exe init -y -V 0
- coverage run --parallel-mode $exe brew uninstall wget
# - coverage run --parallel-mode $exe brew uninstall wget
- coverage run --parallel-mode $exe brew tap rcmdnk/mytest
- coverage run --parallel-mode $exe brew tap rcmdnk/mytest
- coverage run --parallel-mode $exe brew install mytest2
Expand Down Expand Up @@ -190,7 +193,7 @@ script:
- coverage run --parallel-mode $exe init -y -V 0
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ];then coverage run --parallel-mode $exe update -y -U -V 2; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ];then coverage run --parallel-mode $exe update -y; fi'
- coverage run --parallel-mode $exe brew rm wget
# - coverage run --parallel-mode $exe brew rm wget
- command brew cask install google-chrome
- coverage run --parallel-mode $exe casklist -V 2
- cp Brewfile $testfile
Expand Down
2 changes: 1 addition & 1 deletion BrewfileExt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
before echo EXT before

# brew install with opt
brew wget --HEAD --with-iri --with-debug
#brew wget --HEAD --with-iri --with-debug
brew install tig --with-docs

## After commands
Expand Down
1 change: 1 addition & 0 deletions BrewfileTest
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ echo other commands

# After commands
after echo after

20 changes: 13 additions & 7 deletions bin/brew-file
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ __author__ = "rcmdnk"
__copyright__ = "Copyright (c) 2013 rcmdnk"
__credits__ = ["rcmdnk"]
__license__ = "MIT"
__version__ = "v3.16.3"
__date__ = "05/Sep/2016"
__version__ = "v4.0.0"
__date__ = "28/Sep/2016"
__maintainer__ = "rcmdnk"
__email__ = "rcmdnk@gmail.com"
__status__ = "Prototype"
Expand Down Expand Up @@ -716,6 +716,9 @@ class BrewFile:
self.opt["brew_repo"] =\
self.proc(
"brew --repository", False, False, True, 0)[1][0]
self.opt["brew_prefix"] =\
self.proc(
"brew --prefix", False, False, True, 0)[1][0]
self.opt["input"] = os.environ.get("HOMEBREW_BREWFILE",
os.environ["HOME"] +
"/.brewfile/Brewfile")
Expand Down Expand Up @@ -773,11 +776,11 @@ class BrewFile:
if cask_opts["--caskroom"] != "":
self.opt["caskroom"] = cask_opts["--caskroom"]
else:
if not os.path.isdir(self.opt["brew_repo"] + "/Caskroom") and\
if not os.path.isdir(self.opt["brew_prefix"] + "/Caskroom") and\
os.path.isdir("/opt/homebrew-cask/Caskroom"):
self.opt["caskroom"] = "/opt/homebrew-cask/Caskroom"
else:
self.opt["caskroom"] = self.opt["brew_repo"] + "/Caskroom"
self.opt["caskroom"] = self.opt["brew_prefix"] + "/Caskroom"
self.opt["appdir"] = cask_opts["--appdir"].rstrip("/") \
if cask_opts["--appdir"] != ""\
else os.environ["HOME"]+"/Applications"
Expand Down Expand Up @@ -1545,9 +1548,12 @@ class BrewFile:
return (False, [])
(ret, lines) = self.proc("brew cask list", False, False,
separate_err_msg=True)
if len(lines) > 0 and lines[0].find("Warning: nothing to list") != -1:
lines = []
return (True, lines)
packages = []
for l in lines:
if "Warning: nothing to list" in l or "=>" in l or "->" in l:
continue
packages.append(l)
return (True, packages)

def get_list(self):
"""Get List"""
Expand Down

0 comments on commit a3f47dc

Please sign in to comment.