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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4c8f15764baf5b6abcc5987933aff96e9ac3b44
4
- data.tar.gz: 08f4b1549988bc40de7b63c31cb3f7d9bc4fdae2
3
+ metadata.gz: 1ba1526a18aa0ff1dc1d4257f24f96eaf5d76d0a
4
+ data.tar.gz: eafea9c77568919a725cb17cfeb850ee8c2dbc26
5
5
  SHA512:
6
- metadata.gz: 24e196c7d18665d7603e0ba64a3282a83c1e37ed7c0ac78c8612097e666775262977d6656ed05220b334cfb52574cec1ef4da3a86cd4db9c1ea11aa434ca1935
7
- data.tar.gz: d8da91bc440b22980b5d4ff19c3325128dd2740a661adb1c13b3630b411dc42427fb4b5b46bd828ba56e34155889db18df65aba3368153bf05f075fbdfd14f50
6
+ metadata.gz: e2a65e86f6c305a9c509c4e611ec032fe738667b1f572377276a2a30bafa368e00e5a6169d0666674b6c4e48c1b364fe1f3d9f1de89b97f17f0dc1efdcc0730b
7
+ data.tar.gz: 1a1b3dd52ea2ea28164a5bd6c4fd8a8c91a5c984eb2e059102a83e71e0ce98e5c07eb611a0ac23dff85452dcbdb7268c2ae624fa3fe8117dd2a470669066cc25
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![](https://travis-ci.org/inket/update_xcode_plugins.svg?branch=master)
2
+
1
3
  ### $ update\_xcode\_plugins
2
4
 
3
5
  This tool adds the missing UUIDs into the installed Xcode plug-ins so that they can be loaded by newer versions of Xcode.
@@ -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
- define_method type.to_sym do |str| puts str.colorize(color) end
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
@@ -106,6 +106,8 @@ class LaunchAgent
106
106
  <string>/usr/bin/env</string>
107
107
  <string>ruby</string>
108
108
  <string>#{bin_path}</string>
109
+ <string>--no-colors</string>
110
+ <string>--non-interactive</string>
109
111
  </array>
110
112
  <key>RunAtLoad</key>
111
113
  <false/>
@@ -42,6 +42,8 @@ class PluginsUpdater
42
42
  separator
43
43
  success 'Finished! 🎉'
44
44
 
45
+ return if CLI.no_colors?
46
+
45
47
  if xcodes.any? { |xcode| xcode.version.to_f >= 8 }
46
48
  separator
47
49
  warning 'It seems that you have Xcode 8+ installed!'
@@ -1,7 +1,8 @@
1
1
  require 'English'
2
2
  require 'fileutils'
3
- require 'colorize'
4
- require 'inquirer'
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
@@ -1,3 +1,3 @@
1
1
  class UpdateXcodePlugins
2
- VERSION = '0.2'.freeze
2
+ VERSION = '0.3'.freeze
3
3
  end
data/lib/xcode.rb CHANGED
@@ -31,11 +31,12 @@ class Xcode < Bundle
31
31
  signed
32
32
  end
33
33
 
34
- def unsign!
35
- `#{unsign_path} "#{binary_path}"` &&
36
- $CHILD_STATUS.exitstatus == 0 &&
37
- File.exist?(unsigned_binary_path) &&
38
- FileUtils.mv(unsigned_binary_path, binary_path)
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 unsigned_binary_path
60
- "#{binary_path}.unsigned"
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
@@ -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
- if new_xcode.unsign!
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.2'
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-07-27 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize