Fix spacing and indentation.
This commit is contained in:
parent
2b7e6c1dcb
commit
ad8ae33c1f
@ -58,8 +58,8 @@ module Hbc
|
||||
|
||||
def warning_target_exists
|
||||
message_parts = [
|
||||
"It seems there is already #{self.class.artifact_english_article} #{self.class.artifact_english_name} at '#{target}'",
|
||||
]
|
||||
"It seems there is already #{self.class.artifact_english_article} #{self.class.artifact_english_name} at '#{target}'",
|
||||
]
|
||||
yield(message_parts) if block_given?
|
||||
message_parts.join("; ")
|
||||
end
|
||||
|
@ -47,9 +47,9 @@ module Hbc
|
||||
raise CaskError, "pkg source file not found: '#{source}'"
|
||||
end
|
||||
args = [
|
||||
"-pkg", source,
|
||||
"-target", "/"
|
||||
]
|
||||
"-pkg", source,
|
||||
"-target", "/"
|
||||
]
|
||||
args << "-verboseR" if Hbc.verbose
|
||||
args << "-allowUntrusted" if pkg_install_opts :allow_untrusted
|
||||
@command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true)
|
||||
|
@ -11,18 +11,18 @@ module Hbc
|
||||
PATH_ARG_SLICE_SIZE = 500
|
||||
|
||||
ORDERED_DIRECTIVES = [
|
||||
:early_script,
|
||||
:launchctl,
|
||||
:quit,
|
||||
:signal,
|
||||
:login_item,
|
||||
:kext,
|
||||
:script,
|
||||
:pkgutil,
|
||||
:delete,
|
||||
:trash,
|
||||
:rmdir,
|
||||
].freeze
|
||||
:early_script,
|
||||
:launchctl,
|
||||
:quit,
|
||||
:signal,
|
||||
:login_item,
|
||||
:kext,
|
||||
:script,
|
||||
:pkgutil,
|
||||
:delete,
|
||||
:trash,
|
||||
:rmdir,
|
||||
].freeze
|
||||
|
||||
# TODO: these methods were consolidated here from separate
|
||||
# sources and should be refactored for consistency
|
||||
|
@ -2,7 +2,7 @@ module Hbc
|
||||
class Auditor
|
||||
def self.audit(cask, audit_download: false, check_token_conflicts: false)
|
||||
if !ARGV.value("language") &&
|
||||
languages_blocks = cask.instance_variable_get(:@dsl).instance_variable_get(:@language_blocks)
|
||||
languages_blocks = cask.instance_variable_get(:@dsl).instance_variable_get(:@language_blocks)
|
||||
begin
|
||||
saved_languages = MacOS.instance_variable_get(:@languages)
|
||||
|
||||
|
@ -31,46 +31,46 @@ require "hbc/cli/internal_stanza"
|
||||
module Hbc
|
||||
class CLI
|
||||
ALIASES = {
|
||||
"ls" => "list",
|
||||
"homepage" => "home",
|
||||
"-S" => "search", # verb starting with "-" is questionable
|
||||
"up" => "update",
|
||||
"instal" => "install", # gem does the same
|
||||
"rm" => "uninstall",
|
||||
"remove" => "uninstall",
|
||||
"abv" => "info",
|
||||
"dr" => "doctor",
|
||||
# aliases from Homebrew that we don't (yet) support
|
||||
# 'ln' => 'link',
|
||||
# 'configure' => 'diy',
|
||||
# '--repo' => '--repository',
|
||||
# 'environment' => '--env',
|
||||
# '-c1' => '--config',
|
||||
}.freeze
|
||||
"ls" => "list",
|
||||
"homepage" => "home",
|
||||
"-S" => "search", # verb starting with "-" is questionable
|
||||
"up" => "update",
|
||||
"instal" => "install", # gem does the same
|
||||
"rm" => "uninstall",
|
||||
"remove" => "uninstall",
|
||||
"abv" => "info",
|
||||
"dr" => "doctor",
|
||||
# aliases from Homebrew that we don't (yet) support
|
||||
# 'ln' => 'link',
|
||||
# 'configure' => 'diy',
|
||||
# '--repo' => '--repository',
|
||||
# 'environment' => '--env',
|
||||
# '-c1' => '--config',
|
||||
}.freeze
|
||||
|
||||
OPTIONS = {
|
||||
"--caskroom=" => :caskroom=,
|
||||
"--appdir=" => :appdir=,
|
||||
"--colorpickerdir=" => :colorpickerdir=,
|
||||
"--prefpanedir=" => :prefpanedir=,
|
||||
"--qlplugindir=" => :qlplugindir=,
|
||||
"--fontdir=" => :fontdir=,
|
||||
"--servicedir=" => :servicedir=,
|
||||
"--input_methoddir=" => :input_methoddir=,
|
||||
"--internet_plugindir=" => :internet_plugindir=,
|
||||
"--audio_unit_plugindir=" => :audio_unit_plugindir=,
|
||||
"--vst_plugindir=" => :vst_plugindir=,
|
||||
"--vst3_plugindir=" => :vst3_plugindir=,
|
||||
"--screen_saverdir=" => :screen_saverdir=,
|
||||
}.freeze
|
||||
"--caskroom=" => :caskroom=,
|
||||
"--appdir=" => :appdir=,
|
||||
"--colorpickerdir=" => :colorpickerdir=,
|
||||
"--prefpanedir=" => :prefpanedir=,
|
||||
"--qlplugindir=" => :qlplugindir=,
|
||||
"--fontdir=" => :fontdir=,
|
||||
"--servicedir=" => :servicedir=,
|
||||
"--input_methoddir=" => :input_methoddir=,
|
||||
"--internet_plugindir=" => :internet_plugindir=,
|
||||
"--audio_unit_plugindir=" => :audio_unit_plugindir=,
|
||||
"--vst_plugindir=" => :vst_plugindir=,
|
||||
"--vst3_plugindir=" => :vst3_plugindir=,
|
||||
"--screen_saverdir=" => :screen_saverdir=,
|
||||
}.freeze
|
||||
|
||||
FLAGS = {
|
||||
"--no-binaries" => :no_binaries=,
|
||||
"--debug" => :debug=,
|
||||
"--verbose" => :verbose=,
|
||||
"--outdated" => :cleanup_outdated=,
|
||||
"--help" => :help=,
|
||||
}.freeze
|
||||
"--no-binaries" => :no_binaries=,
|
||||
"--debug" => :debug=,
|
||||
"--verbose" => :verbose=,
|
||||
"--outdated" => :cleanup_outdated=,
|
||||
"--help" => :help=,
|
||||
}.freeze
|
||||
|
||||
def self.command_classes
|
||||
@command_classes ||= self.constants
|
||||
|
@ -88,10 +88,10 @@ module Hbc
|
||||
@homebrew_constants[name] = notfound_string
|
||||
begin
|
||||
@homebrew_constants[name] = SystemCommand.run!(Hbc.homebrew_executable,
|
||||
args: ["--#{name}"],
|
||||
print_stderr: false)
|
||||
.stdout
|
||||
.strip
|
||||
args: ["--#{name}"],
|
||||
print_stderr: false)
|
||||
.stdout
|
||||
.strip
|
||||
if @homebrew_constants[name] !~ /\S/
|
||||
@homebrew_constants[name] = "#{none_string} #{error_string}"
|
||||
end
|
||||
|
@ -23,31 +23,31 @@ module Hbc
|
||||
|
||||
# TODO: this should be retrievable from Hbc::DSL
|
||||
ARTIFACTS = Set.new [
|
||||
:app,
|
||||
:suite,
|
||||
:artifact,
|
||||
:prefpane,
|
||||
:qlplugin,
|
||||
:font,
|
||||
:service,
|
||||
:colorpicker,
|
||||
:binary,
|
||||
:input_method,
|
||||
:internet_plugin,
|
||||
:audio_unit_plugin,
|
||||
:vst_plugin,
|
||||
:vst3_plugin,
|
||||
:screen_saver,
|
||||
:pkg,
|
||||
:installer,
|
||||
:stage_only,
|
||||
:nested_container,
|
||||
:uninstall,
|
||||
:postflight,
|
||||
:uninstall_postflight,
|
||||
:preflight,
|
||||
:uninstall_postflight,
|
||||
]
|
||||
:app,
|
||||
:suite,
|
||||
:artifact,
|
||||
:prefpane,
|
||||
:qlplugin,
|
||||
:font,
|
||||
:service,
|
||||
:colorpicker,
|
||||
:binary,
|
||||
:input_method,
|
||||
:internet_plugin,
|
||||
:audio_unit_plugin,
|
||||
:vst_plugin,
|
||||
:vst3_plugin,
|
||||
:screen_saver,
|
||||
:pkg,
|
||||
:installer,
|
||||
:stage_only,
|
||||
:nested_container,
|
||||
:uninstall,
|
||||
:postflight,
|
||||
:uninstall_postflight,
|
||||
:preflight,
|
||||
:uninstall_postflight,
|
||||
]
|
||||
|
||||
def self.run(*arguments)
|
||||
table = arguments.include? "--table"
|
||||
|
@ -91,19 +91,19 @@ module Hbc
|
||||
end
|
||||
|
||||
# unnecessary DMG metadata
|
||||
DMG_METADATA_FILES = %w[
|
||||
.background
|
||||
.com.apple.timemachine.donotpresent
|
||||
.com.apple.timemachine.supported
|
||||
.DocumentRevisions-V100
|
||||
.DS_Store
|
||||
.fseventsd
|
||||
.MobileBackups
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
].to_set.freeze
|
||||
DMG_METADATA_FILES = Set.new %w[
|
||||
.background
|
||||
.com.apple.timemachine.donotpresent
|
||||
.com.apple.timemachine.supported
|
||||
.DocumentRevisions-V100
|
||||
.DS_Store
|
||||
.fseventsd
|
||||
.MobileBackups
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
].freeze
|
||||
|
||||
def dmg_metadata?(path)
|
||||
relative_root = path.sub(%r{/.*}, "")
|
||||
|
@ -19,63 +19,63 @@ require "hbc/dsl/version"
|
||||
module Hbc
|
||||
class DSL
|
||||
ORDINARY_ARTIFACT_TYPES = [
|
||||
:app,
|
||||
:artifact,
|
||||
:audio_unit_plugin,
|
||||
:binary,
|
||||
:colorpicker,
|
||||
:font,
|
||||
:input_method,
|
||||
:internet_plugin,
|
||||
:pkg,
|
||||
:prefpane,
|
||||
:qlplugin,
|
||||
:screen_saver,
|
||||
:service,
|
||||
:stage_only,
|
||||
:suite,
|
||||
:vst_plugin,
|
||||
:vst3_plugin,
|
||||
].freeze
|
||||
:app,
|
||||
:artifact,
|
||||
:audio_unit_plugin,
|
||||
:binary,
|
||||
:colorpicker,
|
||||
:font,
|
||||
:input_method,
|
||||
:internet_plugin,
|
||||
:pkg,
|
||||
:prefpane,
|
||||
:qlplugin,
|
||||
:screen_saver,
|
||||
:service,
|
||||
:stage_only,
|
||||
:suite,
|
||||
:vst_plugin,
|
||||
:vst3_plugin,
|
||||
].freeze
|
||||
|
||||
ACTIVATABLE_ARTIFACT_TYPES = ([:installer, *ORDINARY_ARTIFACT_TYPES] - [:stage_only]).freeze
|
||||
|
||||
SPECIAL_ARTIFACT_TYPES = [
|
||||
:uninstall,
|
||||
:zap,
|
||||
].freeze
|
||||
:uninstall,
|
||||
:zap,
|
||||
].freeze
|
||||
|
||||
ARTIFACT_BLOCK_TYPES = [
|
||||
:preflight,
|
||||
:postflight,
|
||||
:uninstall_preflight,
|
||||
:uninstall_postflight,
|
||||
].freeze
|
||||
:preflight,
|
||||
:postflight,
|
||||
:uninstall_preflight,
|
||||
:uninstall_postflight,
|
||||
].freeze
|
||||
|
||||
DSL_METHODS = Set.new [
|
||||
:accessibility_access,
|
||||
:appcast,
|
||||
:artifacts,
|
||||
:auto_updates,
|
||||
:caskroom_path,
|
||||
:caveats,
|
||||
:conflicts_with,
|
||||
:container,
|
||||
:depends_on,
|
||||
:gpg,
|
||||
:homepage,
|
||||
:language,
|
||||
:name,
|
||||
:sha256,
|
||||
:staged_path,
|
||||
:url,
|
||||
:version,
|
||||
:appdir,
|
||||
*ORDINARY_ARTIFACT_TYPES,
|
||||
*ACTIVATABLE_ARTIFACT_TYPES,
|
||||
*SPECIAL_ARTIFACT_TYPES,
|
||||
*ARTIFACT_BLOCK_TYPES,
|
||||
].freeze
|
||||
:accessibility_access,
|
||||
:appcast,
|
||||
:artifacts,
|
||||
:auto_updates,
|
||||
:caskroom_path,
|
||||
:caveats,
|
||||
:conflicts_with,
|
||||
:container,
|
||||
:depends_on,
|
||||
:gpg,
|
||||
:homepage,
|
||||
:language,
|
||||
:name,
|
||||
:sha256,
|
||||
:staged_path,
|
||||
:url,
|
||||
:version,
|
||||
:appdir,
|
||||
*ORDINARY_ARTIFACT_TYPES,
|
||||
*ACTIVATABLE_ARTIFACT_TYPES,
|
||||
*SPECIAL_ARTIFACT_TYPES,
|
||||
*ARTIFACT_BLOCK_TYPES,
|
||||
].freeze
|
||||
|
||||
attr_reader :token
|
||||
def initialize(token)
|
||||
@ -183,8 +183,8 @@ module Hbc
|
||||
end
|
||||
|
||||
SYMBOLIC_VERSIONS = Set.new [
|
||||
:latest,
|
||||
]
|
||||
:latest,
|
||||
]
|
||||
|
||||
def version(arg = nil)
|
||||
return @version if arg.nil?
|
||||
@ -194,8 +194,8 @@ module Hbc
|
||||
end
|
||||
|
||||
SYMBOLIC_SHA256S = Set.new [
|
||||
:no_check,
|
||||
]
|
||||
:no_check,
|
||||
]
|
||||
|
||||
def sha256(arg = nil)
|
||||
return @sha256 if arg.nil?
|
||||
|
@ -2,13 +2,13 @@ module Hbc
|
||||
class DSL
|
||||
class ConflictsWith
|
||||
VALID_KEYS = Set.new [
|
||||
:formula,
|
||||
:cask,
|
||||
:macos,
|
||||
:arch,
|
||||
:x11,
|
||||
:java,
|
||||
]
|
||||
:formula,
|
||||
:cask,
|
||||
:macos,
|
||||
:arch,
|
||||
:x11,
|
||||
:java,
|
||||
]
|
||||
|
||||
attr_accessor(*VALID_KEYS)
|
||||
attr_accessor :pairs
|
||||
|
@ -2,9 +2,9 @@ module Hbc
|
||||
class DSL
|
||||
class Container
|
||||
VALID_KEYS = Set.new [
|
||||
:type,
|
||||
:nested,
|
||||
]
|
||||
:type,
|
||||
:nested,
|
||||
]
|
||||
|
||||
attr_accessor(*VALID_KEYS)
|
||||
attr_accessor :pairs
|
||||
|
@ -4,40 +4,40 @@ module Hbc
|
||||
class DSL
|
||||
class DependsOn
|
||||
VALID_KEYS = Set.new [
|
||||
:formula,
|
||||
:cask,
|
||||
:macos,
|
||||
:arch,
|
||||
:x11,
|
||||
:java,
|
||||
].freeze
|
||||
:formula,
|
||||
:cask,
|
||||
:macos,
|
||||
:arch,
|
||||
:x11,
|
||||
:java,
|
||||
].freeze
|
||||
|
||||
VALID_ARCHES = {
|
||||
intel: { type: :intel, bits: [32, 64] },
|
||||
ppc: { type: :ppc, bits: [32, 64] },
|
||||
# specific
|
||||
i386: { type: :intel, bits: 32 },
|
||||
x86_64: { type: :intel, bits: 64 },
|
||||
ppc_7400: { type: :ppc, bits: 32 },
|
||||
ppc_64: { type: :ppc, bits: 64 },
|
||||
}.freeze
|
||||
intel: { type: :intel, bits: [32, 64] },
|
||||
ppc: { type: :ppc, bits: [32, 64] },
|
||||
# specific
|
||||
i386: { type: :intel, bits: 32 },
|
||||
x86_64: { type: :intel, bits: 64 },
|
||||
ppc_7400: { type: :ppc, bits: 32 },
|
||||
ppc_64: { type: :ppc, bits: 64 },
|
||||
}.freeze
|
||||
|
||||
# Intentionally undocumented: catch variant spellings.
|
||||
ARCH_SYNONYMS = {
|
||||
x86_32: :i386,
|
||||
x8632: :i386,
|
||||
x8664: :x86_64,
|
||||
intel_32: :i386,
|
||||
intel32: :i386,
|
||||
intel_64: :x86_64,
|
||||
intel64: :x86_64,
|
||||
amd_64: :x86_64,
|
||||
amd64: :x86_64,
|
||||
ppc7400: :ppc_7400,
|
||||
ppc_32: :ppc_7400,
|
||||
ppc32: :ppc_7400,
|
||||
ppc64: :ppc_64,
|
||||
}.freeze
|
||||
x86_32: :i386,
|
||||
x8632: :i386,
|
||||
x8664: :x86_64,
|
||||
intel_32: :i386,
|
||||
intel32: :i386,
|
||||
intel_64: :x86_64,
|
||||
intel64: :x86_64,
|
||||
amd_64: :x86_64,
|
||||
amd64: :x86_64,
|
||||
ppc7400: :ppc_7400,
|
||||
ppc_32: :ppc_7400,
|
||||
ppc32: :ppc_7400,
|
||||
ppc64: :ppc_64,
|
||||
}.freeze
|
||||
|
||||
attr_accessor :java
|
||||
attr_accessor :pairs
|
||||
|
@ -2,9 +2,9 @@ module Hbc
|
||||
class DSL
|
||||
class Gpg
|
||||
KEY_PARAMETERS = Set.new [
|
||||
:key_id,
|
||||
:key_url,
|
||||
]
|
||||
:key_id,
|
||||
:key_url,
|
||||
]
|
||||
|
||||
VALID_PARAMETERS = Set.new []
|
||||
VALID_PARAMETERS.merge KEY_PARAMETERS
|
||||
|
@ -2,9 +2,9 @@ module Hbc
|
||||
class DSL
|
||||
class Installer
|
||||
VALID_KEYS = Set.new [
|
||||
:manual,
|
||||
:script,
|
||||
]
|
||||
:manual,
|
||||
:script,
|
||||
]
|
||||
|
||||
attr_accessor(*VALID_KEYS)
|
||||
|
||||
|
@ -2,11 +2,11 @@ module Hbc
|
||||
class DSL
|
||||
class Version < ::String
|
||||
DIVIDERS = {
|
||||
"." => :dots,
|
||||
"-" => :hyphens,
|
||||
"_" => :underscores,
|
||||
"/" => :slashes,
|
||||
}.freeze
|
||||
"." => :dots,
|
||||
"-" => :hyphens,
|
||||
"_" => :underscores,
|
||||
"/" => :slashes,
|
||||
}.freeze
|
||||
|
||||
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/
|
||||
|
||||
|
@ -232,16 +232,16 @@ module Hbc
|
||||
elsif MacOS.version <= :yosemite
|
||||
@command.run!("/usr/bin/sqlite3",
|
||||
args: [
|
||||
Hbc.tcc_db,
|
||||
"INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL);",
|
||||
],
|
||||
Hbc.tcc_db,
|
||||
"INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL);",
|
||||
],
|
||||
sudo: true)
|
||||
elsif MacOS.version <= :el_capitan
|
||||
@command.run!("/usr/bin/sqlite3",
|
||||
args: [
|
||||
Hbc.tcc_db,
|
||||
"INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL,NULL);",
|
||||
],
|
||||
Hbc.tcc_db,
|
||||
"INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL,NULL);",
|
||||
],
|
||||
sudo: true)
|
||||
else
|
||||
opoo <<-EOS.undent
|
||||
@ -257,9 +257,9 @@ module Hbc
|
||||
ohai "Disabling accessibility access"
|
||||
@command.run!("/usr/bin/sqlite3",
|
||||
args: [
|
||||
Hbc.tcc_db,
|
||||
"DELETE FROM access WHERE client='#{bundle_identifier}';",
|
||||
],
|
||||
Hbc.tcc_db,
|
||||
"DELETE FROM access WHERE client='#{bundle_identifier}';",
|
||||
],
|
||||
sudo: true)
|
||||
else
|
||||
opoo <<-EOS.undent
|
||||
|
@ -7,231 +7,231 @@ module OS
|
||||
module_function
|
||||
|
||||
SYSTEM_DIRS = [
|
||||
"/",
|
||||
"/Applications",
|
||||
"/Applications/Utilities",
|
||||
"/Incompatible Software",
|
||||
"/Library",
|
||||
"/Library/Application Support",
|
||||
"/Library/Audio",
|
||||
"/Library/Caches",
|
||||
"/Library/ColorPickers",
|
||||
"/Library/ColorSync",
|
||||
"/Library/Components",
|
||||
"/Library/Compositions",
|
||||
"/Library/Contextual Menu Items",
|
||||
"/Library/CoreMediaIO",
|
||||
"/Library/Desktop Pictures",
|
||||
"/Library/Developer",
|
||||
"/Library/Dictionaries",
|
||||
"/Library/DirectoryServices",
|
||||
"/Library/Documentation",
|
||||
"/Library/Extensions",
|
||||
"/Library/Filesystems",
|
||||
"/Library/Fonts",
|
||||
"/Library/Frameworks",
|
||||
"/Library/Graphics",
|
||||
"/Library/Image Capture",
|
||||
"/Library/Input Methods",
|
||||
"/Library/Internet Plug-Ins",
|
||||
"/Library/Java",
|
||||
"/Library/Keyboard Layouts",
|
||||
"/Library/Keychains",
|
||||
"/Library/LaunchAgents",
|
||||
"/Library/LaunchDaemons",
|
||||
"/Library/Logs",
|
||||
"/Library/Messages",
|
||||
"/Library/Modem Scripts",
|
||||
"/Library/OpenDirectory",
|
||||
"/Library/PDF Services",
|
||||
"/Library/Perl",
|
||||
"/Library/PreferencePanes",
|
||||
"/Library/Preferences",
|
||||
"/Library/Printers",
|
||||
"/Library/PrivilegedHelperTools",
|
||||
"/Library/Python",
|
||||
"/Library/QuickLook",
|
||||
"/Library/QuickTime",
|
||||
"/Library/Receipts",
|
||||
"/Library/Ruby",
|
||||
"/Library/Sandbox",
|
||||
"/Library/Screen Savers",
|
||||
"/Library/ScriptingAdditions",
|
||||
"/Library/Scripts",
|
||||
"/Library/Security",
|
||||
"/Library/Speech",
|
||||
"/Library/Spelling",
|
||||
"/Library/Spotlight",
|
||||
"/Library/StartupItems",
|
||||
"/Library/SystemProfiler",
|
||||
"/Library/Updates",
|
||||
"/Library/User Pictures",
|
||||
"/Library/Video",
|
||||
"/Library/WebServer",
|
||||
"/Library/Widgets",
|
||||
"/Library/iTunes",
|
||||
"/Network",
|
||||
"/System",
|
||||
"/System/Library",
|
||||
"/System/Library/Accessibility",
|
||||
"/System/Library/Accounts",
|
||||
"/System/Library/Address Book Plug-Ins",
|
||||
"/System/Library/Assistant",
|
||||
"/System/Library/Automator",
|
||||
"/System/Library/BridgeSupport",
|
||||
"/System/Library/Caches",
|
||||
"/System/Library/ColorPickers",
|
||||
"/System/Library/ColorSync",
|
||||
"/System/Library/Colors",
|
||||
"/System/Library/Components",
|
||||
"/System/Library/Compositions",
|
||||
"/System/Library/CoreServices",
|
||||
"/System/Library/DTDs",
|
||||
"/System/Library/DirectoryServices",
|
||||
"/System/Library/Displays",
|
||||
"/System/Library/Extensions",
|
||||
"/System/Library/Filesystems",
|
||||
"/System/Library/Filters",
|
||||
"/System/Library/Fonts",
|
||||
"/System/Library/Frameworks",
|
||||
"/System/Library/Graphics",
|
||||
"/System/Library/IdentityServices",
|
||||
"/System/Library/Image Capture",
|
||||
"/System/Library/Input Methods",
|
||||
"/System/Library/InternetAccounts",
|
||||
"/System/Library/Java",
|
||||
"/System/Library/KerberosPlugins",
|
||||
"/System/Library/Keyboard Layouts",
|
||||
"/System/Library/Keychains",
|
||||
"/System/Library/LaunchAgents",
|
||||
"/System/Library/LaunchDaemons",
|
||||
"/System/Library/LinguisticData",
|
||||
"/System/Library/LocationBundles",
|
||||
"/System/Library/LoginPlugins",
|
||||
"/System/Library/Messages",
|
||||
"/System/Library/Metadata",
|
||||
"/System/Library/MonitorPanels",
|
||||
"/System/Library/OpenDirectory",
|
||||
"/System/Library/OpenSSL",
|
||||
"/System/Library/Password Server Filters",
|
||||
"/System/Library/PerformanceMetrics",
|
||||
"/System/Library/Perl",
|
||||
"/System/Library/PreferencePanes",
|
||||
"/System/Library/Printers",
|
||||
"/System/Library/PrivateFrameworks",
|
||||
"/System/Library/QuickLook",
|
||||
"/System/Library/QuickTime",
|
||||
"/System/Library/QuickTimeJava",
|
||||
"/System/Library/Recents",
|
||||
"/System/Library/SDKSettingsPlist",
|
||||
"/System/Library/Sandbox",
|
||||
"/System/Library/Screen Savers",
|
||||
"/System/Library/ScreenReader",
|
||||
"/System/Library/ScriptingAdditions",
|
||||
"/System/Library/ScriptingDefinitions",
|
||||
"/System/Library/Security",
|
||||
"/System/Library/Services",
|
||||
"/System/Library/Sounds",
|
||||
"/System/Library/Speech",
|
||||
"/System/Library/Spelling",
|
||||
"/System/Library/Spotlight",
|
||||
"/System/Library/StartupItems",
|
||||
"/System/Library/SyncServices",
|
||||
"/System/Library/SystemConfiguration",
|
||||
"/System/Library/SystemProfiler",
|
||||
"/System/Library/Tcl",
|
||||
"/System/Library/TextEncodings",
|
||||
"/System/Library/User Template",
|
||||
"/System/Library/UserEventPlugins",
|
||||
"/System/Library/Video",
|
||||
"/System/Library/WidgetResources",
|
||||
"/User Information",
|
||||
"/Users",
|
||||
"/Volumes",
|
||||
"/bin",
|
||||
"/boot",
|
||||
"/cores",
|
||||
"/dev",
|
||||
"/etc",
|
||||
"/etc/X11",
|
||||
"/etc/opt",
|
||||
"/etc/sgml",
|
||||
"/etc/xml",
|
||||
"/home",
|
||||
"/libexec",
|
||||
"/lost+found",
|
||||
"/media",
|
||||
"/mnt",
|
||||
"/net",
|
||||
"/opt",
|
||||
"/private",
|
||||
"/private/etc",
|
||||
"/private/tftpboot",
|
||||
"/private/tmp",
|
||||
"/private/var",
|
||||
"/proc",
|
||||
"/root",
|
||||
"/sbin",
|
||||
"/srv",
|
||||
"/tmp",
|
||||
"/usr",
|
||||
"/usr/X11R6",
|
||||
"/usr/bin",
|
||||
"/usr/etc",
|
||||
"/usr/include",
|
||||
"/usr/lib",
|
||||
"/usr/libexec",
|
||||
"/usr/local",
|
||||
"/usr/local/Cellar",
|
||||
"/usr/local/Frameworks",
|
||||
"/usr/local/Library",
|
||||
"/usr/local/bin",
|
||||
"/usr/local/etc",
|
||||
"/usr/local/include",
|
||||
"/usr/local/lib",
|
||||
"/usr/local/libexec",
|
||||
"/usr/local/opt",
|
||||
"/usr/local/share",
|
||||
"/usr/local/share/man",
|
||||
"/usr/local/share/man/man1",
|
||||
"/usr/local/share/man/man2",
|
||||
"/usr/local/share/man/man3",
|
||||
"/usr/local/share/man/man4",
|
||||
"/usr/local/share/man/man5",
|
||||
"/usr/local/share/man/man6",
|
||||
"/usr/local/share/man/man7",
|
||||
"/usr/local/share/man/man8",
|
||||
"/usr/local/share/man/man9",
|
||||
"/usr/local/share/man/mann",
|
||||
"/usr/local/var",
|
||||
"/usr/local/var/lib",
|
||||
"/usr/local/var/lock",
|
||||
"/usr/local/var/run",
|
||||
"/usr/sbin",
|
||||
"/usr/share",
|
||||
"/usr/share/man",
|
||||
"/usr/share/man/man1",
|
||||
"/usr/share/man/man2",
|
||||
"/usr/share/man/man3",
|
||||
"/usr/share/man/man4",
|
||||
"/usr/share/man/man5",
|
||||
"/usr/share/man/man6",
|
||||
"/usr/share/man/man7",
|
||||
"/usr/share/man/man8",
|
||||
"/usr/share/man/man9",
|
||||
"/usr/share/man/mann",
|
||||
"/usr/src",
|
||||
"/var",
|
||||
"/var/cache",
|
||||
"/var/lib",
|
||||
"/var/lock",
|
||||
"/var/log",
|
||||
"/var/mail",
|
||||
"/var/run",
|
||||
"/var/spool",
|
||||
"/var/spool/mail",
|
||||
"/var/tmp",
|
||||
]
|
||||
"/",
|
||||
"/Applications",
|
||||
"/Applications/Utilities",
|
||||
"/Incompatible Software",
|
||||
"/Library",
|
||||
"/Library/Application Support",
|
||||
"/Library/Audio",
|
||||
"/Library/Caches",
|
||||
"/Library/ColorPickers",
|
||||
"/Library/ColorSync",
|
||||
"/Library/Components",
|
||||
"/Library/Compositions",
|
||||
"/Library/Contextual Menu Items",
|
||||
"/Library/CoreMediaIO",
|
||||
"/Library/Desktop Pictures",
|
||||
"/Library/Developer",
|
||||
"/Library/Dictionaries",
|
||||
"/Library/DirectoryServices",
|
||||
"/Library/Documentation",
|
||||
"/Library/Extensions",
|
||||
"/Library/Filesystems",
|
||||
"/Library/Fonts",
|
||||
"/Library/Frameworks",
|
||||
"/Library/Graphics",
|
||||
"/Library/Image Capture",
|
||||
"/Library/Input Methods",
|
||||
"/Library/Internet Plug-Ins",
|
||||
"/Library/Java",
|
||||
"/Library/Keyboard Layouts",
|
||||
"/Library/Keychains",
|
||||
"/Library/LaunchAgents",
|
||||
"/Library/LaunchDaemons",
|
||||
"/Library/Logs",
|
||||
"/Library/Messages",
|
||||
"/Library/Modem Scripts",
|
||||
"/Library/OpenDirectory",
|
||||
"/Library/PDF Services",
|
||||
"/Library/Perl",
|
||||
"/Library/PreferencePanes",
|
||||
"/Library/Preferences",
|
||||
"/Library/Printers",
|
||||
"/Library/PrivilegedHelperTools",
|
||||
"/Library/Python",
|
||||
"/Library/QuickLook",
|
||||
"/Library/QuickTime",
|
||||
"/Library/Receipts",
|
||||
"/Library/Ruby",
|
||||
"/Library/Sandbox",
|
||||
"/Library/Screen Savers",
|
||||
"/Library/ScriptingAdditions",
|
||||
"/Library/Scripts",
|
||||
"/Library/Security",
|
||||
"/Library/Speech",
|
||||
"/Library/Spelling",
|
||||
"/Library/Spotlight",
|
||||
"/Library/StartupItems",
|
||||
"/Library/SystemProfiler",
|
||||
"/Library/Updates",
|
||||
"/Library/User Pictures",
|
||||
"/Library/Video",
|
||||
"/Library/WebServer",
|
||||
"/Library/Widgets",
|
||||
"/Library/iTunes",
|
||||
"/Network",
|
||||
"/System",
|
||||
"/System/Library",
|
||||
"/System/Library/Accessibility",
|
||||
"/System/Library/Accounts",
|
||||
"/System/Library/Address Book Plug-Ins",
|
||||
"/System/Library/Assistant",
|
||||
"/System/Library/Automator",
|
||||
"/System/Library/BridgeSupport",
|
||||
"/System/Library/Caches",
|
||||
"/System/Library/ColorPickers",
|
||||
"/System/Library/ColorSync",
|
||||
"/System/Library/Colors",
|
||||
"/System/Library/Components",
|
||||
"/System/Library/Compositions",
|
||||
"/System/Library/CoreServices",
|
||||
"/System/Library/DTDs",
|
||||
"/System/Library/DirectoryServices",
|
||||
"/System/Library/Displays",
|
||||
"/System/Library/Extensions",
|
||||
"/System/Library/Filesystems",
|
||||
"/System/Library/Filters",
|
||||
"/System/Library/Fonts",
|
||||
"/System/Library/Frameworks",
|
||||
"/System/Library/Graphics",
|
||||
"/System/Library/IdentityServices",
|
||||
"/System/Library/Image Capture",
|
||||
"/System/Library/Input Methods",
|
||||
"/System/Library/InternetAccounts",
|
||||
"/System/Library/Java",
|
||||
"/System/Library/KerberosPlugins",
|
||||
"/System/Library/Keyboard Layouts",
|
||||
"/System/Library/Keychains",
|
||||
"/System/Library/LaunchAgents",
|
||||
"/System/Library/LaunchDaemons",
|
||||
"/System/Library/LinguisticData",
|
||||
"/System/Library/LocationBundles",
|
||||
"/System/Library/LoginPlugins",
|
||||
"/System/Library/Messages",
|
||||
"/System/Library/Metadata",
|
||||
"/System/Library/MonitorPanels",
|
||||
"/System/Library/OpenDirectory",
|
||||
"/System/Library/OpenSSL",
|
||||
"/System/Library/Password Server Filters",
|
||||
"/System/Library/PerformanceMetrics",
|
||||
"/System/Library/Perl",
|
||||
"/System/Library/PreferencePanes",
|
||||
"/System/Library/Printers",
|
||||
"/System/Library/PrivateFrameworks",
|
||||
"/System/Library/QuickLook",
|
||||
"/System/Library/QuickTime",
|
||||
"/System/Library/QuickTimeJava",
|
||||
"/System/Library/Recents",
|
||||
"/System/Library/SDKSettingsPlist",
|
||||
"/System/Library/Sandbox",
|
||||
"/System/Library/Screen Savers",
|
||||
"/System/Library/ScreenReader",
|
||||
"/System/Library/ScriptingAdditions",
|
||||
"/System/Library/ScriptingDefinitions",
|
||||
"/System/Library/Security",
|
||||
"/System/Library/Services",
|
||||
"/System/Library/Sounds",
|
||||
"/System/Library/Speech",
|
||||
"/System/Library/Spelling",
|
||||
"/System/Library/Spotlight",
|
||||
"/System/Library/StartupItems",
|
||||
"/System/Library/SyncServices",
|
||||
"/System/Library/SystemConfiguration",
|
||||
"/System/Library/SystemProfiler",
|
||||
"/System/Library/Tcl",
|
||||
"/System/Library/TextEncodings",
|
||||
"/System/Library/User Template",
|
||||
"/System/Library/UserEventPlugins",
|
||||
"/System/Library/Video",
|
||||
"/System/Library/WidgetResources",
|
||||
"/User Information",
|
||||
"/Users",
|
||||
"/Volumes",
|
||||
"/bin",
|
||||
"/boot",
|
||||
"/cores",
|
||||
"/dev",
|
||||
"/etc",
|
||||
"/etc/X11",
|
||||
"/etc/opt",
|
||||
"/etc/sgml",
|
||||
"/etc/xml",
|
||||
"/home",
|
||||
"/libexec",
|
||||
"/lost+found",
|
||||
"/media",
|
||||
"/mnt",
|
||||
"/net",
|
||||
"/opt",
|
||||
"/private",
|
||||
"/private/etc",
|
||||
"/private/tftpboot",
|
||||
"/private/tmp",
|
||||
"/private/var",
|
||||
"/proc",
|
||||
"/root",
|
||||
"/sbin",
|
||||
"/srv",
|
||||
"/tmp",
|
||||
"/usr",
|
||||
"/usr/X11R6",
|
||||
"/usr/bin",
|
||||
"/usr/etc",
|
||||
"/usr/include",
|
||||
"/usr/lib",
|
||||
"/usr/libexec",
|
||||
"/usr/local",
|
||||
"/usr/local/Cellar",
|
||||
"/usr/local/Frameworks",
|
||||
"/usr/local/Library",
|
||||
"/usr/local/bin",
|
||||
"/usr/local/etc",
|
||||
"/usr/local/include",
|
||||
"/usr/local/lib",
|
||||
"/usr/local/libexec",
|
||||
"/usr/local/opt",
|
||||
"/usr/local/share",
|
||||
"/usr/local/share/man",
|
||||
"/usr/local/share/man/man1",
|
||||
"/usr/local/share/man/man2",
|
||||
"/usr/local/share/man/man3",
|
||||
"/usr/local/share/man/man4",
|
||||
"/usr/local/share/man/man5",
|
||||
"/usr/local/share/man/man6",
|
||||
"/usr/local/share/man/man7",
|
||||
"/usr/local/share/man/man8",
|
||||
"/usr/local/share/man/man9",
|
||||
"/usr/local/share/man/mann",
|
||||
"/usr/local/var",
|
||||
"/usr/local/var/lib",
|
||||
"/usr/local/var/lock",
|
||||
"/usr/local/var/run",
|
||||
"/usr/sbin",
|
||||
"/usr/share",
|
||||
"/usr/share/man",
|
||||
"/usr/share/man/man1",
|
||||
"/usr/share/man/man2",
|
||||
"/usr/share/man/man3",
|
||||
"/usr/share/man/man4",
|
||||
"/usr/share/man/man5",
|
||||
"/usr/share/man/man6",
|
||||
"/usr/share/man/man7",
|
||||
"/usr/share/man/man8",
|
||||
"/usr/share/man/man9",
|
||||
"/usr/share/man/mann",
|
||||
"/usr/src",
|
||||
"/var",
|
||||
"/var/cache",
|
||||
"/var/lib",
|
||||
"/var/lock",
|
||||
"/var/log",
|
||||
"/var/mail",
|
||||
"/var/run",
|
||||
"/var/spool",
|
||||
"/var/spool/mail",
|
||||
"/var/tmp",
|
||||
]
|
||||
.map(&method(:Pathname))
|
||||
.to_set
|
||||
.freeze
|
||||
@ -239,131 +239,131 @@ module OS
|
||||
# TODO: There should be a way to specify a containing
|
||||
# directory under which nothing can be deleted.
|
||||
UNDELETABLE_DIRS = [
|
||||
"~/",
|
||||
"~/Applications",
|
||||
"~/Desktop",
|
||||
"~/Documents",
|
||||
"~/Downloads",
|
||||
"~/Mail",
|
||||
"~/Movies",
|
||||
"~/Music",
|
||||
"~/Music/iTunes",
|
||||
"~/Music/iTunes/iTunes Music",
|
||||
"~/Music/iTunes/Album Artwork",
|
||||
"~/News",
|
||||
"~/Pictures",
|
||||
"~/Pictures/Desktops",
|
||||
"~/Pictures/Photo Booth",
|
||||
"~/Pictures/iChat Icons",
|
||||
"~/Pictures/iPhoto Library",
|
||||
"~/Public",
|
||||
"~/Sites",
|
||||
"~/Library",
|
||||
"~/Library/.localized",
|
||||
"~/Library/Accessibility",
|
||||
"~/Library/Accounts",
|
||||
"~/Library/Address Book Plug-Ins",
|
||||
"~/Library/Application Scripts",
|
||||
"~/Library/Application Support",
|
||||
"~/Library/Application Support/Apple",
|
||||
"~/Library/Application Support/com.apple.AssistiveControl",
|
||||
"~/Library/Application Support/com.apple.QuickLook",
|
||||
"~/Library/Application Support/com.apple.TCC",
|
||||
"~/Library/Assistants",
|
||||
"~/Library/Audio",
|
||||
"~/Library/Automator",
|
||||
"~/Library/Autosave Information",
|
||||
"~/Library/Caches",
|
||||
"~/Library/Calendars",
|
||||
"~/Library/ColorPickers",
|
||||
"~/Library/ColorSync",
|
||||
"~/Library/Colors",
|
||||
"~/Library/Components",
|
||||
"~/Library/Compositions",
|
||||
"~/Library/Containers",
|
||||
"~/Library/Contextual Menu Items",
|
||||
"~/Library/Cookies",
|
||||
"~/Library/DTDs",
|
||||
"~/Library/Desktop Pictures",
|
||||
"~/Library/Developer",
|
||||
"~/Library/Dictionaries",
|
||||
"~/Library/DirectoryServices",
|
||||
"~/Library/Displays",
|
||||
"~/Library/Documentation",
|
||||
"~/Library/Extensions",
|
||||
"~/Library/Favorites",
|
||||
"~/Library/FileSync",
|
||||
"~/Library/Filesystems",
|
||||
"~/Library/Filters",
|
||||
"~/Library/FontCollections",
|
||||
"~/Library/Fonts",
|
||||
"~/Library/Frameworks",
|
||||
"~/Library/GameKit",
|
||||
"~/Library/Graphics",
|
||||
"~/Library/Group Containers",
|
||||
"~/Library/Icons",
|
||||
"~/Library/IdentityServices",
|
||||
"~/Library/Image Capture",
|
||||
"~/Library/Images",
|
||||
"~/Library/Input Methods",
|
||||
"~/Library/Internet Plug-Ins",
|
||||
"~/Library/InternetAccounts",
|
||||
"~/Library/iTunes",
|
||||
"~/Library/KeyBindings",
|
||||
"~/Library/Keyboard Layouts",
|
||||
"~/Library/Keychains",
|
||||
"~/Library/LaunchAgents",
|
||||
"~/Library/LaunchDaemons",
|
||||
"~/Library/LocationBundles",
|
||||
"~/Library/LoginPlugins",
|
||||
"~/Library/Logs",
|
||||
"~/Library/Mail",
|
||||
"~/Library/Mail Downloads",
|
||||
"~/Library/Messages",
|
||||
"~/Library/Metadata",
|
||||
"~/Library/Mobile Documents",
|
||||
"~/Library/MonitorPanels",
|
||||
"~/Library/OpenDirectory",
|
||||
"~/Library/PDF Services",
|
||||
"~/Library/PhonePlugins",
|
||||
"~/Library/Phones",
|
||||
"~/Library/PreferencePanes",
|
||||
"~/Library/Preferences",
|
||||
"~/Library/Printers",
|
||||
"~/Library/PrivateFrameworks",
|
||||
"~/Library/PubSub",
|
||||
"~/Library/QuickLook",
|
||||
"~/Library/QuickTime",
|
||||
"~/Library/Receipts",
|
||||
"~/Library/Recent Servers",
|
||||
"~/Library/Recents",
|
||||
"~/Library/Safari",
|
||||
"~/Library/Saved Application State",
|
||||
"~/Library/Screen Savers",
|
||||
"~/Library/ScreenReader",
|
||||
"~/Library/ScriptingAdditions",
|
||||
"~/Library/ScriptingDefinitions",
|
||||
"~/Library/Scripts",
|
||||
"~/Library/Security",
|
||||
"~/Library/Services",
|
||||
"~/Library/Sounds",
|
||||
"~/Library/Speech",
|
||||
"~/Library/Spelling",
|
||||
"~/Library/Spotlight",
|
||||
"~/Library/StartupItems",
|
||||
"~/Library/StickiesDatabase",
|
||||
"~/Library/Sync Services",
|
||||
"~/Library/SyncServices",
|
||||
"~/Library/SyncedPreferences",
|
||||
"~/Library/TextEncodings",
|
||||
"~/Library/User Pictures",
|
||||
"~/Library/Video",
|
||||
"~/Library/Voices",
|
||||
"~/Library/WebKit",
|
||||
"~/Library/WidgetResources",
|
||||
"~/Library/Widgets",
|
||||
"~/Library/Workflows",
|
||||
]
|
||||
"~/",
|
||||
"~/Applications",
|
||||
"~/Desktop",
|
||||
"~/Documents",
|
||||
"~/Downloads",
|
||||
"~/Mail",
|
||||
"~/Movies",
|
||||
"~/Music",
|
||||
"~/Music/iTunes",
|
||||
"~/Music/iTunes/iTunes Music",
|
||||
"~/Music/iTunes/Album Artwork",
|
||||
"~/News",
|
||||
"~/Pictures",
|
||||
"~/Pictures/Desktops",
|
||||
"~/Pictures/Photo Booth",
|
||||
"~/Pictures/iChat Icons",
|
||||
"~/Pictures/iPhoto Library",
|
||||
"~/Public",
|
||||
"~/Sites",
|
||||
"~/Library",
|
||||
"~/Library/.localized",
|
||||
"~/Library/Accessibility",
|
||||
"~/Library/Accounts",
|
||||
"~/Library/Address Book Plug-Ins",
|
||||
"~/Library/Application Scripts",
|
||||
"~/Library/Application Support",
|
||||
"~/Library/Application Support/Apple",
|
||||
"~/Library/Application Support/com.apple.AssistiveControl",
|
||||
"~/Library/Application Support/com.apple.QuickLook",
|
||||
"~/Library/Application Support/com.apple.TCC",
|
||||
"~/Library/Assistants",
|
||||
"~/Library/Audio",
|
||||
"~/Library/Automator",
|
||||
"~/Library/Autosave Information",
|
||||
"~/Library/Caches",
|
||||
"~/Library/Calendars",
|
||||
"~/Library/ColorPickers",
|
||||
"~/Library/ColorSync",
|
||||
"~/Library/Colors",
|
||||
"~/Library/Components",
|
||||
"~/Library/Compositions",
|
||||
"~/Library/Containers",
|
||||
"~/Library/Contextual Menu Items",
|
||||
"~/Library/Cookies",
|
||||
"~/Library/DTDs",
|
||||
"~/Library/Desktop Pictures",
|
||||
"~/Library/Developer",
|
||||
"~/Library/Dictionaries",
|
||||
"~/Library/DirectoryServices",
|
||||
"~/Library/Displays",
|
||||
"~/Library/Documentation",
|
||||
"~/Library/Extensions",
|
||||
"~/Library/Favorites",
|
||||
"~/Library/FileSync",
|
||||
"~/Library/Filesystems",
|
||||
"~/Library/Filters",
|
||||
"~/Library/FontCollections",
|
||||
"~/Library/Fonts",
|
||||
"~/Library/Frameworks",
|
||||
"~/Library/GameKit",
|
||||
"~/Library/Graphics",
|
||||
"~/Library/Group Containers",
|
||||
"~/Library/Icons",
|
||||
"~/Library/IdentityServices",
|
||||
"~/Library/Image Capture",
|
||||
"~/Library/Images",
|
||||
"~/Library/Input Methods",
|
||||
"~/Library/Internet Plug-Ins",
|
||||
"~/Library/InternetAccounts",
|
||||
"~/Library/iTunes",
|
||||
"~/Library/KeyBindings",
|
||||
"~/Library/Keyboard Layouts",
|
||||
"~/Library/Keychains",
|
||||
"~/Library/LaunchAgents",
|
||||
"~/Library/LaunchDaemons",
|
||||
"~/Library/LocationBundles",
|
||||
"~/Library/LoginPlugins",
|
||||
"~/Library/Logs",
|
||||
"~/Library/Mail",
|
||||
"~/Library/Mail Downloads",
|
||||
"~/Library/Messages",
|
||||
"~/Library/Metadata",
|
||||
"~/Library/Mobile Documents",
|
||||
"~/Library/MonitorPanels",
|
||||
"~/Library/OpenDirectory",
|
||||
"~/Library/PDF Services",
|
||||
"~/Library/PhonePlugins",
|
||||
"~/Library/Phones",
|
||||
"~/Library/PreferencePanes",
|
||||
"~/Library/Preferences",
|
||||
"~/Library/Printers",
|
||||
"~/Library/PrivateFrameworks",
|
||||
"~/Library/PubSub",
|
||||
"~/Library/QuickLook",
|
||||
"~/Library/QuickTime",
|
||||
"~/Library/Receipts",
|
||||
"~/Library/Recent Servers",
|
||||
"~/Library/Recents",
|
||||
"~/Library/Safari",
|
||||
"~/Library/Saved Application State",
|
||||
"~/Library/Screen Savers",
|
||||
"~/Library/ScreenReader",
|
||||
"~/Library/ScriptingAdditions",
|
||||
"~/Library/ScriptingDefinitions",
|
||||
"~/Library/Scripts",
|
||||
"~/Library/Security",
|
||||
"~/Library/Services",
|
||||
"~/Library/Sounds",
|
||||
"~/Library/Speech",
|
||||
"~/Library/Spelling",
|
||||
"~/Library/Spotlight",
|
||||
"~/Library/StartupItems",
|
||||
"~/Library/StickiesDatabase",
|
||||
"~/Library/Sync Services",
|
||||
"~/Library/SyncServices",
|
||||
"~/Library/SyncedPreferences",
|
||||
"~/Library/TextEncodings",
|
||||
"~/Library/User Pictures",
|
||||
"~/Library/Video",
|
||||
"~/Library/Voices",
|
||||
"~/Library/WebKit",
|
||||
"~/Library/WidgetResources",
|
||||
"~/Library/Widgets",
|
||||
"~/Library/Workflows",
|
||||
]
|
||||
.map { |x| Pathname(x.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
|
||||
.to_set
|
||||
.union(SYSTEM_DIRS)
|
||||
|
@ -23,16 +23,16 @@ module Hbc
|
||||
end
|
||||
|
||||
HTTP_RESPONSES = [
|
||||
"HTTP/1.0 200 OK",
|
||||
"HTTP/1.1 200 OK",
|
||||
"HTTP/1.1 302 Found",
|
||||
].freeze
|
||||
"HTTP/1.0 200 OK",
|
||||
"HTTP/1.1 200 OK",
|
||||
"HTTP/1.1 302 Found",
|
||||
].freeze
|
||||
|
||||
OK_RESPONSES = {
|
||||
"http" => HTTP_RESPONSES,
|
||||
"https" => HTTP_RESPONSES,
|
||||
"ftp" => ["OK"],
|
||||
}.freeze
|
||||
"http" => HTTP_RESPONSES,
|
||||
"https" => HTTP_RESPONSES,
|
||||
"ftp" => ["OK"],
|
||||
}.freeze
|
||||
|
||||
def _check_response_status
|
||||
ok = OK_RESPONSES[cask.url.scheme]
|
||||
|
@ -13,9 +13,9 @@ describe Hbc::CLI::Cleanup do
|
||||
cleaned_up_cached_download = "caffeine"
|
||||
|
||||
cached_downloads = [
|
||||
cache_location.join("#{cleaned_up_cached_download}--latest.zip"),
|
||||
cache_location.join("transmission--2.61.dmg"),
|
||||
]
|
||||
cache_location.join("#{cleaned_up_cached_download}--latest.zip"),
|
||||
cache_location.join("transmission--2.61.dmg"),
|
||||
]
|
||||
|
||||
cached_downloads.each(&FileUtils.method(:touch))
|
||||
|
||||
|
@ -68,9 +68,9 @@ describe "download strategies" do
|
||||
let(:url_options) {
|
||||
{
|
||||
cookies: {
|
||||
coo: "kie",
|
||||
mon: "ster",
|
||||
},
|
||||
coo: "kie",
|
||||
mon: "ster",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,9 +114,9 @@ describe "download strategies" do
|
||||
{
|
||||
using: :post,
|
||||
data: {
|
||||
form: "data",
|
||||
is: "good",
|
||||
},
|
||||
form: "data",
|
||||
is: "good",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,13 +190,13 @@ describe "download strategies" do
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/svn",
|
||||
hash_including(args: [
|
||||
"checkout",
|
||||
"--force",
|
||||
"--config-option",
|
||||
"config:miscellany:use-commit-times=yes",
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
])
|
||||
"checkout",
|
||||
"--force",
|
||||
"--config-option",
|
||||
"config:miscellany:use-commit-times=yes",
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
])
|
||||
)
|
||||
end
|
||||
|
||||
@ -218,15 +218,15 @@ describe "download strategies" do
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/svn",
|
||||
hash_including(args: [
|
||||
"checkout",
|
||||
"--force",
|
||||
"--config-option",
|
||||
"config:miscellany:use-commit-times=yes",
|
||||
"--trust-server-cert",
|
||||
"--non-interactive",
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
])
|
||||
"checkout",
|
||||
"--force",
|
||||
"--config-option",
|
||||
"config:miscellany:use-commit-times=yes",
|
||||
"--trust-server-cert",
|
||||
"--non-interactive",
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
])
|
||||
)
|
||||
end
|
||||
end
|
||||
@ -249,15 +249,15 @@ describe "download strategies" do
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/svn",
|
||||
hash_including(args: [
|
||||
"checkout",
|
||||
"--force",
|
||||
"--config-option",
|
||||
"config:miscellany:use-commit-times=yes",
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
"-r",
|
||||
"10",
|
||||
])
|
||||
"checkout",
|
||||
"--force",
|
||||
"--config-option",
|
||||
"config:miscellany:use-commit-times=yes",
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
"-r",
|
||||
"10",
|
||||
])
|
||||
)
|
||||
end
|
||||
end
|
||||
@ -276,14 +276,14 @@ describe "download strategies" do
|
||||
expect(fake_system_command).to have_received(:run!).with(
|
||||
"/usr/bin/tar",
|
||||
hash_including(args: [
|
||||
'-s/^\\.//',
|
||||
"--exclude",
|
||||
".svn",
|
||||
"-cf",
|
||||
downloader.tarball_path,
|
||||
"--",
|
||||
".",
|
||||
])
|
||||
'-s/^\\.//',
|
||||
"--exclude",
|
||||
".svn",
|
||||
"-cf",
|
||||
downloader.tarball_path,
|
||||
"--",
|
||||
".",
|
||||
])
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -49,9 +49,9 @@ describe Hbc::SystemCommand do
|
||||
let(:command) { "/bin/bash" }
|
||||
let(:options) {
|
||||
{ args: [
|
||||
"-c",
|
||||
"for i in $(seq 1 2 5); do echo $i; echo $(($i + 1)) >&2; done",
|
||||
] }
|
||||
"-c",
|
||||
"for i in $(seq 1 2 5); do echo $i; echo $(($i + 1)) >&2; done",
|
||||
] }
|
||||
}
|
||||
|
||||
shared_examples "it returns '1 2 3 4 5 6'" do
|
||||
@ -125,9 +125,9 @@ describe Hbc::SystemCommand do
|
||||
let(:command) { "/bin/bash" }
|
||||
let(:options) {
|
||||
{ args: [
|
||||
"-c",
|
||||
"for i in $(seq 1 2 100000); do echo $i; echo $(($i + 1)) >&2; done",
|
||||
] }
|
||||
"-c",
|
||||
"for i in $(seq 1 2 100000); do echo $i; echo $(($i + 1)) >&2; done",
|
||||
] }
|
||||
}
|
||||
|
||||
it "returns without deadlocking" do
|
||||
|
@ -11,7 +11,7 @@ describe Locale do
|
||||
|
||||
context "raises a ParserError when given" do
|
||||
it "an empty string" do
|
||||
expect{ described_class.parse("") }.to raise_error(Locale::ParserError)
|
||||
expect { described_class.parse("") }.to raise_error(Locale::ParserError)
|
||||
end
|
||||
|
||||
it "a string in a wrong format" do
|
||||
|
@ -34,8 +34,8 @@ describe Hbc::CLI::Create do
|
||||
it "opens the editor for the specified Cask" do
|
||||
Hbc::CLI::Create.run("new-cask")
|
||||
Hbc::CLI::Create.editor_commands.must_equal [
|
||||
[Hbc.path("new-cask")],
|
||||
]
|
||||
[Hbc.path("new-cask")],
|
||||
]
|
||||
end
|
||||
|
||||
it "drops a template down for the specified Cask" do
|
||||
@ -58,15 +58,15 @@ describe Hbc::CLI::Create do
|
||||
it "throws away additional Cask arguments and uses the first" do
|
||||
Hbc::CLI::Create.run("additional-cask", "another-cask")
|
||||
Hbc::CLI::Create.editor_commands.must_equal [
|
||||
[Hbc.path("additional-cask")],
|
||||
]
|
||||
[Hbc.path("additional-cask")],
|
||||
]
|
||||
end
|
||||
|
||||
it "throws away stray options" do
|
||||
Hbc::CLI::Create.run("--notavalidoption", "yet-another-cask")
|
||||
Hbc::CLI::Create.editor_commands.must_equal [
|
||||
[Hbc.path("yet-another-cask")],
|
||||
]
|
||||
[Hbc.path("yet-another-cask")],
|
||||
]
|
||||
end
|
||||
|
||||
it "raises an exception when the Cask already exists" do
|
||||
@ -78,8 +78,8 @@ describe Hbc::CLI::Create do
|
||||
it "allows creating Casks that are substrings of existing Casks" do
|
||||
Hbc::CLI::Create.run("feine")
|
||||
Hbc::CLI::Create.editor_commands.must_equal [
|
||||
[Hbc.path("feine")],
|
||||
]
|
||||
[Hbc.path("feine")],
|
||||
]
|
||||
end
|
||||
|
||||
describe "when no Cask is specified" do
|
||||
|
@ -27,15 +27,15 @@ describe Hbc::CLI::Edit do
|
||||
it "opens the editor for the specified Cask" do
|
||||
Hbc::CLI::Edit.run("alfred")
|
||||
Hbc::CLI::Edit.editor_commands.must_equal [
|
||||
[Hbc.path("alfred")],
|
||||
]
|
||||
[Hbc.path("alfred")],
|
||||
]
|
||||
end
|
||||
|
||||
it "throws away additional arguments and uses the first" do
|
||||
Hbc::CLI::Edit.run("adium", "alfred")
|
||||
Hbc::CLI::Edit.editor_commands.must_equal [
|
||||
[Hbc.path("adium")],
|
||||
]
|
||||
[Hbc.path("adium")],
|
||||
]
|
||||
end
|
||||
|
||||
it "raises an exception when the Cask doesnt exist" do
|
||||
|
@ -27,22 +27,22 @@ describe Hbc::CLI::Home do
|
||||
it "opens the homepage for the specified Cask" do
|
||||
Hbc::CLI::Home.run("alfred")
|
||||
Hbc::CLI::Home.system_commands.must_equal [
|
||||
["/usr/bin/open", "--", "https://www.alfredapp.com/"],
|
||||
]
|
||||
["/usr/bin/open", "--", "https://www.alfredapp.com/"],
|
||||
]
|
||||
end
|
||||
|
||||
it "works for multiple Casks" do
|
||||
Hbc::CLI::Home.run("alfred", "adium")
|
||||
Hbc::CLI::Home.system_commands.must_equal [
|
||||
["/usr/bin/open", "--", "https://www.alfredapp.com/"],
|
||||
["/usr/bin/open", "--", "https://www.adium.im/"],
|
||||
]
|
||||
["/usr/bin/open", "--", "https://www.alfredapp.com/"],
|
||||
["/usr/bin/open", "--", "https://www.adium.im/"],
|
||||
]
|
||||
end
|
||||
|
||||
it "opens the project page when no Cask is specified" do
|
||||
Hbc::CLI::Home.run
|
||||
Hbc::CLI::Home.system_commands.must_equal [
|
||||
["/usr/bin/open", "--", "http://caskroom.io/"],
|
||||
]
|
||||
["/usr/bin/open", "--", "http://caskroom.io/"],
|
||||
]
|
||||
end
|
||||
end
|
||||
|
@ -88,8 +88,8 @@ describe Hbc::DSL do
|
||||
end
|
||||
|
||||
cask.name.must_equal [
|
||||
"Proper Name",
|
||||
]
|
||||
"Proper Name",
|
||||
]
|
||||
end
|
||||
|
||||
it "Accepts an array value to the name stanza" do
|
||||
@ -98,9 +98,9 @@ describe Hbc::DSL do
|
||||
end
|
||||
|
||||
cask.name.must_equal [
|
||||
"Proper Name",
|
||||
"Alternate Name",
|
||||
]
|
||||
"Proper Name",
|
||||
"Alternate Name",
|
||||
]
|
||||
end
|
||||
|
||||
it "Accepts multiple name stanzas" do
|
||||
@ -110,9 +110,9 @@ describe Hbc::DSL do
|
||||
end
|
||||
|
||||
cask.name.must_equal [
|
||||
"Proper Name",
|
||||
"Alternate Name",
|
||||
]
|
||||
"Proper Name",
|
||||
"Alternate Name",
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -53,10 +53,10 @@ describe Plist do
|
||||
parsed.keys.must_equal ["system-entities"]
|
||||
parsed["system-entities"].length.must_equal 3
|
||||
parsed["system-entities"].map { |e| e["dev-entry"] }.must_equal %w[
|
||||
/dev/disk3s1
|
||||
/dev/disk3
|
||||
/dev/disk3s2
|
||||
]
|
||||
/dev/disk3s1
|
||||
/dev/disk3
|
||||
/dev/disk3s2
|
||||
]
|
||||
end
|
||||
|
||||
it "does not choke on empty input" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user