Rename Hbc module to Cask.

This commit is contained in:
Markus Reiter 2018-09-06 08:29:14 +02:00
parent 171ea3fe56
commit a84a1c63db
157 changed files with 658 additions and 658 deletions

View File

@ -22,7 +22,7 @@ require "cask/artifact/suite"
require "cask/artifact/uninstall" require "cask/artifact/uninstall"
require "cask/artifact/zap" require "cask/artifact/zap"
module Hbc module Cask
module Artifact module Artifact
end end
end end

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Artifact module Artifact
class AbstractArtifact class AbstractArtifact
include Comparable include Comparable

View File

@ -1,6 +1,6 @@
require "cask/artifact/abstract_artifact" require "cask/artifact/abstract_artifact"
module Hbc module Cask
module Artifact module Artifact
class AbstractFlightBlock < AbstractArtifact class AbstractFlightBlock < AbstractArtifact
def self.dsl_key def self.dsl_key

View File

@ -2,7 +2,7 @@ require "timeout"
require "cask/artifact/abstract_artifact" require "cask/artifact/abstract_artifact"
module Hbc module Cask
module Artifact module Artifact
class AbstractUninstall < AbstractArtifact class AbstractUninstall < AbstractArtifact
ORDERED_DIRECTIVES = [ ORDERED_DIRECTIVES = [
@ -218,7 +218,7 @@ module Hbc
def uninstall_pkgutil(*pkgs, command: nil, **_) def uninstall_pkgutil(*pkgs, command: nil, **_)
ohai "Uninstalling packages:" ohai "Uninstalling packages:"
pkgs.each do |regex| pkgs.each do |regex|
::Hbc::Pkg.all_matching(regex, command).each do |pkg| ::Cask::Pkg.all_matching(regex, command).each do |pkg|
puts pkg.package_id puts pkg.package_id
pkg.uninstall pkg.uninstall
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class App < Moved class App < Moved
end end

View File

@ -3,7 +3,7 @@ require "cask/artifact/moved"
require "extend/hash_validator" require "extend/hash_validator"
using HashValidator using HashValidator
module Hbc module Cask
module Artifact module Artifact
class Artifact < Moved class Artifact < Moved
def self.english_name def self.english_name

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class AudioUnitPlugin < Moved class AudioUnitPlugin < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/symlinked" require "cask/artifact/symlinked"
module Hbc module Cask
module Artifact module Artifact
class Binary < Symlinked class Binary < Symlinked
def link(command: nil, **options) def link(command: nil, **options)

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Colorpicker < Moved class Colorpicker < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Dictionary < Moved class Dictionary < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Font < Moved class Font < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class InputMethod < Moved class InputMethod < Moved
end end

View File

@ -3,7 +3,7 @@ require "cask/artifact/abstract_artifact"
require "extend/hash_validator" require "extend/hash_validator"
using HashValidator using HashValidator
module Hbc module Cask
module Artifact module Artifact
class Installer < AbstractArtifact class Installer < AbstractArtifact
VALID_KEYS = Set.new [ VALID_KEYS = Set.new [

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class InternetPlugin < Moved class InternetPlugin < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/relocated" require "cask/artifact/relocated"
module Hbc module Cask
module Artifact module Artifact
class Moved < Relocated class Moved < Relocated
def self.english_description def self.english_description

View File

@ -5,7 +5,7 @@ require "cask/artifact/abstract_artifact"
require "extend/hash_validator" require "extend/hash_validator"
using HashValidator using HashValidator
module Hbc module Cask
module Artifact module Artifact
class Pkg < AbstractArtifact class Pkg < AbstractArtifact
attr_reader :pkg_relative_path attr_reader :pkg_relative_path

View File

@ -1,6 +1,6 @@
require "cask/artifact/abstract_flight_block" require "cask/artifact/abstract_flight_block"
module Hbc module Cask
module Artifact module Artifact
class PostflightBlock < AbstractFlightBlock class PostflightBlock < AbstractFlightBlock
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/abstract_flight_block" require "cask/artifact/abstract_flight_block"
module Hbc module Cask
module Artifact module Artifact
class PreflightBlock < AbstractFlightBlock class PreflightBlock < AbstractFlightBlock
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Prefpane < Moved class Prefpane < Moved
def self.english_name def self.english_name

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Qlplugin < Moved class Qlplugin < Moved
def self.english_name def self.english_name

View File

@ -3,7 +3,7 @@ require "cask/artifact/abstract_artifact"
require "extend/hash_validator" require "extend/hash_validator"
using HashValidator using HashValidator
module Hbc module Cask
module Artifact module Artifact
class Relocated < AbstractArtifact class Relocated < AbstractArtifact
def self.from_args(cask, *args) def self.from_args(cask, *args)

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class ScreenSaver < Moved class ScreenSaver < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Service < Moved class Service < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/abstract_artifact" require "cask/artifact/abstract_artifact"
module Hbc module Cask
module Artifact module Artifact
class StageOnly < AbstractArtifact class StageOnly < AbstractArtifact
def self.from_args(cask, *args) def self.from_args(cask, *args)

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Suite < Moved class Suite < Moved
def self.english_name def self.english_name

View File

@ -1,6 +1,6 @@
require "cask/artifact/relocated" require "cask/artifact/relocated"
module Hbc module Cask
module Artifact module Artifact
class Symlinked < Relocated class Symlinked < Relocated
def self.link_type_english_name def self.link_type_english_name

View File

@ -1,6 +1,6 @@
require "cask/artifact/abstract_uninstall" require "cask/artifact/abstract_uninstall"
module Hbc module Cask
module Artifact module Artifact
class Uninstall < AbstractUninstall class Uninstall < AbstractUninstall
def uninstall_phase(**options) def uninstall_phase(**options)

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class Vst3Plugin < Moved class Vst3Plugin < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/moved" require "cask/artifact/moved"
module Hbc module Cask
module Artifact module Artifact
class VstPlugin < Moved class VstPlugin < Moved
end end

View File

@ -1,6 +1,6 @@
require "cask/artifact/abstract_uninstall" require "cask/artifact/abstract_uninstall"
module Hbc module Cask
module Artifact module Artifact
class Zap < AbstractUninstall class Zap < AbstractUninstall
def zap_phase(**options) def zap_phase(**options)

View File

@ -3,7 +3,7 @@ require "cask/download"
require "digest" require "digest"
require "utils/git" require "utils/git"
module Hbc module Cask
class Audit class Audit
include Checkable include Checkable

View File

@ -1,6 +1,6 @@
require "cask/download" require "cask/download"
module Hbc module Cask
class Auditor class Auditor
def self.audit(cask, audit_download: false, check_token_conflicts: false, quarantine: true, commit_range: nil) def self.audit(cask, audit_download: false, check_token_conflicts: false, quarantine: true, commit_range: nil)
new(cask, audit_download, check_token_conflicts, quarantine, commit_range).audit new(cask, audit_download, check_token_conflicts, quarantine, commit_range).audit

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Cache module Cache
module_function module_function

View File

@ -4,7 +4,7 @@ require "cask/dsl"
require "cask/metadata" require "cask/metadata"
require "searchable" require "searchable"
module Hbc module Cask
class Cask class Cask
extend Enumerable extend Enumerable
extend Forwardable extend Forwardable

View File

@ -2,7 +2,7 @@ require "delegate"
require "cask/topological_hash" require "cask/topological_hash"
module Hbc module Cask
class CaskDependencies < DelegateClass(Array) class CaskDependencies < DelegateClass(Array)
attr_reader :cask, :graph attr_reader :cask, :graph

View File

@ -1,7 +1,7 @@
require "cask/cask" require "cask/cask"
require "uri" require "uri"
module Hbc module Cask
module CaskLoader module CaskLoader
class FromContentLoader class FromContentLoader
attr_reader :content attr_reader :content

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Caskroom module Caskroom
module_function module_function

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Checkable module Checkable
def errors def errors
@errors ||= [] @errors ||= []

View File

@ -29,7 +29,7 @@ require "cask/cmd/abstract_internal_command"
require "cask/cmd/internal_help" require "cask/cmd/internal_help"
require "cask/cmd/internal_stanza" require "cask/cmd/internal_stanza"
module Hbc module Cask
class Cmd class Cmd
ALIASES = { ALIASES = {
"ls" => "list", "ls" => "list",

View File

@ -1,7 +1,7 @@
require_relative "options" require_relative "options"
require "search" require "search"
module Hbc module Cask
class Cmd class Cmd
class AbstractCommand class AbstractCommand
include Options include Options

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class AbstractInternalCommand < AbstractCommand class AbstractInternalCommand < AbstractCommand
def self.command_name def self.command_name

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Audit < AbstractCommand class Audit < AbstractCommand
option "--download", :download, false option "--download", :download, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Cat < AbstractCommand class Cat < AbstractCommand
def initialize(*) def initialize(*)

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Create < AbstractCommand class Create < AbstractCommand
def initialize(*) def initialize(*)

View File

@ -1,7 +1,7 @@
require "system_config" require "system_config"
require "cask/checkable" require "cask/checkable"
module Hbc module Cask
class Cmd class Cmd
class Doctor < AbstractCommand class Doctor < AbstractCommand
include Checkable include Checkable

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Edit < AbstractCommand class Edit < AbstractCommand
def initialize(*) def initialize(*)

View File

@ -1,6 +1,6 @@
require "cask/download" require "cask/download"
module Hbc module Cask
class Cmd class Cmd
class Fetch < AbstractCommand class Fetch < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Home < AbstractCommand class Home < AbstractCommand
def run def run

View File

@ -1,6 +1,6 @@
require "json" require "json"
module Hbc module Cask
class Cmd class Cmd
class Info < AbstractCommand class Info < AbstractCommand
option "--json=VERSION", :json option "--json=VERSION", :json

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Install < AbstractCommand class Install < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class InternalHelp < AbstractInternalCommand class InternalHelp < AbstractInternalCommand
def initialize(*) def initialize(*)

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class InternalStanza < AbstractInternalCommand class InternalStanza < AbstractInternalCommand
# Syntax # Syntax

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class List < AbstractCommand class List < AbstractCommand
option "-1", :one, false option "-1", :one, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
module Options module Options
def self.included(klass) def self.included(klass)

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Outdated < AbstractCommand class Outdated < AbstractCommand
option "--greedy", :greedy, false option "--greedy", :greedy, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Reinstall < Install class Reinstall < Install
def run def run

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Style < AbstractCommand class Style < AbstractCommand
def self.help def self.help

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Uninstall < AbstractCommand class Uninstall < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Upgrade < AbstractCommand class Upgrade < AbstractCommand
option "--greedy", :greedy, false option "--greedy", :greedy, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Cmd class Cmd
class Zap < AbstractCommand class Zap < AbstractCommand
option "--force", :force, false option "--force", :force, false

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Config class Config
def self.global def self.global
@global ||= new @global ||= new

View File

@ -3,7 +3,7 @@ require "cask/cache"
require "cask/quarantine" require "cask/quarantine"
require "cask/verify" require "cask/verify"
module Hbc module Cask
class Download class Download
attr_reader :cask attr_reader :cask

View File

@ -20,7 +20,7 @@ require "cask/dsl/version"
require "cask/url" require "cask/url"
module Hbc module Cask
class DSL class DSL
ORDINARY_ARTIFACT_CLASSES = [ ORDINARY_ARTIFACT_CLASSES = [
Artifact::Installer, Artifact::Installer,

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
class Appcast class Appcast
attr_reader :uri, :checkpoint, :parameters attr_reader :uri, :checkpoint, :parameters

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
class Base class Base
extend Forwardable extend Forwardable

View File

@ -5,7 +5,7 @@
# ( The return value of the last method in the block is also sent # ( The return value of the last method in the block is also sent
# to the output by the caller, but that feature is only for the # to the output by the caller, but that feature is only for the
# convenience of Cask authors. ) # convenience of Cask authors. )
module Hbc module Cask
class DSL class DSL
class Caveats < Base class Caveats < Base
def initialize(*args) def initialize(*args)

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
class ConflictsWith class ConflictsWith
VALID_KEYS = Set.new [ VALID_KEYS = Set.new [

View File

@ -1,6 +1,6 @@
require "unpack_strategy" require "unpack_strategy"
module Hbc module Cask
class DSL class DSL
class Container class Container
VALID_KEYS = Set.new [ VALID_KEYS = Set.new [

View File

@ -1,6 +1,6 @@
require "rubygems" require "rubygems"
module Hbc module Cask
class DSL class DSL
class DependsOn < DelegateClass(Hash) class DependsOn < DelegateClass(Hash)
VALID_KEYS = Set.new [ VALID_KEYS = Set.new [

View File

@ -1,6 +1,6 @@
require "cask/staged" require "cask/staged"
module Hbc module Cask
class DSL class DSL
class Postflight < Base class Postflight < Base
include Staged include Staged

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
class Preflight < Base class Preflight < Base
include Staged include Staged

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
class UninstallPostflight < Base class UninstallPostflight < Base
end end

View File

@ -1,6 +1,6 @@
require "cask/staged" require "cask/staged"
module Hbc module Cask
class DSL class DSL
class UninstallPreflight < Base class UninstallPreflight < Base
include Staged include Staged

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
class Version < ::String class Version < ::String
DIVIDERS = { DIVIDERS = {

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class CaskError < RuntimeError; end class CaskError < RuntimeError; end
class AbstractCaskErrorWithToken < CaskError class AbstractCaskErrorWithToken < CaskError

View File

@ -11,10 +11,10 @@ require "cask/quarantine"
require "cgi" require "cgi"
module Hbc module Cask
class Installer class Installer
extend Predicable extend Predicable
# TODO: it is unwise for Hbc::Staged to be a module, when we are # TODO: it is unwise for Cask::Staged to be a module, when we are
# dealing with both staged and unstaged Casks here. This should # dealing with both staged and unstaged Casks here. This should
# either be a class which is only sometimes instantiated, or there # either be a class which is only sometimes instantiated, or there
# should be explicit checks on whether staged state is valid in # should be explicit checks on whether staged state is valid in
@ -54,7 +54,7 @@ module Hbc
end end
def fetch def fetch
odebug "Hbc::Installer#fetch" odebug "Cask::Installer#fetch"
satisfy_dependencies satisfy_dependencies
@ -64,7 +64,7 @@ module Hbc
end end
def stage def stage
odebug "Hbc::Installer#stage" odebug "Cask::Installer#stage"
Caskroom.ensure_caskroom_exists Caskroom.ensure_caskroom_exists
@ -78,7 +78,7 @@ module Hbc
end end
def install def install
odebug "Hbc::Installer#install" odebug "Cask::Installer#install"
if @cask.installed? && !force? && !@reinstall && !upgrade? if @cask.installed? && !force? && !@reinstall && !upgrade?
raise CaskAlreadyInstalledError, @cask raise CaskAlreadyInstalledError, @cask
@ -119,7 +119,7 @@ module Hbc
end end
def reinstall def reinstall
odebug "Hbc::Installer#reinstall" odebug "Cask::Installer#reinstall"
@reinstall = true @reinstall = true
install install
end end

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Metadata module Metadata
METADATA_SUBDIR = ".metadata".freeze METADATA_SUBDIR = ".metadata".freeze

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class Pkg class Pkg
def self.all_matching(regexp, command) def self.all_matching(regexp, command)
command.run("/usr/sbin/pkgutil", args: ["--pkgs=#{regexp}"]).stdout.split("\n").map do |package_id| command.run("/usr/sbin/pkgutil", args: ["--pkgs=#{regexp}"]).stdout.split("\n").map do |package_id|

View File

@ -1,5 +1,5 @@
require "development_tools" require "development_tools"
module Hbc module Cask
module Quarantine module Quarantine
module_function module_function

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Staged module Staged
def info_plist_file(index = 0) def info_plist_file(index = 0)
index = 0 if index == :first index = 0 if index == :first

View File

@ -1,7 +1,7 @@
require "tsort" require "tsort"
# a basic topologically sortable hashmap # a basic topologically sortable hashmap
module Hbc module Cask
class TopologicalHash < Hash class TopologicalHash < Hash
include TSort include TSort

View File

@ -4,7 +4,7 @@ require "stringio"
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs".freeze BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs".freeze
module Hbc module Cask
module Utils module Utils
def self.gain_permissions_remove(path, command: SystemCommand) def self.gain_permissions_remove(path, command: SystemCommand)
if path.respond_to?(:rmtree) && path.exist? if path.respond_to?(:rmtree) && path.exist?

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Verify module Verify
module_function module_function

View File

@ -112,8 +112,8 @@ module CleanupRefinement
return false unless name = basename.to_s[/\A(.*?)\-\-/, 1] return false unless name = basename.to_s[/\A(.*?)\-\-/, 1]
cask = begin cask = begin
Hbc::CaskLoader.load(name) Cask::CaskLoader.load(name)
rescue Hbc::CaskUnavailableError rescue Cask::CaskUnavailableError
return false return false
end end
@ -172,8 +172,8 @@ module Homebrew
end end
cask = begin cask = begin
Hbc::CaskLoader.load(arg) Cask::CaskLoader.load(arg)
rescue Hbc::CaskUnavailableError rescue Cask::CaskUnavailableError
nil nil
end end

View File

@ -4,6 +4,6 @@ module Homebrew
module_function module_function
def cask def cask
Hbc::Cmd.run(*ARGV) Cask::Cmd.run(*ARGV)
end end
end end

View File

@ -64,7 +64,7 @@ module Homebrew
if args.remaining.empty? if args.remaining.empty?
if args.casks? if args.casks?
puts Formatter.columns(Hbc::Cask.to_a.map(&:full_name).sort) puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
else else
puts Formatter.columns(Formula.full_names.sort) puts Formatter.columns(Formula.full_names.sort)
end end

View File

@ -6,7 +6,7 @@ require "compat/cask/cache"
require "compat/cask/caskroom" require "compat/cask/caskroom"
require "compat/cask/dsl" require "compat/cask/dsl"
module Hbc module Cask
class << self class << self
module Compat module Compat
def init def init

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Cache module Cache
class << self class << self
module Compat module Compat

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module CaskLoader module CaskLoader
class FromContentLoader; end class FromContentLoader; end

View File

@ -1,4 +1,4 @@
module Hbc module Cask
module Caskroom module Caskroom
class << self class << self
module Compat module Compat

View File

@ -1,7 +1,7 @@
require "cask/cmd/abstract_command" require "cask/cmd/abstract_command"
require "cmd/--version" require "cmd/--version"
module Hbc module Cask
class Cmd class Cmd
class Version < AbstractCommand class Version < AbstractCommand
def self.command_name def self.command_name

View File

@ -3,7 +3,7 @@ require "cleanup"
using CleanupRefinement using CleanupRefinement
module Hbc module Cask
class Cmd class Cmd
class Cleanup < AbstractCommand class Cleanup < AbstractCommand
OUTDATED_DAYS = 10 OUTDATED_DAYS = 10

View File

@ -1,7 +1,7 @@
require "cask/cmd/abstract_command" require "cask/cmd/abstract_command"
require "cmd/search" require "cmd/search"
module Hbc module Cask
class Cmd class Cmd
module Compat module Compat
class Search < AbstractCommand class Search < AbstractCommand

View File

@ -1,4 +1,4 @@
module Hbc module Cask
class DSL class DSL
module Compat module Compat
def gpg(*) def gpg(*)

View File

@ -10,7 +10,7 @@ module Homebrew
puts puts
ohai "Casks" ohai "Casks"
Hbc::Cask.to_a.extend(Searchable) Cask::Cask.to_a.extend(Searchable)
.search(string_or_regex, &:name) .search(string_or_regex, &:name)
.each do |cask| .each do |cask|
puts "#{Tty.bold}#{cask.token}:#{Tty.reset} #{cask.name.join(", ")}" puts "#{Tty.bold}#{cask.token}:#{Tty.reset} #{cask.name.join(", ")}"
@ -20,13 +20,13 @@ module Homebrew
def search_casks(string_or_regex) def search_casks(string_or_regex)
if string_or_regex.is_a?(String) && string_or_regex.match?(HOMEBREW_TAP_CASK_REGEX) if string_or_regex.is_a?(String) && string_or_regex.match?(HOMEBREW_TAP_CASK_REGEX)
return begin return begin
[Hbc::CaskLoader.load(string_or_regex).token] [Cask::CaskLoader.load(string_or_regex).token]
rescue Hbc::CaskUnavailableError rescue Cask::CaskUnavailableError
[] []
end end
end end
results = Hbc::Cask.search(string_or_regex, &:token).sort_by(&:token) results = Cask::Cask.search(string_or_regex, &:token).sort_by(&:token)
results.map do |cask| results.map do |cask|
if cask.installed? if cask.installed?

View File

@ -1,9 +1,9 @@
# TODO: this test should be named after the corresponding class, once # TODO: this test should be named after the corresponding class, once
# that class is abstracted from installer.rb. # that class is abstracted from installer.rb.
describe "Accessibility Access", :cask do describe "Accessibility Access", :cask do
let(:cask) { Hbc::CaskLoader.load(cask_path("with-accessibility-access")) } let(:cask) { Cask::CaskLoader.load(cask_path("with-accessibility-access")) }
let(:fake_system_command) { class_double(SystemCommand) } let(:fake_system_command) { class_double(SystemCommand) }
let(:installer) { Hbc::Installer.new(cask, command: fake_system_command) } let(:installer) { Cask::Installer.new(cask, command: fake_system_command) }
before do before do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new(macos_version)) allow(MacOS).to receive(:version).and_return(MacOS::Version.new(macos_version))

View File

@ -1,6 +1,6 @@
describe Hbc::Artifact::App, :cask do describe Cask::Artifact::App, :cask do
describe "activate to alternate target" do describe "activate to alternate target" do
let(:cask) { Hbc::CaskLoader.load(cask_path("with-alt-target")) } let(:cask) { Cask::CaskLoader.load(cask_path("with-alt-target")) }
let(:install_phase) { let(:install_phase) {
lambda do lambda do
@ -11,7 +11,7 @@ describe Hbc::Artifact::App, :cask do
} }
let(:source_path) { cask.staged_path.join("Caffeine.app") } let(:source_path) { cask.staged_path.join("Caffeine.app") }
let(:target_path) { Hbc::Config.global.appdir.join("AnotherName.app") } let(:target_path) { Cask::Config.global.appdir.join("AnotherName.app") }
before do before do
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)
@ -29,7 +29,7 @@ describe Hbc::Artifact::App, :cask do
describe "when app is in a subdirectory" do describe "when app is in a subdirectory" do
let(:cask) { let(:cask) {
Hbc::Cask.new("subdir") do Cask::Cask.new("subdir") do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://example.com/local-caffeine" homepage "https://example.com/local-caffeine"
version "1.2.3" version "1.2.3"
@ -58,14 +58,14 @@ describe Hbc::Artifact::App, :cask do
expect(target_path).to be_a_directory expect(target_path).to be_a_directory
expect(source_path).not_to exist expect(source_path).not_to exist
expect(Hbc::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to be_a_directory expect(cask.staged_path.join("Caffeine Deluxe.app")).to be_a_directory
end end
it "avoids clobbering an existing app by moving over it" do it "avoids clobbering an existing app by moving over it" do
target_path.mkpath target_path.mkpath
expect(install_phase).to raise_error(Hbc::CaskError, "It seems there is already an App at '#{target_path}'.") expect(install_phase).to raise_error(Cask::CaskError, "It seems there is already an App at '#{target_path}'.")
expect(source_path).to be_a_directory expect(source_path).to be_a_directory
expect(target_path).to be_a_directory expect(target_path).to be_a_directory

View File

@ -1,11 +1,11 @@
describe Hbc::Artifact::App, :cask do describe Cask::Artifact::App, :cask do
let(:cask) { Hbc::CaskLoader.load(cask_path("local-caffeine")) } let(:cask) { Cask::CaskLoader.load(cask_path("local-caffeine")) }
let(:command) { SystemCommand } let(:command) { SystemCommand }
let(:force) { false } let(:force) { false }
let(:app) { cask.artifacts.find { |a| a.is_a?(described_class) } } let(:app) { cask.artifacts.find { |a| a.is_a?(described_class) } }
let(:source_path) { cask.staged_path.join("Caffeine.app") } let(:source_path) { cask.staged_path.join("Caffeine.app") }
let(:target_path) { Hbc::Config.global.appdir.join("Caffeine.app") } let(:target_path) { Cask::Config.global.appdir.join("Caffeine.app") }
let(:install_phase) { app.install_phase(command: command, force: force) } let(:install_phase) { app.install_phase(command: command, force: force) }
let(:uninstall_phase) { app.uninstall_phase(command: command, force: force) } let(:uninstall_phase) { app.uninstall_phase(command: command, force: force) }
@ -24,7 +24,7 @@ describe Hbc::Artifact::App, :cask do
describe "when app is in a subdirectory" do describe "when app is in a subdirectory" do
let(:cask) { let(:cask) {
Hbc::Cask.new("subdir") do Cask::Cask.new("subdir") do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://example.com/local-caffeine" homepage "https://example.com/local-caffeine"
version "1.2.3" version "1.2.3"
@ -53,7 +53,7 @@ describe Hbc::Artifact::App, :cask do
expect(target_path).to be_a_directory expect(target_path).to be_a_directory
expect(source_path).not_to exist expect(source_path).not_to exist
expect(Hbc::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist expect(Cask::Config.global.appdir.join("Caffeine Deluxe.app")).not_to exist
expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist expect(cask.staged_path.join("Caffeine Deluxe.app")).to exist
end end
@ -64,7 +64,7 @@ describe Hbc::Artifact::App, :cask do
it "avoids clobbering an existing app" do it "avoids clobbering an existing app" do
expect { install_phase }.to raise_error( expect { install_phase }.to raise_error(
Hbc::CaskError, Cask::CaskError,
"It seems there is already an App at '#{target_path}'.", "It seems there is already an App at '#{target_path}'.",
) )
@ -80,7 +80,7 @@ describe Hbc::Artifact::App, :cask do
let(:force) { true } let(:force) { true }
before do before do
allow(Hbc::Utils).to receive(:current_user).and_return("fake_user") allow(Cask::Utils).to receive(:current_user).and_return("fake_user")
end end
describe "target is both writable and user-owned" do describe "target is both writable and user-owned" do
@ -167,7 +167,7 @@ describe Hbc::Artifact::App, :cask do
it "leaves the target alone" do it "leaves the target alone" do
expect { install_phase }.to raise_error( expect { install_phase }.to raise_error(
Hbc::CaskError, "It seems there is already an App at '#{target_path}'." Cask::CaskError, "It seems there is already an App at '#{target_path}'."
) )
expect(target_path).to be_a_symlink expect(target_path).to be_a_symlink
end end
@ -203,7 +203,7 @@ describe Hbc::Artifact::App, :cask do
message = "It seems the App source '#{source_path}' is not there." message = "It seems the App source '#{source_path}' is not there."
expect { install_phase }.to raise_error(Hbc::CaskError, message) expect { install_phase }.to raise_error(Cask::CaskError, message)
end end
end end

View File

@ -1,11 +1,11 @@
describe Hbc::Artifact::Binary, :cask do describe Cask::Artifact::Binary, :cask do
let(:cask) { let(:cask) {
Hbc::CaskLoader.load(cask_path("with-binary")).tap do |cask| Cask::CaskLoader.load(cask_path("with-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)
end end
} }
let(:artifacts) { cask.artifacts.select { |a| a.is_a?(described_class) } } let(:artifacts) { cask.artifacts.select { |a| a.is_a?(described_class) } }
let(:expected_path) { Hbc::Config.global.binarydir.join("binary") } let(:expected_path) { Cask::Config.global.binarydir.join("binary") }
after do after do
FileUtils.rm expected_path if expected_path.exist? FileUtils.rm expected_path if expected_path.exist?
@ -13,11 +13,11 @@ describe Hbc::Artifact::Binary, :cask do
context "when --no-binaries is specified" do context "when --no-binaries is specified" do
let(:cask) { let(:cask) {
Hbc::CaskLoader.load(cask_path("with-binary")) Cask::CaskLoader.load(cask_path("with-binary"))
} }
it "doesn't link the binary when --no-binaries is specified" do it "doesn't link the binary when --no-binaries is specified" do
Hbc::Installer.new(cask, binaries: false).install Cask::Installer.new(cask, binaries: false).install
expect(expected_path).not_to exist expect(expected_path).not_to exist
end end
end end
@ -33,12 +33,12 @@ describe Hbc::Artifact::Binary, :cask do
context "when the binary is not executable" do context "when the binary is not executable" do
let(:cask) { let(:cask) {
Hbc::CaskLoader.load(cask_path("with-non-executable-binary")).tap do |cask| Cask::CaskLoader.load(cask_path("with-non-executable-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)
end end
} }
let(:expected_path) { Hbc::Config.global.binarydir.join("naked_non_executable") } let(:expected_path) { Cask::Config.global.binarydir.join("naked_non_executable") }
it "makes the binary executable" do it "makes the binary executable" do
expect(FileUtils).to receive(:chmod) expect(FileUtils).to receive(:chmod)
@ -60,7 +60,7 @@ describe Hbc::Artifact::Binary, :cask do
artifacts.each do |artifact| artifacts.each do |artifact|
artifact.install_phase(command: NeverSudoSystemCommand, force: false) artifact.install_phase(command: NeverSudoSystemCommand, force: false)
end end
}.to raise_error(Hbc::CaskError) }.to raise_error(Cask::CaskError)
expect(expected_path).not_to be :symlink? expect(expected_path).not_to be :symlink?
end end
@ -76,7 +76,7 @@ describe Hbc::Artifact::Binary, :cask do
end end
it "creates parent directory if it doesn't exist" do it "creates parent directory if it doesn't exist" do
FileUtils.rmdir Hbc::Config.global.binarydir FileUtils.rmdir Cask::Config.global.binarydir
artifacts.each do |artifact| artifacts.each do |artifact|
artifact.install_phase(command: NeverSudoSystemCommand, force: false) artifact.install_phase(command: NeverSudoSystemCommand, force: false)
@ -87,13 +87,13 @@ describe Hbc::Artifact::Binary, :cask do
context "binary is inside an app package" do context "binary is inside an app package" do
let(:cask) { let(:cask) {
Hbc::CaskLoader.load(cask_path("with-embedded-binary")).tap do |cask| Cask::CaskLoader.load(cask_path("with-embedded-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)
end end
} }
it "links the binary to the proper directory" do it "links the binary to the proper directory" do
cask.artifacts.select { |a| a.is_a?(Hbc::Artifact::App) }.each do |artifact| cask.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }.each do |artifact|
artifact.install_phase(command: NeverSudoSystemCommand, force: false) artifact.install_phase(command: NeverSudoSystemCommand, force: false)
end end
artifacts.each do |artifact| artifacts.each do |artifact|

View File

@ -1,5 +1,5 @@
describe Hbc::Artifact::Artifact, :cask do describe Cask::Artifact::Artifact, :cask do
let(:cask) { Hbc::CaskLoader.load(cask_path("with-generic-artifact")) } let(:cask) { Cask::CaskLoader.load(cask_path("with-generic-artifact")) }
let(:install_phase) { let(:install_phase) {
lambda do lambda do
@ -10,7 +10,7 @@ describe Hbc::Artifact::Artifact, :cask do
} }
let(:source_path) { cask.staged_path.join("Caffeine.app") } let(:source_path) { cask.staged_path.join("Caffeine.app") }
let(:target_path) { Hbc::Config.global.appdir.join("Caffeine.app") } let(:target_path) { Cask::Config.global.appdir.join("Caffeine.app") }
before do before do
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)
@ -19,8 +19,8 @@ describe Hbc::Artifact::Artifact, :cask do
context "without target" do context "without target" do
it "fails to load" do it "fails to load" do
expect { expect {
Hbc::CaskLoader.load(cask_path("invalid/invalid-generic-artifact-no-target")) Cask::CaskLoader.load(cask_path("invalid/invalid-generic-artifact-no-target"))
}.to raise_error(Hbc::CaskInvalidError, /target required for Generic Artifact/) }.to raise_error(Cask::CaskInvalidError, /target required for Generic Artifact/)
end end
end end
@ -36,7 +36,7 @@ describe Hbc::Artifact::Artifact, :cask do
expect { expect {
install_phase.call install_phase.call
}.to raise_error(Hbc::CaskError) }.to raise_error(Cask::CaskError)
expect(source_path).to be_a_directory expect(source_path).to be_a_directory
expect(target_path).to be_a_directory expect(target_path).to be_a_directory

Some files were not shown because too many files have changed in this diff Show More