Remove Hbc.init.

This commit is contained in:
Markus Reiter 2018-06-09 11:18:40 +02:00
parent b2f67c6d77
commit 488149242b
11 changed files with 4 additions and 39 deletions

View File

@ -25,9 +25,3 @@ require "hbc/url"
require "hbc/utils" require "hbc/utils"
require "hbc/verify" require "hbc/verify"
require "hbc/version" require "hbc/version"
module Hbc
def self.init
Caskroom.ensure_caskroom_exists
end
end

View File

@ -21,6 +21,8 @@ module Hbc
end end
def casks def casks
return [] unless path.exist?
Pathname.glob(path.join("*")).sort.select(&:directory?).map do |path| Pathname.glob(path.join("*")).sort.select(&:directory?).map do |path|
token = path.basename.to_s token = path.basename.to_s

View File

@ -88,10 +88,6 @@ module Hbc
@lookup.fetch(command_name, command_name) @lookup.fetch(command_name, command_name)
end end
def self.should_init?(command)
command.is_a?(Class) && !command.abstract? && command.needs_init?
end
def self.run_command(command, *args) def self.run_command(command, *args)
if command.respond_to?(:run) if command.respond_to?(:run)
# usual case: built-in command verb # usual case: built-in command verb
@ -164,7 +160,6 @@ module Hbc
MacOS.full_version = ENV["MACOS_VERSION"] unless ENV["MACOS_VERSION"].nil? MacOS.full_version = ENV["MACOS_VERSION"] unless ENV["MACOS_VERSION"].nil?
Tap.default_cask_tap.install unless Tap.default_cask_tap.installed? Tap.default_cask_tap.install unless Tap.default_cask_tap.installed?
Hbc.init if self.class.should_init?(command)
self.class.run_command(command, *args) self.class.run_command(command, *args)
rescue CaskError, ArgumentError, OptionParser::InvalidOption => e rescue CaskError, ArgumentError, OptionParser::InvalidOption => e
msg = e.message msg = e.message

View File

@ -27,10 +27,6 @@ module Hbc
nil nil
end end
def self.needs_init?
false
end
def self.run(*args) def self.run(*args)
new(*args).run new(*args).run
end end

View File

@ -20,10 +20,6 @@ module Hbc
odebug "Auditing Cask #{cask}" odebug "Auditing Cask #{cask}"
Auditor.audit(cask, audit_download: download?, check_token_conflicts: token_conflicts?) Auditor.audit(cask, audit_download: download?, check_token_conflicts: token_conflicts?)
end end
def self.needs_init?
true
end
end end
end end
end end

View File

@ -27,10 +27,6 @@ module Hbc
def self.help def self.help
"installs the given Cask" "installs the given Cask"
end end
def self.needs_init?
true
end
end end
end end
end end

View File

@ -49,10 +49,6 @@ module Hbc
def self.help def self.help
"prints or calculates a given Cask's or URL's appcast checkpoint" "prints or calculates a given Cask's or URL's appcast checkpoint"
end end
def self.needs_init?
true
end
end end
end end
end end

View File

@ -5,10 +5,6 @@ module Hbc
option "--cleanup", :cleanup, false option "--cleanup", :cleanup, false
def self.needs_init?
true
end
attr_accessor :commit_range attr_accessor :commit_range
private :commit_range= private :commit_range=

View File

@ -57,10 +57,6 @@ module Hbc
def self.help def self.help
"with no args, lists installed Casks; given installed Casks, lists staged files" "with no args, lists installed Casks; given installed Casks, lists staged files"
end end
def self.needs_init?
true
end
end end
end end
end end

View File

@ -82,10 +82,6 @@ module Hbc
def self.help def self.help
"upgrades all outdated casks" "upgrades all outdated casks"
end end
def self.needs_init?
true
end
end end
end end
end end

View File

@ -55,6 +55,8 @@ module Hbc
def stage def stage
odebug "Hbc::Installer#stage" odebug "Hbc::Installer#stage"
Caskroom.ensure_caskroom_exists
extract_primary_container extract_primary_container
save_caskfile save_caskfile
rescue StandardError => e rescue StandardError => e