update_xcode_plugins 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bundle.rb +4 -0
  3. data/lib/version.rb +1 -1
  4. data/lib/xcode.rb +15 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ba1526a18aa0ff1dc1d4257f24f96eaf5d76d0a
4
- data.tar.gz: eafea9c77568919a725cb17cfeb850ee8c2dbc26
3
+ metadata.gz: 2e767ffabb5cb7dccc100ddcff7e365b56636560
4
+ data.tar.gz: a2dd49cef48631bbedb9cfee67f356345bd8e9f2
5
5
  SHA512:
6
- metadata.gz: e2a65e86f6c305a9c509c4e611ec032fe738667b1f572377276a2a30bafa368e00e5a6169d0666674b6c4e48c1b364fe1f3d9f1de89b97f17f0dc1efdcc0730b
7
- data.tar.gz: 1a1b3dd52ea2ea28164a5bd6c4fd8a8c91a5c984eb2e059102a83e71e0ce98e5c07eb611a0ac23dff85452dcbdb7268c2ae624fa3fe8117dd2a470669066cc25
6
+ metadata.gz: 7fe9940f35a7b2f5046fa0f798755ae8605ad5fbb1d8fd95b437d5d348ac1ef422ad0674c0558a9991eef5e8dd27f3d04c85def87955c417afce88b055f943ce
7
+ data.tar.gz: 653ee6beb3b56b8905b89cb534e828dee0f6a1947a900629428ff57b92f46ea11d72b05f23cce0596faf393aa56700e9154338086dc0291811c772ad552e7d2d
data/lib/bundle.rb CHANGED
@@ -15,6 +15,10 @@ class Bundle
15
15
  "#{path}/Contents/Info.plist"
16
16
  end
17
17
 
18
+ def bundle_identifier
19
+ defaults_read("CFBundleIdentifier")
20
+ end
21
+
18
22
  def version
19
23
  defaults_read('CFBundleShortVersionString')
20
24
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class UpdateXcodePlugins
2
- VERSION = '0.3'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
data/lib/xcode.rb CHANGED
@@ -3,9 +3,20 @@ require_relative 'bundle'
3
3
  class Xcode < Bundle
4
4
  attr_accessor :signed
5
5
 
6
+ # Hardcoded paths in case mdfind is not working because Spotlight is disabled
7
+ DEFAULT_XCODE_PATHS = [
8
+ "/Applications/Xcode.app",
9
+ "/Applications/Xcode-beta.app",
10
+ "/Applications/Xcode-unsigned.app"
11
+ ]
12
+
13
+ XCODE_BUNDLE_IDENTIFIER = "com.apple.dt.Xcode"
14
+
6
15
  def self.find_xcodes
7
- output = `mdfind kMDItemCFBundleIdentifier = "com.apple.dt.Xcode"`
8
- output.lines.collect do |xcode_path|
16
+ output = `mdfind kMDItemCFBundleIdentifier = "#{XCODE_BUNDLE_IDENTIFIER}"`
17
+ paths = output.lines + DEFAULT_XCODE_PATHS
18
+
19
+ paths.map(&:strip).uniq.collect do |xcode_path|
9
20
  Xcode.from_bundle(xcode_path)
10
21
  end.compact.keep_if(&:valid?)
11
22
  end
@@ -18,8 +29,9 @@ class Xcode < Bundle
18
29
  def valid?
19
30
  is_app = path.end_with?('.app')
20
31
  has_info = File.exist?(info_path)
32
+ return false unless is_app && has_info
21
33
 
22
- is_app && has_info
34
+ bundle_identifier == XCODE_BUNDLE_IDENTIFIER
23
35
  end
24
36
 
25
37
  def signed?
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.3'
4
+ version: 0.3.1
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-08-01 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize