aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-20 19:08:03 +0200
committerMarkus Reiter2017-05-22 02:51:17 +0200
commitacc7309ca34a28d340583bad619e236b6bc78e52 (patch)
tree0ce790698b6b9770c1afc8c8811fa81e5a686f31 /Library/Homebrew
parent811f4c5f237dad654c3eba81dfa96b7e9f29c10f (diff)
downloadbrew-acc7309ca34a28d340583bad619e236b6bc78e52.tar.bz2
Rename `Base` and `InternalUseBase`.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli.rb9
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/--version.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb (renamed from Library/Homebrew/cask/lib/hbc/cli/base.rb)10
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/abstract_internal_command.rb (renamed from Library/Homebrew/cask/lib/hbc/cli/internal_use_base.rb)2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/audit.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/cat.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/cleanup.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/create.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/doctor.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/edit.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/fetch.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/home.rb6
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/info.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/install.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_help.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/list.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/outdated.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/search.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/style.rb6
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/uninstall.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/zap.rb2
-rw-r--r--Library/Homebrew/compat/hbc/cli/update.rb4
27 files changed, 40 insertions, 39 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb
index d0c4f30df..3f6af2c34 100644
--- a/Library/Homebrew/cask/lib/hbc/cli.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli.rb
@@ -3,7 +3,7 @@ require "shellwords"
require "extend/optparse"
-require "hbc/cli/base"
+require "hbc/cli/abstract_command"
require "hbc/cli/audit"
require "hbc/cli/cat"
require "hbc/cli/cleanup"
@@ -23,7 +23,7 @@ require "hbc/cli/uninstall"
require "hbc/cli/--version"
require "hbc/cli/zap"
-require "hbc/cli/internal_use_base"
+require "hbc/cli/abstract_internal_command"
require "hbc/cli/internal_audit_modified_casks"
require "hbc/cli/internal_appcast_checkpoint"
require "hbc/cli/internal_checkurl"
@@ -90,7 +90,8 @@ module Hbc
def self.command_classes
@command_classes ||= constants.map(&method(:const_get))
- .select { |sym| sym.respond_to?(:run) }
+ .select { |klass| klass.respond_to?(:run) }
+ .reject(&:abstract?)
.sort_by(&:command_name)
end
@@ -105,7 +106,7 @@ module Hbc
end
def self.should_init?(command)
- (command.is_a? Class) && (command < CLI::Base) && command.needs_init?
+ command.is_a?(Class) && !command.abstract? && command.needs_init?
end
def self.run_command(command, *rest)
diff --git a/Library/Homebrew/cask/lib/hbc/cli/--version.rb b/Library/Homebrew/cask/lib/hbc/cli/--version.rb
index 253772ebe..23ecde0cc 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/--version.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/--version.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Version < Base
+ class Version < AbstractCommand
def self.command_name
"--#{super}"
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/base.rb b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
index 1ad347de3..0f9f05f94 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/base.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
@@ -1,10 +1,14 @@
module Hbc
class CLI
- class Base
+ class AbstractCommand
def self.command_name
@command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
end
+ def self.abstract?
+ !(name.split("::").last !~ /^Abstract[^a-z]/)
+ end
+
def self.visible
true
end
@@ -21,6 +25,10 @@ module Hbc
false
end
+ def self.run(*args)
+ new(*args).run
+ end
+
def initialize(*args)
@args = args
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_use_base.rb b/Library/Homebrew/cask/lib/hbc/cli/abstract_internal_command.rb
index b1f9c5631..8af71e589 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_use_base.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/abstract_internal_command.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalUseBase < Base
+ class AbstractInternalCommand < AbstractCommand
def self.command_name
super.sub(/^internal_/i, "_")
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/audit.rb b/Library/Homebrew/cask/lib/hbc/cli/audit.rb
index 5da2be4cf..06cccb6ac 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/audit.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/audit.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Audit < Base
+ class Audit < AbstractCommand
def self.help
"verifies installability of Casks"
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cat.rb b/Library/Homebrew/cask/lib/hbc/cli/cat.rb
index 774b96e89..ca7225926 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/cat.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/cat.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Cat < Base
+ class Cat < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
index a62b8d069..c605fea7c 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Cleanup < Base
+ class Cleanup < AbstractCommand
OUTDATED_DAYS = 10
OUTDATED_TIMESTAMP = Time.now - (60 * 60 * 24 * OUTDATED_DAYS)
diff --git a/Library/Homebrew/cask/lib/hbc/cli/create.rb b/Library/Homebrew/cask/lib/hbc/cli/create.rb
index 39b9bcda7..09de66649 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/create.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/create.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Create < Base
+ class Create < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index 11917ae6b..9a3dfcad4 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Doctor < Base
+ class Doctor < AbstractCommand
def self.run
ohai "Homebrew-Cask Version", Hbc.full_version
ohai "Homebrew-Cask Install Location", render_install_location
diff --git a/Library/Homebrew/cask/lib/hbc/cli/edit.rb b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
index 52b089a8b..f1797de1c 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/edit.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/edit.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Edit < Base
+ class Edit < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/fetch.rb b/Library/Homebrew/cask/lib/hbc/cli/fetch.rb
index f7139ff63..0d1a91e85 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/fetch.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/fetch.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Fetch < Base
+ class Fetch < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/home.rb b/Library/Homebrew/cask/lib/hbc/cli/home.rb
index 882cb67af..15cbbfc8d 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/home.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/home.rb
@@ -1,10 +1,6 @@
module Hbc
class CLI
- class Home < Base
- def self.run(*args)
- new(*args).run
- end
-
+ class Home < AbstractCommand
def run
casks = @args.map(&CaskLoader.public_method(:load))
diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb
index 327290eea..6813ad63f 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/info.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Info < Base
+ class Info < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb
index 53c510774..cec4d0f2b 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/install.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Install < Base
+ class Install < AbstractCommand
def self.run(*args)
new(*args).run
end
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 89eecd8db..e3045d289 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalAppcastCheckpoint < InternalUseBase
+ class InternalAppcastCheckpoint < AbstractInternalCommand
def self.run(*args)
new(*args).run
end
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 371e19570..5bf73135a 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
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalAuditModifiedCasks < InternalUseBase
+ class InternalAuditModifiedCasks < AbstractInternalCommand
RELEVANT_STANZAS = [:version, :sha256, :url, :appcast].freeze
def self.needs_init?
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb
index 3cd7add29..06487597e 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_checkurl.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalCheckurl < InternalUseBase
+ class InternalCheckurl < AbstractInternalCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
index e6dc3510f..2202a737c 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalDump < InternalUseBase
+ class InternalDump < AbstractInternalCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
index 3903f3b08..3645d9138 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_help.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalHelp < InternalUseBase
+ class InternalHelp < AbstractInternalCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
index a60a08d66..82cf981fd 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class InternalStanza < InternalUseBase
+ class InternalStanza < AbstractInternalCommand
# Syntax
#
# brew cask _stanza <stanza_name> [ --table | --yaml | --inspect | --quiet ] [ <cask_token> ... ]
diff --git a/Library/Homebrew/cask/lib/hbc/cli/list.rb b/Library/Homebrew/cask/lib/hbc/cli/list.rb
index f79dc9a54..884203254 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/list.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/list.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class List < Base
+ class List < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
index 8eb387df2..7a5485344 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Outdated < Base
+ class Outdated < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb
index 108053854..3ad1dd4da 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/search.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Search < Base
+ class Search < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb
index a76c893fc..992e1bb13 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/style.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb
@@ -2,15 +2,11 @@ require "English"
module Hbc
class CLI
- class Style < Base
+ class Style < AbstractCommand
def self.help
"checks Cask style using RuboCop"
end
- def self.run(*args)
- new(*args).run
- end
-
attr_reader :args
def initialize(*args)
@cask_tokens = self.class.cask_tokens_from(args)
diff --git a/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb b/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
index 213c5beb6..dea6a8e5f 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Uninstall < Base
+ class Uninstall < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/zap.rb b/Library/Homebrew/cask/lib/hbc/cli/zap.rb
index 26dab1548..df40894af 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/zap.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/zap.rb
@@ -1,6 +1,6 @@
module Hbc
class CLI
- class Zap < Base
+ class Zap < AbstractCommand
def self.run(*args)
new(*args).run
end
diff --git a/Library/Homebrew/compat/hbc/cli/update.rb b/Library/Homebrew/compat/hbc/cli/update.rb
index 7820997cb..95321e898 100644
--- a/Library/Homebrew/compat/hbc/cli/update.rb
+++ b/Library/Homebrew/compat/hbc/cli/update.rb
@@ -1,8 +1,8 @@
-require "cask/lib/hbc/cli/base"
+require "cask/lib/hbc/cli/abstract_command"
module Hbc
class CLI
- class Update < Base
+ class Update < AbstractCommand
def self.run(*_ignored)
odeprecated "`brew cask update`", "`brew update`", disable_on: Time.utc(2017, 7, 1)
result = SystemCommand.run(HOMEBREW_BREW_FILE, args: ["update"],