Browse Source

Out of the Cellar, into the Caskroom

Install casks into HOMEBREW_PREFIX/"Caskroom" instead of the Cellar.
This prevents us from colliding with normal Homebrew Formulae.

NOTE: this will be a breaking change, with the following effects:

- all installed casks will no longer be reported as installed
- orphans all existing casks in the Cellar
- no automated facility for cleanup or migration of existing casks

refs #38, where we can discuss the implications of this before cutting a
new release
phinze 12 years ago
parent
commit
9189bd5be6
  1. 7
      lib/cask.rb
  2. 4
      lib/cask/cli.rb
  3. 4
      test/cask/installer_test.rb

7
lib/cask.rb

@ -18,8 +18,8 @@ class Cask
HOMEBREW_PREFIX.join "Library", "Taps"
end
def self.cellarpath
HOMEBREW_CELLAR
def self.caskroom
HOMEBREW_PREFIX.join "Caskroom"
end
def self.appdir
@ -32,6 +32,7 @@ class Cask
def self.init
HOMEBREW_CACHE.mkpath unless HOMEBREW_CACHE.exist?
caskroom.mkpath unless caskroom.exist?
appdir.mkpath unless appdir.exist?
end
@ -57,7 +58,7 @@ class Cask
end
def destination_path
HOMEBREW_CELLAR.join(self.title).join(self.version)
self.class.caskroom.join(self.title).join(self.version)
end
def installed?

4
lib/cask/cli.rb

@ -78,6 +78,10 @@ class Cask::CLI
puts Cask::CLI.commands.map {|c| " - #{c.downcase}: #{_help_for(c)}"}.join("\n")
end
def help
''
end
def _help_for(command)
Cask::CLI.lookup_command(command).help
end

4
test/cask/installer_test.rb

@ -9,7 +9,7 @@ describe Cask::Installer do
Cask::Installer.install(caffeine)
end
dest_path = HOMEBREW_CELLAR/'local-caffeine'/caffeine.version
dest_path = Cask.caskroom/'local-caffeine'/caffeine.version
dest_path.must_be :directory?
application = dest_path/'Caffeine.app'
application.must_be :directory?
@ -22,7 +22,7 @@ describe Cask::Installer do
Cask::Installer.install(transmission)
end
dest_path = HOMEBREW_CELLAR/'local-transmission'/transmission.version
dest_path = Cask.caskroom/'local-transmission'/transmission.version
dest_path.must_be :directory?
application = dest_path/'Transmission.app'
application.must_be :directory?

Loading…
Cancel
Save