Skip to content

Commit

Permalink
Add authorize and deauthorize commands to frank CLI, to grant and rev…
Browse files Browse the repository at this point in the history
…oke access to the OS X accessibility API for Mac apps
  • Loading branch information
MichaelBuckley committed Dec 15, 2013
1 parent 70771a0 commit ade942b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gem/lib/frank-cucumber/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ def console
end
end

desc "authorize", "Permanently authorize your frankified app, and all apps with the same bundle identifier, to use the Mac accessibility API on 10.9 or later. Requires administrator privileges."
def authorize
bundle_id = get_mac_bundle_id
run %Q|sudo sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db "INSERT or REPLACE INTO access values ('kTCCServiceAccessibility', '#{bundle_id}', 0, 1, 0, NULL);"|
end

desc "deauthorize", "Remove authorization for your frankified app, and all apps with the same bundle identifier, to use the Mac accessibility API on 10.9 or later. Requires administrator privileges."
def deauthorize
bundle_id = get_mac_bundle_id
run %Q|sudo sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db "DELETE FROM access WHERE client = '#{bundle_id}'"|
end

private

def product_name
Expand Down Expand Up @@ -285,6 +297,10 @@ def gather_plugins
end
end

def get_mac_bundle_id
bundle_id = `/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' Frank/frankified_build/Frankified.app/Contents/Info.plist`.chomp
end

end
end

0 comments on commit ade942b

Please sign in to comment.