diff options
| author | Markus Reiter | 2017-03-13 01:09:36 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-16 19:16:42 +0100 |
| commit | ed10135da4fbabca2798afe949b6f5af9544ec9f (patch) | |
| tree | fc9991edb93017eaab5fe4b26f781a45ad909b77 /Library/Homebrew/cask | |
| parent | d7af864be0e64c830a4c9944980bece19a60872d (diff) | |
| download | brew-ed10135da4fbabca2798afe949b6f5af9544ec9f.tar.bz2 | |
Replace `Hbc.load` with `CaskLoader.load`.
Diffstat (limited to 'Library/Homebrew/cask')
19 files changed, 22 insertions, 26 deletions
diff --git a/Library/Homebrew/cask/lib/hbc.rb b/Library/Homebrew/cask/lib/hbc.rb index 4f22a643d..5b94a1b55 100644 --- a/Library/Homebrew/cask/lib/hbc.rb +++ b/Library/Homebrew/cask/lib/hbc.rb @@ -42,8 +42,4 @@ module Hbc Cache.ensure_cache_exists Caskroom.ensure_caskroom_exists end - - def self.load(ref) - CaskLoader.load(ref) - end end diff --git a/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb b/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb index fe5d1b743..8bba5df8e 100644 --- a/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb +++ b/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb @@ -15,7 +15,7 @@ module Hbc walk = lambda do |acc, deps| deps.each do |dep| next if acc.key?(dep) - succs = deps_in.call Hbc.load(dep) + succs = deps_in.call CaskLoader.load(dep) acc[dep] = succs walk.call(acc, succs) end diff --git a/Library/Homebrew/cask/lib/hbc/cli/audit.rb b/Library/Homebrew/cask/lib/hbc/cli/audit.rb index a06f71c60..ec1c33754 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/audit.rb @@ -40,7 +40,7 @@ module Hbc if cask_tokens.empty? Hbc.all else - cask_tokens.map { |token| Hbc.load(token) } + cask_tokens.map { |token| CaskLoader.load(token) } end end diff --git a/Library/Homebrew/cask/lib/hbc/cli/fetch.rb b/Library/Homebrew/cask/lib/hbc/cli/fetch.rb index fc928586f..83dba672c 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/fetch.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/fetch.rb @@ -8,7 +8,7 @@ module Hbc cask_tokens.each do |cask_token| ohai "Downloading external files for Cask #{cask_token}" - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) downloaded_path = Download.new(cask, force: force).perform Verify.all(cask, downloaded_path) ohai "Success! Downloaded to -> #{downloaded_path}" diff --git a/Library/Homebrew/cask/lib/hbc/cli/home.rb b/Library/Homebrew/cask/lib/hbc/cli/home.rb index 4734bfebb..66be49186 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/home.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/home.rb @@ -8,7 +8,7 @@ module Hbc else cask_tokens.each do |cask_token| odebug "Opening homepage for Cask #{cask_token}" - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) system "/usr/bin/open", "--", cask.homepage end end diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb index 8701166af..625b4ecae 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/info.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb @@ -6,7 +6,7 @@ module Hbc raise CaskUnspecifiedError if cask_tokens.empty? cask_tokens.each do |cask_token| odebug "Getting info for Cask #{cask_token}" - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) info(cask) end diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb index 3f4c94b6b..438f860c1 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/install.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb @@ -18,7 +18,7 @@ module Hbc count = 0 cask_tokens.each do |cask_token| begin - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) Installer.new(cask, force: force, skip_cask_deps: skip_cask_deps, diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb index 790e917b2..da3567108 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb @@ -24,7 +24,7 @@ module Hbc count = 0 cask_tokens.each do |cask_token| - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) if cask.appcast.nil? opoo "Cask '#{cask}' is missing an `appcast` stanza." diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb index 60df4bc8c..9467cccc7 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb @@ -84,7 +84,7 @@ module Hbc def modified_casks return @modified_casks if defined? @modified_casks - @modified_casks = modified_cask_files.map { |f| Hbc.load(f) } + @modified_casks = modified_cask_files.map { |f| CaskLoader.load(f) } if @modified_casks.any? num_modified = @modified_casks.size ohai "#{Formatter.pluralize(num_modified, "modified cask")}: " \ diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb index 77cf250b1..b7d95957d 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb @@ -2,7 +2,7 @@ module Hbc class CLI class InternalCheckurl < InternalUseBase def self.run(*args) - casks_to_check = args.empty? ? Hbc.all : args.map { |arg| Hbc.load(arg) } + casks_to_check = args.empty? ? Hbc.all : args.map { |arg| CaskLoader.load(arg) } casks_to_check.each do |cask| odebug "Checking URL for Cask #{cask}" checker = UrlChecker.new(cask) diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb index 36a1ca74b..8017a32cf 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb @@ -16,7 +16,7 @@ module Hbc count = 0 cask_tokens.each do |cask_token| begin - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) count += 1 cask.dumpcask rescue StandardError => e diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb index c54db8795..303aa7ffe 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb @@ -84,7 +84,7 @@ module Hbc print "#{cask_token}\t" if table begin - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) rescue StandardError opoo "Cask '#{cask_token}' was not found" unless quiet puts "" diff --git a/Library/Homebrew/cask/lib/hbc/cli/list.rb b/Library/Homebrew/cask/lib/hbc/cli/list.rb index 51ca5dabe..d9bf2187b 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/list.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/list.rb @@ -28,7 +28,7 @@ module Hbc cask_tokens.each do |cask_token| odebug "Listing files for Cask #{cask_token}" begin - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) if cask.installed? if @options[:one] diff --git a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb index d608beab5..5956f59ac 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb @@ -9,7 +9,7 @@ module Hbc casks_to_check = if cask_tokens.empty? Hbc.installed else - cask_tokens.map { |token| Hbc.load(token) } + cask_tokens.map { |token| CaskLoader.load(token) } end casks_to_check.each do |cask| diff --git a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb index c101c9235..b52c43328 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb @@ -5,7 +5,7 @@ module Hbc count = 0 cask_tokens.each do |cask_token| begin - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) installer = Installer.new(cask, force: force, diff --git a/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb b/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb index d74b59d4c..6887aaf4f 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb @@ -8,7 +8,7 @@ module Hbc cask_tokens.each do |cask_token| odebug "Uninstalling Cask #{cask_token}" - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) raise CaskNotInstalledError, cask unless cask.installed? || force diff --git a/Library/Homebrew/cask/lib/hbc/cli/zap.rb b/Library/Homebrew/cask/lib/hbc/cli/zap.rb index 2f9723858..83da1c932 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/zap.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/zap.rb @@ -6,7 +6,7 @@ module Hbc raise CaskUnspecifiedError if cask_tokens.empty? cask_tokens.each do |cask_token| odebug "Zapping Cask #{cask_token}" - cask = Hbc.load(cask_token) + cask = CaskLoader.load(cask_token) Installer.new(cask).zap end end diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 94d270946..824c1b1be 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -229,7 +229,7 @@ module Hbc deps = CaskDependencies.new(@cask) deps.sorted.each do |dep_token| puts "#{dep_token} ..." - dep = Hbc.load(dep_token) + dep = CaskLoader.load(dep_token) if dep.installed? puts "already installed" else diff --git a/Library/Homebrew/cask/lib/hbc/scopes.rb b/Library/Homebrew/cask/lib/hbc/scopes.rb index fb2675735..db12409e5 100644 --- a/Library/Homebrew/cask/lib/hbc/scopes.rb +++ b/Library/Homebrew/cask/lib/hbc/scopes.rb @@ -23,10 +23,10 @@ module Hbc end def installed - # Hbc.load has some DWIM which is slow. Optimize here - # by spoon-feeding Hbc.load fully-qualified paths. + # CaskLoader.load has some DWIM which is slow. Optimize here + # by spoon-feeding CaskLoader.load fully-qualified paths. # TODO: speed up Hbc::Source::Tapped (main perf drag is calling Hbc.all_tokens repeatedly) - # TODO: ability to specify expected source when calling Hbc.load (minor perf benefit) + # TODO: ability to specify expected source when calling CaskLoader.load (minor perf benefit) Pathname.glob(caskroom.join("*")) .map do |caskroom_path| token = caskroom_path.basename.to_s @@ -36,9 +36,9 @@ module Hbc end if path_to_cask - Hbc.load(path_to_cask.join("#{token}.rb")) + CaskLoader.load(path_to_cask.join("#{token}.rb")) else - Hbc.load(token) + CaskLoader.load(token) end end end |
