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