Merge pull request #8339 from reitermarkus/documentation
Improve documentation and add `@api private` to internal classes.
This commit is contained in:
commit
1a51485226
@ -27,5 +27,9 @@ Cask/StanzaOrder:
|
|||||||
# don't want these for casks but re-enabled for Library/Homebrew
|
# don't want these for casks but re-enabled for Library/Homebrew
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Documentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Metrics/BlockLength:
|
Metrics/BlockLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
inherit_from: ../.rubocop_rspec.yml
|
inherit_from:
|
||||||
|
- ../.rubocop_rspec.yml
|
||||||
|
- .rubocop_todo.yml
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
Include:
|
Include:
|
||||||
@ -105,12 +107,6 @@ Naming/MethodParameterName:
|
|||||||
Style/AccessModifierDeclarations:
|
Style/AccessModifierDeclarations:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# make rspec formatting more flexible
|
|
||||||
Style/BlockDelimiters:
|
|
||||||
Exclude:
|
|
||||||
- '**/*_spec.rb'
|
|
||||||
- '**/shared_examples/**/*.rb'
|
|
||||||
|
|
||||||
# don't group nicely documented or private attr_readers
|
# don't group nicely documented or private attr_readers
|
||||||
Style/AccessorGrouping:
|
Style/AccessorGrouping:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -121,11 +117,16 @@ Style/AccessorGrouping:
|
|||||||
- 'system_command.rb'
|
- 'system_command.rb'
|
||||||
- 'tap.rb'
|
- 'tap.rb'
|
||||||
|
|
||||||
|
# make rspec formatting more flexible
|
||||||
|
Style/BlockDelimiters:
|
||||||
|
Exclude:
|
||||||
|
- '**/*_spec.rb'
|
||||||
|
- '**/shared_examples/**/*.rb'
|
||||||
|
|
||||||
# document our public APIs
|
# document our public APIs
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Include:
|
|
||||||
- 'formula.rb'
|
|
||||||
Style/DocumentationMethod:
|
Style/DocumentationMethod:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Include:
|
Include:
|
||||||
|
|||||||
31
Library/Homebrew/.rubocop_todo.yml
Normal file
31
Library/Homebrew/.rubocop_todo.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
Style/Documentation:
|
||||||
|
Exclude:
|
||||||
|
- 'compat/**/*.rb'
|
||||||
|
- 'extend/**/*.rb'
|
||||||
|
- 'cmd/**/*.rb'
|
||||||
|
- 'dev-cmd/**/*.rb'
|
||||||
|
- 'test/**/*.rb'
|
||||||
|
- 'cask/macos.rb'
|
||||||
|
- 'cli/args.rb'
|
||||||
|
- 'cli/parser.rb'
|
||||||
|
- 'download_strategy.rb'
|
||||||
|
- 'global.rb'
|
||||||
|
- 'keg_relocate.rb'
|
||||||
|
- 'os/linux/global.rb'
|
||||||
|
- 'os/mac/architecture_list.rb'
|
||||||
|
- 'os/mac/keg.rb'
|
||||||
|
- 'reinstall.rb'
|
||||||
|
- 'software_spec.rb'
|
||||||
|
- 'upgrade.rb'
|
||||||
|
- 'utils.rb'
|
||||||
|
- 'utils/fork.rb'
|
||||||
|
- 'utils/gems.rb'
|
||||||
|
- 'utils/notability.rb'
|
||||||
|
- 'utils/popen.rb'
|
||||||
|
- 'utils/pypi.rb'
|
||||||
|
- 'utils/shebang.rb'
|
||||||
|
- 'utils/shell.rb'
|
||||||
|
- 'utils/spdx.rb'
|
||||||
|
- 'utils/livecheck_formula.rb'
|
||||||
|
- 'utils/repology.rb'
|
||||||
|
- 'version.rb'
|
||||||
@ -1,5 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Represention of a `*PATH` environment variable.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class PATH
|
class PATH
|
||||||
include Enumerable
|
include Enumerable
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
require "utils/curl"
|
require "utils/curl"
|
||||||
require "json"
|
require "json"
|
||||||
|
|
||||||
|
# Bintray API client.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Bintray
|
class Bintray
|
||||||
include Context
|
include Context
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,9 @@ require "fcntl"
|
|||||||
require "socket"
|
require "socket"
|
||||||
require "cmd/install"
|
require "cmd/install"
|
||||||
|
|
||||||
|
# A formula build.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Build
|
class Build
|
||||||
attr_reader :formula, :deps, :reqs, :args
|
attr_reader :formula, :deps, :reqs, :args
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Options for a formula build.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class BuildOptions
|
class BuildOptions
|
||||||
# @private
|
# @private
|
||||||
def initialize(args, options)
|
def initialize(args, options)
|
||||||
|
|||||||
@ -27,6 +27,9 @@ require "cask/artifact/uninstall"
|
|||||||
require "cask/artifact/zap"
|
require "cask/artifact/zap"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Module containing all cask artifact classes.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Artifact
|
module Artifact
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Abstract superclass for all artifacts.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AbstractArtifact
|
class AbstractArtifact
|
||||||
include Comparable
|
include Comparable
|
||||||
extend Predicable
|
extend Predicable
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/abstract_artifact"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Abstract superclass for block artifacts.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AbstractFlightBlock < AbstractArtifact
|
class AbstractFlightBlock < AbstractArtifact
|
||||||
def self.dsl_key
|
def self.dsl_key
|
||||||
super.to_s.sub(/_block$/, "").to_sym
|
super.to_s.sub(/_block$/, "").to_sym
|
||||||
|
|||||||
@ -10,6 +10,9 @@ using HashValidator
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Abstract superclass for uninstall artifacts.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AbstractUninstall < AbstractArtifact
|
class AbstractUninstall < AbstractArtifact
|
||||||
ORDERED_DIRECTIVES = [
|
ORDERED_DIRECTIVES = [
|
||||||
:early_script,
|
:early_script,
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `app` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class App < Moved
|
class App < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,6 +7,9 @@ using HashValidator
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Generic artifact corresponding to the `artifact` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Artifact < Moved
|
class Artifact < Moved
|
||||||
def self.english_name
|
def self.english_name
|
||||||
"Generic Artifact"
|
"Generic Artifact"
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `audio_unit_plugin` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AudioUnitPlugin < Moved
|
class AudioUnitPlugin < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/symlinked"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `binary` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Binary < Symlinked
|
class Binary < Symlinked
|
||||||
def link(command: nil, **options)
|
def link(command: nil, **options)
|
||||||
super(command: command, **options)
|
super(command: command, **options)
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
require "cask/artifact/moved"
|
require "cask/artifact/moved"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Artifact corresponding to the `colorpicker` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Artifact
|
module Artifact
|
||||||
class Colorpicker < Moved
|
class Colorpicker < Moved
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `dictionary` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Dictionary < Moved
|
class Dictionary < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `font` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Font < Moved
|
class Font < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `input_method` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class InputMethod < Moved
|
class InputMethod < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,12 +7,16 @@ using HashValidator
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `installer` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Installer < AbstractArtifact
|
class Installer < AbstractArtifact
|
||||||
VALID_KEYS = Set.new([
|
VALID_KEYS = Set.new([
|
||||||
:manual,
|
:manual,
|
||||||
:script,
|
:script,
|
||||||
]).freeze
|
]).freeze
|
||||||
|
|
||||||
|
# Extension module for manual installers.
|
||||||
module ManualInstaller
|
module ManualInstaller
|
||||||
def install_phase(**)
|
def install_phase(**)
|
||||||
puts <<~EOS
|
puts <<~EOS
|
||||||
@ -23,6 +27,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Extension module for script installers.
|
||||||
module ScriptInstaller
|
module ScriptInstaller
|
||||||
def install_phase(command: nil, **_)
|
def install_phase(command: nil, **_)
|
||||||
ohai "Running #{self.class.dsl_key} script '#{path}'"
|
ohai "Running #{self.class.dsl_key} script '#{path}'"
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `internet_plugin` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class InternetPlugin < Moved
|
class InternetPlugin < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/symlinked"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `manpage` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Manpage < Symlinked
|
class Manpage < Symlinked
|
||||||
attr_reader :section
|
attr_reader :section
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `mdimporter` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Mdimporter < Moved
|
class Mdimporter < Moved
|
||||||
def self.english_name
|
def self.english_name
|
||||||
"Spotlight metadata importer"
|
"Spotlight metadata importer"
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/relocated"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Superclass for all artifacts which are installed by moving them to the target location.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Moved < Relocated
|
class Moved < Relocated
|
||||||
def self.english_description
|
def self.english_description
|
||||||
"#{english_name}s"
|
"#{english_name}s"
|
||||||
|
|||||||
@ -10,6 +10,9 @@ using HashValidator
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `pkg` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Pkg < AbstractArtifact
|
class Pkg < AbstractArtifact
|
||||||
attr_reader :pkg_relative_path, :path, :stanza_options
|
attr_reader :pkg_relative_path, :path, :stanza_options
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/abstract_flight_block"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `postflight` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class PostflightBlock < AbstractFlightBlock
|
class PostflightBlock < AbstractFlightBlock
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/abstract_flight_block"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `preflight` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class PreflightBlock < AbstractFlightBlock
|
class PreflightBlock < AbstractFlightBlock
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `prefpane` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Prefpane < Moved
|
class Prefpane < Moved
|
||||||
def self.english_name
|
def self.english_name
|
||||||
"Preference Pane"
|
"Preference Pane"
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `qlplugin` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Qlplugin < Moved
|
class Qlplugin < Moved
|
||||||
def self.english_name
|
def self.english_name
|
||||||
"QuickLook Plugin"
|
"QuickLook Plugin"
|
||||||
|
|||||||
@ -7,6 +7,9 @@ using HashValidator
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Superclass for all artifacts which have a source and a target location.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Relocated < AbstractArtifact
|
class Relocated < AbstractArtifact
|
||||||
def self.from_args(cask, *args)
|
def self.from_args(cask, *args)
|
||||||
source_string, target_hash = args
|
source_string, target_hash = args
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `screen_saver` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class ScreenSaver < Moved
|
class ScreenSaver < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `service` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Service < Moved
|
class Service < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/abstract_artifact"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `stage_only` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class StageOnly < AbstractArtifact
|
class StageOnly < AbstractArtifact
|
||||||
def self.from_args(cask, *args)
|
def self.from_args(cask, *args)
|
||||||
raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true]
|
raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true]
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `suite` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Suite < Moved
|
class Suite < Moved
|
||||||
def self.english_name
|
def self.english_name
|
||||||
"App Suite"
|
"App Suite"
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/relocated"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Superclass for all artifacts which are installed by symlinking them to the target location.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Symlinked < Relocated
|
class Symlinked < Relocated
|
||||||
def self.link_type_english_name
|
def self.link_type_english_name
|
||||||
"Symlink"
|
"Symlink"
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/abstract_uninstall"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `uninstall` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Uninstall < AbstractUninstall
|
class Uninstall < AbstractUninstall
|
||||||
def uninstall_phase(**options)
|
def uninstall_phase(**options)
|
||||||
ORDERED_DIRECTIVES.reject { |directive_sym| directive_sym == :rmdir }
|
ORDERED_DIRECTIVES.reject { |directive_sym| directive_sym == :rmdir }
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `vst3_plugin` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Vst3Plugin < Moved
|
class Vst3Plugin < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/moved"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `vst_plugin` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class VstPlugin < Moved
|
class VstPlugin < Moved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/abstract_uninstall"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
|
# Artifact corresponding to the `zap` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Zap < AbstractUninstall
|
class Zap < AbstractUninstall
|
||||||
def zap_phase(**options)
|
def zap_phase(**options)
|
||||||
dispatch_uninstall_directives(**options)
|
dispatch_uninstall_directives(**options)
|
||||||
|
|||||||
@ -8,6 +8,9 @@ require "utils/git"
|
|||||||
require "utils/notability"
|
require "utils/notability"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Audit a cask for various problems.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Audit
|
class Audit
|
||||||
extend Predicable
|
extend Predicable
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
require "cask/audit"
|
require "cask/audit"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper class for auditing all available languages of a cask.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Auditor
|
class Auditor
|
||||||
extend Predicable
|
extend Predicable
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper functions for the cask cache.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Cache
|
module Cache
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,9 @@ require "cask/metadata"
|
|||||||
require "searchable"
|
require "searchable"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# An instance of a cask.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Cask
|
class Cask
|
||||||
extend Enumerable
|
extend Enumerable
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|||||||
@ -4,7 +4,11 @@ require "cask/cask"
|
|||||||
require "uri"
|
require "uri"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Loads a cask from various sources.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module CaskLoader
|
module CaskLoader
|
||||||
|
# Loads a cask from a string.
|
||||||
class FromContentLoader
|
class FromContentLoader
|
||||||
attr_reader :content
|
attr_reader :content
|
||||||
|
|
||||||
@ -36,6 +40,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Loads a cask from a path.
|
||||||
class FromPathLoader < FromContentLoader
|
class FromPathLoader < FromContentLoader
|
||||||
def self.can_load?(ref)
|
def self.can_load?(ref)
|
||||||
path = Pathname(ref)
|
path = Pathname(ref)
|
||||||
@ -76,6 +81,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Loads a cask from a URI.
|
||||||
class FromURILoader < FromPathLoader
|
class FromURILoader < FromPathLoader
|
||||||
def self.can_load?(ref)
|
def self.can_load?(ref)
|
||||||
uri_regex = ::URI::DEFAULT_PARSER.make_regexp
|
uri_regex = ::URI::DEFAULT_PARSER.make_regexp
|
||||||
@ -109,6 +115,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Loads a cask from a tap path.
|
||||||
class FromTapPathLoader < FromPathLoader
|
class FromTapPathLoader < FromPathLoader
|
||||||
def self.can_load?(ref)
|
def self.can_load?(ref)
|
||||||
super && !Tap.from_path(ref).nil?
|
super && !Tap.from_path(ref).nil?
|
||||||
@ -128,6 +135,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Loads a cask from a specific tap.
|
||||||
class FromTapLoader < FromTapPathLoader
|
class FromTapLoader < FromTapPathLoader
|
||||||
def self.can_load?(ref)
|
def self.can_load?(ref)
|
||||||
ref.to_s.match?(HOMEBREW_TAP_CASK_REGEX)
|
ref.to_s.match?(HOMEBREW_TAP_CASK_REGEX)
|
||||||
@ -145,6 +153,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Loads a cask from an existing {Cask} instance.
|
||||||
class FromInstanceLoader
|
class FromInstanceLoader
|
||||||
attr_reader :cask
|
attr_reader :cask
|
||||||
|
|
||||||
@ -161,6 +170,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Pseudo-loader which raises an error when trying to load the corresponding cask.
|
||||||
class NullLoader < FromPathLoader
|
class NullLoader < FromPathLoader
|
||||||
def self.can_load?(*)
|
def self.can_load?(*)
|
||||||
true
|
true
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
require "utils/user"
|
require "utils/user"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper functions for interacting with the `Caskroom` directory.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Caskroom
|
module Caskroom
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,9 @@ require "cask/cmd/internal_help"
|
|||||||
require "cask/cmd/internal_stanza"
|
require "cask/cmd/internal_stanza"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Implementation of the `brew cask` command-line interface.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Cmd
|
class Cmd
|
||||||
include Context
|
include Context
|
||||||
|
|
||||||
@ -240,6 +243,7 @@ module Cask
|
|||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Wrapper class for running an external Ruby command.
|
||||||
class ExternalRubyCommand
|
class ExternalRubyCommand
|
||||||
def initialize(command, path)
|
def initialize(command, path)
|
||||||
@command_name = command.to_s.capitalize.to_sym
|
@command_name = command.to_s.capitalize.to_sym
|
||||||
@ -269,6 +273,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Wrapper class for running an external command.
|
||||||
class ExternalCommand
|
class ExternalCommand
|
||||||
def initialize(path)
|
def initialize(path)
|
||||||
@path = path
|
@path = path
|
||||||
@ -283,6 +288,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Helper class for showing help for unknown subcommands.
|
||||||
class UnknownSubcommand
|
class UnknownSubcommand
|
||||||
def initialize(command_name)
|
def initialize(command_name)
|
||||||
@command_name = command_name
|
@command_name = command_name
|
||||||
@ -297,6 +303,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Helper class for showing help when no subcommand is given.
|
||||||
class NullCommand
|
class NullCommand
|
||||||
def self.run(*)
|
def self.run(*)
|
||||||
raise UsageError, "No subcommand given."
|
raise UsageError, "No subcommand given."
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask --cache` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Cache < AbstractCommand
|
class Cache < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "search"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Abstract superclass for all `brew cask` commands.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AbstractCommand
|
class AbstractCommand
|
||||||
include Homebrew::Search
|
include Homebrew::Search
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Abstract superclass for all internal `brew cask` commands.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AbstractInternalCommand < AbstractCommand
|
class AbstractInternalCommand < AbstractCommand
|
||||||
def self.command_name
|
def self.command_name
|
||||||
super.sub(/^internal_/i, "_")
|
super.sub(/^internal_/i, "_")
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask audit` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Audit < AbstractCommand
|
class Audit < AbstractCommand
|
||||||
def self.description
|
def self.description
|
||||||
<<~EOS
|
<<~EOS
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask cat` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Cat < AbstractCommand
|
class Cat < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask create` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Create < AbstractCommand
|
class Create < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask doctor` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Doctor < AbstractCommand
|
class Doctor < AbstractCommand
|
||||||
def self.max_named
|
def self.max_named
|
||||||
0
|
0
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask edit` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Edit < AbstractCommand
|
class Edit < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask fetch` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Fetch < AbstractCommand
|
class Fetch < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask help` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Help < AbstractCommand
|
class Help < AbstractCommand
|
||||||
def self.max_named
|
def self.max_named
|
||||||
1
|
1
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask home` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Home < AbstractCommand
|
class Home < AbstractCommand
|
||||||
def self.description
|
def self.description
|
||||||
"Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage."
|
"Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage."
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "json"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask info` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Info < AbstractCommand
|
class Info < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask install` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Install < AbstractCommand
|
class Install < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask _help` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class InternalHelp < AbstractInternalCommand
|
class InternalHelp < AbstractInternalCommand
|
||||||
def self.max_named
|
def self.max_named
|
||||||
0
|
0
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/dsl"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask _stanza` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class InternalStanza < AbstractInternalCommand
|
class InternalStanza < AbstractInternalCommand
|
||||||
# Syntax
|
# Syntax
|
||||||
#
|
#
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/artifact/relocated"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask list` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class List < AbstractCommand
|
class List < AbstractCommand
|
||||||
def self.description
|
def self.description
|
||||||
"Lists installed casks or the casks provided in the arguments."
|
"Lists installed casks or the casks provided in the arguments."
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask outdated` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Outdated < AbstractCommand
|
class Outdated < AbstractCommand
|
||||||
def self.description
|
def self.description
|
||||||
"List the outdated installed casks."
|
"List the outdated installed casks."
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask reinstall` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Reinstall < Install
|
class Reinstall < Install
|
||||||
def self.description
|
def self.description
|
||||||
"Reinstalls the given <cask>."
|
"Reinstalls the given <cask>."
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "json"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask style` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Style < AbstractCommand
|
class Style < AbstractCommand
|
||||||
def self.description
|
def self.description
|
||||||
"Checks style of the given <cask> using RuboCop."
|
"Checks style of the given <cask> using RuboCop."
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask uninstall` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Uninstall < AbstractCommand
|
class Uninstall < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -5,6 +5,9 @@ require "cask/config"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask upgrade` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Upgrade < AbstractCommand
|
class Upgrade < AbstractCommand
|
||||||
def self.description
|
def self.description
|
||||||
"Upgrades all outdated casks or the specified casks."
|
"Upgrades all outdated casks or the specified casks."
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class Cmd
|
class Cmd
|
||||||
|
# Implementation of the `brew cask zap` command.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Zap < AbstractCommand
|
class Zap < AbstractCommand
|
||||||
def self.min_named
|
def self.min_named
|
||||||
:cask
|
:cask
|
||||||
|
|||||||
@ -9,6 +9,9 @@ require "extend/hash_validator"
|
|||||||
using HashValidator
|
using HashValidator
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Configuration for installing casks.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Config
|
class Config
|
||||||
DEFAULT_DIRS = {
|
DEFAULT_DIRS = {
|
||||||
appdir: "/Applications",
|
appdir: "/Applications",
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# List of casks which are not allowed in official taps.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Denylist
|
module Denylist
|
||||||
def self.reason(name)
|
def self.reason(name)
|
||||||
case name
|
case name
|
||||||
|
|||||||
@ -6,6 +6,9 @@ require "cask/quarantine"
|
|||||||
require "cask/verify"
|
require "cask/verify"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# A download corresponding to a {Cask}.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Download
|
class Download
|
||||||
attr_reader :cask
|
attr_reader :cask
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,9 @@ require "cask/url"
|
|||||||
require "cask/utils"
|
require "cask/utils"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Class representing the domain-specific language used for casks.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class DSL
|
class DSL
|
||||||
ORDINARY_ARTIFACT_CLASSES = [
|
ORDINARY_ARTIFACT_CLASSES = [
|
||||||
Artifact::Installer,
|
Artifact::Installer,
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `appcast` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Appcast
|
class Appcast
|
||||||
attr_reader :uri, :parameters, :must_contain
|
attr_reader :uri, :parameters, :must_contain
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/utils"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Superclass for all stanzas which take a block.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Base
|
class Base
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,18 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Caveats DSL. Each method should handle output, following the
|
|
||||||
# convention of at least one trailing blank line so that the user
|
|
||||||
# can distinguish separate caveats.
|
|
||||||
#
|
|
||||||
# ( 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
|
|
||||||
# convenience of Cask authors. )
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `caveats` stanza.
|
||||||
|
#
|
||||||
|
# Each method should handle output, following the
|
||||||
|
# convention of at least one trailing blank line so that the user
|
||||||
|
# can distinguish separate caveats.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# convenience of Cask authors.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Caveats < Base
|
class Caveats < Base
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
super(*args)
|
super(*args)
|
||||||
|
|||||||
@ -5,6 +5,9 @@ using HashValidator
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `conflicts_with` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class ConflictsWith < DelegateClass(Hash)
|
class ConflictsWith < DelegateClass(Hash)
|
||||||
VALID_KEYS = [
|
VALID_KEYS = [
|
||||||
:formula,
|
:formula,
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "unpack_strategy"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `container` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Container
|
class Container
|
||||||
VALID_KEYS = Set.new([
|
VALID_KEYS = Set.new([
|
||||||
:type,
|
:type,
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "requirements/macos_requirement"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `depends_on` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class DependsOn < DelegateClass(Hash)
|
class DependsOn < DelegateClass(Hash)
|
||||||
VALID_KEYS = Set.new([
|
VALID_KEYS = Set.new([
|
||||||
:formula,
|
:formula,
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/staged"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `postflight` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Postflight < Base
|
class Postflight < Base
|
||||||
include Staged
|
include Staged
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `preflight` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Preflight < Base
|
class Preflight < Base
|
||||||
include Staged
|
include Staged
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `uninstall_postflight` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class UninstallPostflight < Base
|
class UninstallPostflight < Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "cask/staged"
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `uninstall_preflight` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class UninstallPreflight < Base
|
class UninstallPreflight < Base
|
||||||
include Staged
|
include Staged
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
|
# Class corresponding to the `version` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Version < ::String
|
class Version < ::String
|
||||||
DIVIDERS = {
|
DIVIDERS = {
|
||||||
"." => :dots,
|
"." => :dots,
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# General cask error.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskError < RuntimeError; end
|
class CaskError < RuntimeError; end
|
||||||
|
|
||||||
|
# Cask error containing multiple other errors.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class MultipleCaskErrors < CaskError
|
class MultipleCaskErrors < CaskError
|
||||||
def initialize(errors)
|
def initialize(errors)
|
||||||
super()
|
super()
|
||||||
@ -18,6 +24,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Abstract cask error containing a cask token.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class AbstractCaskErrorWithToken < CaskError
|
class AbstractCaskErrorWithToken < CaskError
|
||||||
attr_reader :token, :reason
|
attr_reader :token, :reason
|
||||||
|
|
||||||
@ -29,12 +38,18 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask is not installed.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskNotInstalledError < AbstractCaskErrorWithToken
|
class CaskNotInstalledError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
"Cask '#{token}' is not installed."
|
"Cask '#{token}' is not installed."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask conflicts with another cask.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskConflictError < AbstractCaskErrorWithToken
|
class CaskConflictError < AbstractCaskErrorWithToken
|
||||||
attr_reader :conflicting_cask
|
attr_reader :conflicting_cask
|
||||||
|
|
||||||
@ -48,24 +63,36 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask is not available.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskUnavailableError < AbstractCaskErrorWithToken
|
class CaskUnavailableError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
"Cask '#{token}' is unavailable#{reason.empty? ? "." : ": #{reason}"}"
|
"Cask '#{token}' is unavailable#{reason.empty? ? "." : ": #{reason}"}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask is unreadable.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskUnreadableError < CaskUnavailableError
|
class CaskUnreadableError < CaskUnavailableError
|
||||||
def to_s
|
def to_s
|
||||||
"Cask '#{token}' is unreadable#{reason.empty? ? "." : ": #{reason}"}"
|
"Cask '#{token}' is unreadable#{reason.empty? ? "." : ": #{reason}"}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask already exists.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskAlreadyCreatedError < AbstractCaskErrorWithToken
|
class CaskAlreadyCreatedError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
%Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew cask edit #{token}")} to edit it.)
|
%Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew cask edit #{token}")} to edit it.)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask is already installed.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskAlreadyInstalledError < AbstractCaskErrorWithToken
|
class CaskAlreadyInstalledError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
<<~EOS
|
<<~EOS
|
||||||
@ -77,6 +104,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask depends on X11.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskX11DependencyError < AbstractCaskErrorWithToken
|
class CaskX11DependencyError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
<<~EOS
|
<<~EOS
|
||||||
@ -89,36 +119,54 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when there is a cyclic cask dependency.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskCyclicDependencyError < AbstractCaskErrorWithToken
|
class CaskCyclicDependencyError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
"Cask '#{token}' includes cyclic dependencies on other Casks#{reason.empty? ? "." : ": #{reason}"}"
|
"Cask '#{token}' includes cyclic dependencies on other Casks#{reason.empty? ? "." : ": #{reason}"}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask depends on itself.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskSelfReferencingDependencyError < CaskCyclicDependencyError
|
class CaskSelfReferencingDependencyError < CaskCyclicDependencyError
|
||||||
def to_s
|
def to_s
|
||||||
"Cask '#{token}' depends on itself."
|
"Cask '#{token}' depends on itself."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when no cask is specified.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskUnspecifiedError < CaskError
|
class CaskUnspecifiedError < CaskError
|
||||||
def to_s
|
def to_s
|
||||||
"This command requires a Cask token."
|
"This command requires a Cask token."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask is invalid.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskInvalidError < AbstractCaskErrorWithToken
|
class CaskInvalidError < AbstractCaskErrorWithToken
|
||||||
def to_s
|
def to_s
|
||||||
"Cask '#{token}' definition is invalid#{reason.empty? ? "." : ": #{reason}"}"
|
"Cask '#{token}' definition is invalid#{reason.empty? ? "." : ": #{reason}"}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask token does not match the file name.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskTokenMismatchError < CaskInvalidError
|
class CaskTokenMismatchError < CaskInvalidError
|
||||||
def initialize(token, header_token)
|
def initialize(token, header_token)
|
||||||
super(token, "Token '#{header_token}' in header line does not match the file name.")
|
super(token, "Token '#{header_token}' in header line does not match the file name.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error with a cask's checksum.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskSha256Error < AbstractCaskErrorWithToken
|
class CaskSha256Error < AbstractCaskErrorWithToken
|
||||||
attr_reader :expected, :actual
|
attr_reader :expected, :actual
|
||||||
|
|
||||||
@ -129,6 +177,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask's checksum is missing.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskSha256MissingError < CaskSha256Error
|
class CaskSha256MissingError < CaskSha256Error
|
||||||
def to_s
|
def to_s
|
||||||
<<~EOS
|
<<~EOS
|
||||||
@ -138,6 +189,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask's checksum does not match.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskSha256MismatchError < CaskSha256Error
|
class CaskSha256MismatchError < CaskSha256Error
|
||||||
attr_reader :path
|
attr_reader :path
|
||||||
|
|
||||||
@ -159,6 +213,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when a cask has no checksum and the `--require-sha` flag is passed.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskNoShasumError < CaskSha256Error
|
class CaskNoShasumError < CaskSha256Error
|
||||||
def to_s
|
def to_s
|
||||||
<<~EOS
|
<<~EOS
|
||||||
@ -168,6 +225,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error during quarantining of a file.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskQuarantineError < CaskError
|
class CaskQuarantineError < CaskError
|
||||||
attr_reader :path, :reason
|
attr_reader :path, :reason
|
||||||
|
|
||||||
@ -191,6 +251,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error while propagating quarantine information to subdirectories.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskQuarantinePropagationError < CaskQuarantineError
|
class CaskQuarantinePropagationError < CaskQuarantineError
|
||||||
def to_s
|
def to_s
|
||||||
s = +"Failed to quarantine one or more files within #{path}."
|
s = +"Failed to quarantine one or more files within #{path}."
|
||||||
@ -205,6 +268,9 @@ module Cask
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error while removing quarantine information.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CaskQuarantineReleaseError < CaskQuarantineError
|
class CaskQuarantineReleaseError < CaskQuarantineError
|
||||||
def to_s
|
def to_s
|
||||||
s = +"Failed to release #{path} from quarantine."
|
s = +"Failed to release #{path} from quarantine."
|
||||||
|
|||||||
@ -13,6 +13,9 @@ require "cask/quarantine"
|
|||||||
require "cgi"
|
require "cgi"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Installer for a {Cask}.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Installer
|
class Installer
|
||||||
extend Predicable
|
extend Predicable
|
||||||
# TODO: it is unwise for Cask::Staged to be a module, when we are
|
# TODO: it is unwise for Cask::Staged to be a module, when we are
|
||||||
|
|||||||
@ -238,6 +238,7 @@ module OS
|
|||||||
.map(&method(:Pathname))
|
.map(&method(:Pathname))
|
||||||
.to_set
|
.to_set
|
||||||
.freeze
|
.freeze
|
||||||
|
private_constant :SYSTEM_DIRS
|
||||||
|
|
||||||
# TODO: There should be a way to specify a containing
|
# TODO: There should be a way to specify a containing
|
||||||
# directory under which nothing can be deleted.
|
# directory under which nothing can be deleted.
|
||||||
@ -380,6 +381,7 @@ module OS
|
|||||||
.to_set
|
.to_set
|
||||||
.union(SYSTEM_DIRS)
|
.union(SYSTEM_DIRS)
|
||||||
.freeze
|
.freeze
|
||||||
|
private_constant :UNDELETABLE_PATHS
|
||||||
|
|
||||||
def system_dir?(dir)
|
def system_dir?(dir)
|
||||||
SYSTEM_DIRS.include?(Pathname.new(dir).expand_path)
|
SYSTEM_DIRS.include?(Pathname.new(dir).expand_path)
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper module for reading and writing cask metadata.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Metadata
|
module Metadata
|
||||||
METADATA_SUBDIR = ".metadata"
|
METADATA_SUBDIR = ".metadata"
|
||||||
TIMESTAMP_FORMAT = "%Y%m%d%H%M%S.%L"
|
TIMESTAMP_FORMAT = "%Y%m%d%H%M%S.%L"
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
require "cask/macos"
|
require "cask/macos"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper class for uninstalling `.pkg` installers.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
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|
|
||||||
|
|||||||
@ -4,6 +4,9 @@ require "development_tools"
|
|||||||
require "cask/exceptions"
|
require "cask/exceptions"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper module for quarantining files.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Quarantine
|
module Quarantine
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
@ -11,15 +14,15 @@ module Cask
|
|||||||
|
|
||||||
QUARANTINE_SCRIPT = (HOMEBREW_LIBRARY_PATH/"cask/utils/quarantine.swift").freeze
|
QUARANTINE_SCRIPT = (HOMEBREW_LIBRARY_PATH/"cask/utils/quarantine.swift").freeze
|
||||||
|
|
||||||
# @private
|
|
||||||
def swift
|
def swift
|
||||||
@swift ||= DevelopmentTools.locate("swift")
|
@swift ||= DevelopmentTools.locate("swift")
|
||||||
end
|
end
|
||||||
|
private :swift
|
||||||
|
|
||||||
# @private
|
|
||||||
def xattr
|
def xattr
|
||||||
@xattr ||= DevelopmentTools.locate("xattr")
|
@xattr ||= DevelopmentTools.locate("xattr")
|
||||||
end
|
end
|
||||||
|
private :xattr
|
||||||
|
|
||||||
def check_quarantine_support
|
def check_quarantine_support
|
||||||
odebug "Checking quarantine support"
|
odebug "Checking quarantine support"
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
require "utils/user"
|
require "utils/user"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper functions for staged casks.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Staged
|
module Staged
|
||||||
def set_permissions(paths, permissions_str)
|
def set_permissions(paths, permissions_str)
|
||||||
full_paths = remove_nonexistent(paths)
|
full_paths = remove_nonexistent(paths)
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
require "tsort"
|
require "tsort"
|
||||||
|
|
||||||
# a basic topologically sortable hashmap
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Topologically sortable hash map.
|
||||||
class TopologicalHash < Hash
|
class TopologicalHash < Hash
|
||||||
include TSort
|
include TSort
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Class corresponding to the `url` stanza.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class URL
|
class URL
|
||||||
ATTRIBUTES = [
|
ATTRIBUTES = [
|
||||||
:using,
|
:using,
|
||||||
@ -7,6 +10,7 @@ class URL
|
|||||||
:trust_cert, :cookies, :referer, :user_agent,
|
:trust_cert, :cookies, :referer, :user_agent,
|
||||||
:data
|
:data
|
||||||
].freeze
|
].freeze
|
||||||
|
private_constant :ATTRIBUTES
|
||||||
|
|
||||||
attr_reader :uri, :specs, *ATTRIBUTES
|
attr_reader :uri, :specs, *ATTRIBUTES
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,9 @@ require "stringio"
|
|||||||
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs"
|
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs"
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper functions for various cask operations.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
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?
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Cask
|
module Cask
|
||||||
|
# Helper module for verifying a cask's checksum.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Verify
|
module Verify
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
require "language/python"
|
require "language/python"
|
||||||
|
|
||||||
|
# A formula's caveats.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Caveats
|
class Caveats
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# A formula's checksum.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class Checksum
|
class Checksum
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,9 @@ require "formulary"
|
|||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module CLI
|
module CLI
|
||||||
|
# Helper class for loading formulae/casks from named arguments.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class NamedArgs < SimpleDelegator
|
class NamedArgs < SimpleDelegator
|
||||||
def initialize(*args, override_spec: nil, force_bottle: false, flags: [])
|
def initialize(*args, override_spec: nil, force_bottle: false, flags: [])
|
||||||
@args = args
|
@args = args
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
require "cask/cmd"
|
require "cask/cmd"
|
||||||
|
|
||||||
|
# Helper functions for commands.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Commands
|
module Commands
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,9 @@ module CompilerConstants
|
|||||||
GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }).freeze
|
GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }).freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Class for checking compiler compatibility for a formula.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CompilerFailure
|
class CompilerFailure
|
||||||
attr_reader :name
|
attr_reader :name
|
||||||
|
|
||||||
@ -70,6 +73,9 @@ class CompilerFailure
|
|||||||
}.freeze
|
}.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Class for selecting a compiler for a formula.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class CompilerSelector
|
class CompilerSelector
|
||||||
include CompilerConstants
|
include CompilerConstants
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
require "monitor"
|
require "monitor"
|
||||||
|
|
||||||
|
# Module for querying the current execution context.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Context
|
module Context
|
||||||
extend MonitorMixin
|
extend MonitorMixin
|
||||||
|
|
||||||
@ -21,6 +24,7 @@ module Context
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Struct describing the current execution context.
|
||||||
class ContextStruct
|
class ContextStruct
|
||||||
def initialize(debug: nil, quiet: nil, verbose: nil)
|
def initialize(debug: nil, quiet: nil, verbose: nil)
|
||||||
@debug = debug
|
@debug = debug
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user