This repository has been archived by the owner on Dec 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
183 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
require 'English' | ||
require 'fileutils' | ||
require 'colorize' | ||
require 'inquirer' | ||
require_relative 'plugins_updater' | ||
require_relative 'xcode_unsigner' | ||
require_relative 'launch_agent' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
require_relative 'xcode' | ||
|
||
class XcodeUnsigner | ||
extend CLI | ||
|
||
def self.unsign_xcode | ||
unless CLI.codesign_exists? | ||
# Not sure if codesign comes pre-installed on fresh macOS, so we'll check | ||
# Send a pull request if you think it does :) | ||
error 'The `codesign` tool could not be found on your system' | ||
return | ||
end | ||
|
||
process 'Looking for Xcode...' | ||
xcodes = Xcode.find_xcodes | ||
.select { |xcode| xcode.version.to_f >= 8 } | ||
.select(&:signed?) | ||
|
||
separator | ||
|
||
if xcodes.empty? | ||
error "Didn't find any Xcode 8+ installed on your system." | ||
return | ||
else | ||
puts notice | ||
end | ||
|
||
separator | ||
|
||
selection = Ask.list 'Choose which Xcode.app you would like to copy and unsign (use arrows)', | ||
['Cancel', xcodes].flatten | ||
return unless selection && selection != 0 | ||
|
||
xcode = xcodes[selection - 1] | ||
|
||
new_xcode_path = '/Applications/Xcode-unsigned.app' | ||
if Dir.exist?(new_xcode_path) | ||
error 'Xcode-unsigned.app already exists.' | ||
return | ||
end | ||
|
||
process 'Copying Xcode... (this might take a while)' | ||
FileUtils.cp_r(xcode.path, new_xcode_path) | ||
|
||
process 'Unsigning...' | ||
new_xcode = Xcode.new(new_xcode_path) | ||
if new_xcode.unsign! | ||
success 'Finished! 🎉' | ||
else | ||
error "Could not unsign Xcode-unsigned.app\n"\ | ||
'Create an issue on https://github.com/inket/update_xcode_plugins/issues' | ||
end | ||
end | ||
|
||
def self.notice | ||
[ | ||
'Unsigning Xcode will make it skip library validation allowing it to load plugins.'.colorize(:yellow), | ||
'', | ||
'However, an unsigned Xcode presents security risks, '\ | ||
'and will be untrusted by both Apple and your system.'.colorize(:red), | ||
'Please make sure that you have launched this version of Xcode at least '\ | ||
'once before unsigning.'.colorize(:red), | ||
'', | ||
'We recommend keeping a signed version of Xcode, so this tool will:', | ||
'- Create a copy of Xcode.app called Xcode-unsigned.app (consider the disk space requirements)', | ||
'- Unsign Xcode-unsigned.app' | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters