aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli
diff options
context:
space:
mode:
authorMarkus Reiter2016-08-25 05:19:14 +0200
committerMarkus Reiter2016-09-05 21:43:03 +0200
commit89a63fb1778dbfd4140a774c32dededf5b2a4585 (patch)
treeab388940a1833598d79696ba98a6e5bb74c0a5f0 /Library/Homebrew/cask/lib/hbc/cli
parent7820489831b049a2fc6fd4ef0c5964e63e78f778 (diff)
downloadbrew-89a63fb1778dbfd4140a774c32dededf5b2a4585.tar.bz2
Add `cask_files` method to `Tap` class.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/doctor.rb12
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/search.rb2
2 files changed, 5 insertions, 9 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index 857471420..2632bcaef 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -33,18 +33,14 @@ class Hbc::CLI::Doctor < Hbc::CLI::Base
end
def self.alt_taps
- Tap.select { |t| t.cask_dir.directory? && t != Hbc.default_tap }
+ Tap.select { |t| t.cask_dir && t != Hbc.default_tap }
.map(&:path)
end
def self.default_cask_count
- default_cask_count = notfound_string
- begin
- default_cask_count = Hbc.default_tap.cask_dir.children.count(&:file?)
- rescue StandardError
- default_cask_count = "0 #{error_string "Error reading #{Hbc.default_tap.path}"}"
- end
- default_cask_count
+ Hbc.default_tap.cask_files.count
+ rescue StandardError
+ "0 #{error_string "Error reading #{Hbc.default_tap.path}"}"
end
def self.homebrew_origin
diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb
index c356128a6..2149a524b 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/search.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb
@@ -21,7 +21,7 @@ class Hbc::CLI::Search < Hbc::CLI::Base
partial_matches = Hbc::CLI.nice_listing(Hbc.all_tokens).grep(%r{#{search_regexp}}i)
else
# suppressing search of the font Tap is a quick hack until behavior can be made configurable
- all_tokens = Hbc::CLI.nice_listing Hbc.all_tokens.reject { |t| %r{^caskroom/homebrew-fonts/}.match(t) }
+ all_tokens = Hbc::CLI.nice_listing Hbc.all_tokens.reject { |t| %r{^caskroom/fonts/}.match(t) }
simplified_tokens = all_tokens.map { |t| t.sub(%r{^.*\/}, "").gsub(%r{[^a-z0-9]+}i, "") }
simplified_search_term = search_term.sub(%r{\.rb$}i, "").gsub(%r{[^a-z0-9]+}i, "")
exact_match = simplified_tokens.grep(%r{^#{simplified_search_term}$}i) { |t| all_tokens[simplified_tokens.index(t)] }.first