update_xcode_plugins 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/bin/update_xcode_plugins +7 -0
- data/lib/cli.rb +13 -1
- data/lib/launch_agent.rb +2 -0
- data/lib/plugins_updater.rb +2 -0
- data/lib/update_xcode_plugins.rb +3 -2
- data/lib/version.rb +1 -1
- data/lib/xcode.rb +17 -7
- data/lib/xcode_unsigner.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ba1526a18aa0ff1dc1d4257f24f96eaf5d76d0a
|
4
|
+
data.tar.gz: eafea9c77568919a725cb17cfeb850ee8c2dbc26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2a65e86f6c305a9c509c4e611ec032fe738667b1f572377276a2a30bafa368e00e5a6169d0666674b6c4e48c1b364fe1f3d9f1de89b97f17f0dc1efdcc0730b
|
7
|
+
data.tar.gz: 1a1b3dd52ea2ea28164a5bd6c4fd8a8c91a5c984eb2e059102a83e71e0ce98e5c07eb611a0ac23dff85452dcbdb7268c2ae624fa3fe8117dd2a470669066cc25
|
data/README.md
CHANGED
data/bin/update_xcode_plugins
CHANGED
@@ -12,6 +12,13 @@ else
|
|
12
12
|
elsif CLI.unsign_xcode?
|
13
13
|
XcodeUnsigner.unsign_xcode
|
14
14
|
else
|
15
|
+
if CLI.non_interactive?
|
16
|
+
# This tool is ran by launchctl whenever a plugin is added/modified,
|
17
|
+
# which presents a race condition if the plugin is still in the process
|
18
|
+
# of being modified. Counter that by sleeping for a few seconds.
|
19
|
+
sleep 2
|
20
|
+
end
|
21
|
+
|
15
22
|
PluginsUpdater.update_plugins
|
16
23
|
end
|
17
24
|
end
|
data/lib/cli.rb
CHANGED
@@ -15,6 +15,14 @@ module CLI
|
|
15
15
|
ARGV.include?('--unsign')
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.no_colors?
|
19
|
+
ARGV.include?('--no-colors')
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.non_interactive?
|
23
|
+
ARGV.include?('--non-interactive')
|
24
|
+
end
|
25
|
+
|
18
26
|
def self.codesign_exists?
|
19
27
|
`which codesign` && $CHILD_STATUS.exitstatus == 0
|
20
28
|
end
|
@@ -26,7 +34,11 @@ module CLI
|
|
26
34
|
error: :red,
|
27
35
|
success: :green
|
28
36
|
}.each do |type, color|
|
29
|
-
|
37
|
+
if CLI.no_colors?
|
38
|
+
define_method type.to_sym do |str| puts str end
|
39
|
+
else
|
40
|
+
define_method type.to_sym do |str| puts str.colorize(color) end
|
41
|
+
end
|
30
42
|
end
|
31
43
|
|
32
44
|
def separator
|
data/lib/launch_agent.rb
CHANGED
data/lib/plugins_updater.rb
CHANGED
data/lib/update_xcode_plugins.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'English'
|
2
2
|
require 'fileutils'
|
3
|
-
|
4
|
-
require '
|
3
|
+
require_relative 'cli'
|
4
|
+
require 'colorize' unless CLI.no_colors?
|
5
|
+
require 'inquirer' unless CLI.non_interactive?
|
5
6
|
require_relative 'version'
|
6
7
|
require_relative 'plugins_updater'
|
7
8
|
require_relative 'xcode_unsigner'
|
data/lib/version.rb
CHANGED
data/lib/xcode.rb
CHANGED
@@ -31,11 +31,12 @@ class Xcode < Bundle
|
|
31
31
|
signed
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
def unsign_binary!
|
35
|
+
unsign!(binary_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
def unsign_xcodebuild!
|
39
|
+
unsign!(xcodebuild_path)
|
39
40
|
end
|
40
41
|
|
41
42
|
def uuid
|
@@ -56,8 +57,8 @@ class Xcode < Bundle
|
|
56
57
|
"#{path}/Contents/MacOS/Xcode"
|
57
58
|
end
|
58
59
|
|
59
|
-
def
|
60
|
-
"#{
|
60
|
+
def xcodebuild_path
|
61
|
+
"#{path}/Contents/Developer/usr/bin/xcodebuild"
|
61
62
|
end
|
62
63
|
|
63
64
|
def unsign_path
|
@@ -65,4 +66,13 @@ class Xcode < Bundle
|
|
65
66
|
|
66
67
|
"#{lib_path}/bin/unsign"
|
67
68
|
end
|
69
|
+
|
70
|
+
def unsign!(target)
|
71
|
+
unsigned_target = "#{target}.unsigned"
|
72
|
+
|
73
|
+
`#{unsign_path} "#{target}"` &&
|
74
|
+
$CHILD_STATUS.exitstatus == 0 &&
|
75
|
+
File.exist?(unsigned_target) &&
|
76
|
+
FileUtils.mv(unsigned_target, target)
|
77
|
+
end
|
68
78
|
end
|
data/lib/xcode_unsigner.rb
CHANGED
@@ -33,6 +33,8 @@ class XcodeUnsigner
|
|
33
33
|
|
34
34
|
xcode = xcodes[selection - 1]
|
35
35
|
|
36
|
+
unsign_xcodebuild = Ask.confirm "Unsign xcodebuild too?"
|
37
|
+
|
36
38
|
new_xcode_path = '/Applications/Xcode-unsigned.app'
|
37
39
|
if Dir.exist?(new_xcode_path)
|
38
40
|
error 'Xcode-unsigned.app already exists.'
|
@@ -44,7 +46,9 @@ class XcodeUnsigner
|
|
44
46
|
|
45
47
|
process 'Unsigning...'
|
46
48
|
new_xcode = Xcode.new(new_xcode_path)
|
47
|
-
|
49
|
+
|
50
|
+
if new_xcode.unsign_binary! &&
|
51
|
+
(!unsign_xcodebuild || (unsign_xcodebuild && new_xcode.unsign_xcodebuild!))
|
48
52
|
success 'Finished! 🎉'
|
49
53
|
else
|
50
54
|
error "Could not unsign Xcode-unsigned.app\n"\
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: update_xcode_plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mahdi Bchetnia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|