Skip to content

Commit

Permalink
move Caskroom into opt for spotlight goodness
Browse files Browse the repository at this point in the history
  • Loading branch information
phinze committed Apr 7, 2013
1 parent 1585d52 commit d92ca8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def self.tapspath
end

def self.caskroom
HOMEBREW_PREFIX.join "Caskroom"
@@caskroom ||= Pathname('/opt/homebrew-cask/Caskroom')
end

def self.caskroom=(caskroom)
@@caskroom = caskroom
end

def self.appdir
Expand All @@ -39,7 +43,13 @@ def self.default_tap=(_tap)

def self.init
HOMEBREW_CACHE.mkpath unless HOMEBREW_CACHE.exist?
caskroom.mkpath unless caskroom.exist?
unless caskroom.exist?
ohai "We need to make Caskroom for the first time at #{caskroom}"
ohai "We'll set permissions properly so this is the only time homebrew-cask will ever need sudo"
current_user = ENV['USER']
system "sudo mkdir -p #{caskroom}"
system "sudo chown #{current_user}:staff #{caskroom.parent}"
end
appdir.mkpath unless appdir.exist?
end

Expand Down
3 changes: 3 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
# look for casks in testcasks by default
Cask.default_tap = 'phinze-testcasks'

# our own testy caskroom
Cask.caskroom = HOMEBREW_PREFIX.join('TestCaskroom')

# silence some extraneous UI messages for tests
ENV['QUIET_TESTS'] = '1'

Expand Down

0 comments on commit d92ca8f

Please sign in to comment.