Remove the accessibility_access stanza.
This commit is contained in:
parent
8b9c80795d
commit
59e3a532ff
@ -135,7 +135,6 @@ module Cask
|
|||||||
"depends_on" => depends_on,
|
"depends_on" => depends_on,
|
||||||
"conflicts_with" => conflicts_with.to_a,
|
"conflicts_with" => conflicts_with.to_a,
|
||||||
"container" => container,
|
"container" => container,
|
||||||
"accessibility_access" => accessibility_access,
|
|
||||||
"auto_updates" => auto_updates,
|
"auto_updates" => auto_updates,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -83,8 +83,6 @@ module Cask
|
|||||||
new_cask_installer.install_artifacts
|
new_cask_installer.install_artifacts
|
||||||
new_artifacts_installed = true
|
new_artifacts_installed = true
|
||||||
|
|
||||||
new_cask_installer.enable_accessibility_access
|
|
||||||
|
|
||||||
# If successful, wipe the old Cask from staging
|
# If successful, wipe the old Cask from staging
|
||||||
old_cask_installer.finalize_upgrade
|
old_cask_installer.finalize_upgrade
|
||||||
rescue CaskError => e
|
rescue CaskError => e
|
||||||
|
|||||||
@ -54,7 +54,6 @@ module Cask
|
|||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
DSL_METHODS = Set.new [
|
DSL_METHODS = Set.new [
|
||||||
:accessibility_access,
|
|
||||||
:appcast,
|
:appcast,
|
||||||
:artifacts,
|
:artifacts,
|
||||||
:auto_updates,
|
:auto_updates,
|
||||||
@ -251,10 +250,6 @@ module Cask
|
|||||||
@caveats
|
@caveats
|
||||||
end
|
end
|
||||||
|
|
||||||
def accessibility_access(accessibility_access = nil)
|
|
||||||
set_unique_stanza(:accessibility_access, accessibility_access.nil?) { accessibility_access }
|
|
||||||
end
|
|
||||||
|
|
||||||
def auto_updates(auto_updates = nil)
|
def auto_updates(auto_updates = nil)
|
||||||
set_unique_stanza(:auto_updates, auto_updates.nil?) { auto_updates }
|
set_unique_stanza(:auto_updates, auto_updates.nil?) { auto_updates }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -94,7 +94,6 @@ module Cask
|
|||||||
opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine?
|
opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine?
|
||||||
stage
|
stage
|
||||||
install_artifacts
|
install_artifacts
|
||||||
enable_accessibility_access
|
|
||||||
|
|
||||||
unless @cask.tap&.private?
|
unless @cask.tap&.private?
|
||||||
::Utils::Analytics.report_event("cask_install", @cask.token)
|
::Utils::Analytics.report_event("cask_install", @cask.token)
|
||||||
@ -365,67 +364,6 @@ module Cask
|
|||||||
self.class.print_caveats(@cask)
|
self.class.print_caveats(@cask)
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: logically could be in a separate class
|
|
||||||
def enable_accessibility_access
|
|
||||||
return unless @cask.accessibility_access
|
|
||||||
|
|
||||||
ohai "Enabling accessibility access"
|
|
||||||
if MacOS.version <= :mountain_lion
|
|
||||||
@command.run!(
|
|
||||||
"/usr/bin/touch",
|
|
||||||
args: [MacOS.pre_mavericks_accessibility_dotfile],
|
|
||||||
sudo: true,
|
|
||||||
)
|
|
||||||
elsif MacOS.version <= :yosemite
|
|
||||||
@command.run!(
|
|
||||||
"/usr/bin/sqlite3",
|
|
||||||
args: [
|
|
||||||
MacOS.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: [
|
|
||||||
MacOS.tcc_db,
|
|
||||||
"INSERT OR REPLACE INTO access " \
|
|
||||||
"VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL,NULL);",
|
|
||||||
],
|
|
||||||
sudo: true,
|
|
||||||
)
|
|
||||||
else
|
|
||||||
opoo <<~EOS
|
|
||||||
Accessibility access cannot be enabled automatically on this version of macOS.
|
|
||||||
See System Preferences to enable it manually.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
rescue => e
|
|
||||||
purge_versioned_files
|
|
||||||
raise e
|
|
||||||
end
|
|
||||||
|
|
||||||
def disable_accessibility_access
|
|
||||||
return unless @cask.accessibility_access
|
|
||||||
|
|
||||||
if MacOS.version >= :mavericks && MacOS.version <= :el_capitan
|
|
||||||
ohai "Disabling accessibility access"
|
|
||||||
@command.run!("/usr/bin/sqlite3",
|
|
||||||
args: [
|
|
||||||
MacOS.tcc_db,
|
|
||||||
"DELETE FROM access WHERE client='#{bundle_identifier}';",
|
|
||||||
],
|
|
||||||
sudo: true)
|
|
||||||
else
|
|
||||||
opoo <<~EOS
|
|
||||||
Accessibility access cannot be disabled automatically on this version of macOS.
|
|
||||||
See System Preferences to disable it manually.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_caskfile
|
def save_caskfile
|
||||||
old_savedir = @cask.metadata_timestamped_path
|
old_savedir = @cask.metadata_timestamped_path
|
||||||
|
|
||||||
@ -438,7 +376,6 @@ module Cask
|
|||||||
|
|
||||||
def uninstall
|
def uninstall
|
||||||
oh1 "Uninstalling Cask #{Formatter.identifier(@cask)}"
|
oh1 "Uninstalling Cask #{Formatter.identifier(@cask)}"
|
||||||
disable_accessibility_access
|
|
||||||
uninstall_artifacts(clear: true)
|
uninstall_artifacts(clear: true)
|
||||||
purge_versioned_files
|
purge_versioned_files
|
||||||
purge_caskroom_path if force?
|
purge_caskroom_path if force?
|
||||||
@ -447,7 +384,6 @@ module Cask
|
|||||||
def start_upgrade
|
def start_upgrade
|
||||||
oh1 "Starting upgrade for Cask #{Formatter.identifier(@cask)}"
|
oh1 "Starting upgrade for Cask #{Formatter.identifier(@cask)}"
|
||||||
|
|
||||||
disable_accessibility_access
|
|
||||||
uninstall_artifacts
|
uninstall_artifacts
|
||||||
backup
|
backup
|
||||||
end
|
end
|
||||||
@ -471,7 +407,6 @@ module Cask
|
|||||||
opoo "Reverting upgrade for Cask #{@cask}"
|
opoo "Reverting upgrade for Cask #{@cask}"
|
||||||
restore_backup
|
restore_backup
|
||||||
install_artifacts
|
install_artifacts
|
||||||
enable_accessibility_access
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize_upgrade
|
def finalize_upgrade
|
||||||
|
|||||||
@ -8,6 +8,10 @@ module Cask
|
|||||||
def license(*)
|
def license(*)
|
||||||
odisabled "the `license` stanza"
|
odisabled "the `license` stanza"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def accessibility_access(*)
|
||||||
|
odeprecated "the `accessibility_access` stanza"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
prepend Compat
|
prepend Compat
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
# TODO: this test should be named after the corresponding class, once
|
|
||||||
# that class is abstracted from installer.rb.
|
|
||||||
describe "Accessibility Access", :cask do
|
|
||||||
let(:cask) { Cask::CaskLoader.load(cask_path("with-accessibility-access")) }
|
|
||||||
let(:fake_system_command) { class_double(SystemCommand) }
|
|
||||||
let(:installer) { Cask::Installer.new(cask, command: fake_system_command) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
allow(MacOS).to receive(:version).and_return(MacOS::Version.new(macos_version))
|
|
||||||
allow(installer).to receive(:bundle_identifier).and_return("com.example.BasicCask")
|
|
||||||
end
|
|
||||||
|
|
||||||
context "on MacOS 10.8 and below" do
|
|
||||||
let(:macos_version) { "10.8" }
|
|
||||||
|
|
||||||
it "can enable accessibility access in macOS releases prior to Mavericks" do
|
|
||||||
expect(fake_system_command).to receive(:run!).with(
|
|
||||||
"/usr/bin/touch",
|
|
||||||
args: [MacOS.pre_mavericks_accessibility_dotfile],
|
|
||||||
sudo: true,
|
|
||||||
)
|
|
||||||
|
|
||||||
installer.enable_accessibility_access
|
|
||||||
end
|
|
||||||
|
|
||||||
it "warns about disabling accessibility access on old macOS releases" do
|
|
||||||
expect {
|
|
||||||
installer.disable_accessibility_access
|
|
||||||
}.to output(
|
|
||||||
/Warning: Accessibility access cannot be disabled automatically on this version of macOS\./,
|
|
||||||
).to_stderr
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "on MacOS 10.9" do
|
|
||||||
let(:macos_version) { "10.9" }
|
|
||||||
|
|
||||||
it "can enable accessibility access" do
|
|
||||||
expect(fake_system_command).to receive(:run!).with(
|
|
||||||
"/usr/bin/sqlite3",
|
|
||||||
args: [
|
|
||||||
MacOS.tcc_db,
|
|
||||||
"INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','com.example.BasicCask',0,1,1,NULL);",
|
|
||||||
],
|
|
||||||
sudo: true,
|
|
||||||
)
|
|
||||||
|
|
||||||
installer.enable_accessibility_access
|
|
||||||
end
|
|
||||||
|
|
||||||
it "can disable accessibility access" do
|
|
||||||
expect(fake_system_command).to receive(:run!).with(
|
|
||||||
"/usr/bin/sqlite3",
|
|
||||||
args: [MacOS.tcc_db, "DELETE FROM access WHERE client='com.example.BasicCask';"],
|
|
||||||
sudo: true,
|
|
||||||
)
|
|
||||||
|
|
||||||
installer.disable_accessibility_access
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "on MacOS 10.12 and above" do
|
|
||||||
let(:macos_version) { "10.12" }
|
|
||||||
|
|
||||||
it "warns about enabling accessibility access on new macOS releases" do
|
|
||||||
expect {
|
|
||||||
expect {
|
|
||||||
installer.enable_accessibility_access
|
|
||||||
}.to output.to_stdout
|
|
||||||
}.to output(
|
|
||||||
/Warning: Accessibility access cannot be enabled automatically on this version of macOS\./,
|
|
||||||
).to_stderr
|
|
||||||
end
|
|
||||||
|
|
||||||
it "warns about disabling accessibility access on new macOS releases" do
|
|
||||||
expect {
|
|
||||||
installer.disable_accessibility_access
|
|
||||||
}.to output(
|
|
||||||
/Warning: Accessibility access cannot be disabled automatically on this version of macOS\./,
|
|
||||||
).to_stderr
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
cask 'with-accessibility-access' do
|
|
||||||
version '1.2.3'
|
|
||||||
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
|
|
||||||
|
|
||||||
url 'https://example.com/TestCask.dmg'
|
|
||||||
homepage 'https://example.com/'
|
|
||||||
|
|
||||||
accessibility_access true
|
|
||||||
|
|
||||||
app 'TestCask.app'
|
|
||||||
end
|
|
||||||
Loading…
x
Reference in New Issue
Block a user