aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask
diff options
context:
space:
mode:
authorMarkus Reiter2017-03-13 01:01:17 +0100
committerMarkus Reiter2017-03-16 12:10:19 +0100
commitd7af864be0e64c830a4c9944980bece19a60872d (patch)
tree0b6e359fc99ba26767847c743f0ea4215239fb97 /Library/Homebrew/cask
parentd1995dad4bf76b447d9c97f1c2db99c6b3854b51 (diff)
downloadbrew-d7af864be0e64c830a4c9944980bece19a60872d.tar.bz2
Replace `Hbc.path` with `CaskLoader.path`.
Diffstat (limited to 'Library/Homebrew/cask')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/cat.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/create.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/edit.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/style.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/locations.rb27
5 files changed, 4 insertions, 31 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cat.rb b/Library/Homebrew/cask/lib/hbc/cli/cat.rb
index 464e23a5e..52f6e0eab 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/cat.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/cat.rb
@@ -6,7 +6,7 @@ module Hbc
raise CaskUnspecifiedError if cask_tokens.empty?
# only respects the first argument
cask_token = cask_tokens.first.sub(/\.rb$/i, "")
- cask_path = Hbc.path(cask_token)
+ cask_path = CaskLoader.path(cask_token)
raise CaskUnavailableError, cask_token.to_s unless cask_path.exist?
puts File.open(cask_path, &:read)
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/create.rb b/Library/Homebrew/cask/lib/hbc/cli/create.rb
index 3e2b9c191..5e143d085 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/create.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/create.rb
@@ -5,7 +5,7 @@ module Hbc
cask_tokens = cask_tokens_from(args)
raise CaskUnspecifiedError if cask_tokens.empty?
cask_token = cask_tokens.first.sub(/\.rb$/i, "")
- cask_path = Hbc.path(cask_token)
+ cask_path = CaskLoader.path(cask_token)
odebug "Creating Cask #{cask_token}"
raise CaskAlreadyCreatedError, cask_token if cask_path.exist?
diff --git a/Library/Homebrew/cask/lib/hbc/cli/edit.rb b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
index a6cb9e209..1f1e0d918 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/edit.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -6,7 +6,7 @@ module Hbc
raise CaskUnspecifiedError if cask_tokens.empty?
# only respects the first argument
cask_token = cask_tokens.first.sub(/\.rb$/i, "")
- cask_path = Hbc.path(cask_token)
+ cask_path = CaskLoader.path(cask_token)
odebug "Opening editor for Cask #{cask_token}"
unless cask_path.exist?
raise CaskUnavailableError, %Q(#{cask_token}, run "brew cask create #{cask_token}" to create a new Cask)
diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb
index f38d785fc..191aefd3c 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/style.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb
@@ -39,7 +39,7 @@ module Hbc
elsif cask_tokens.any? { |file| File.exist?(file) }
cask_tokens
else
- cask_tokens.map { |token| Hbc.path(token) }
+ cask_tokens.map { |token| CaskLoader.path(token) }
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index c15cec32b..e55bdf15d 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -109,33 +109,6 @@ module Hbc
@default_tap ||= Tap.fetch("caskroom", "homebrew-cask")
end
- def path(query)
- query_path = Pathname.new(query)
-
- return query_path if query_path.absolute?
- return query_path if query_path.exist? && query_path.extname == ".rb"
-
- query_without_extension = query.sub(/\.rb$/i, "")
-
- token_with_tap = if query =~ %r{\A[^/]+/[^/]+/[^/]+\Z}
- query_without_extension
- else
- all_tokens.detect do |tap_and_token|
- tap_and_token.split("/")[2] == query_without_extension
- end
- end
-
- if token_with_tap
- user, repo, token = token_with_tap.split("/", 3)
- tap = Tap.fetch(user, repo)
- else
- token = query_without_extension
- tap = Hbc.default_tap
- end
-
- CaskLoader.default_path(token)
- end
-
def tcc_db
@tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
end