xcode-install 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/xcode/install/install.rb +5 -1
- data/lib/xcode/install/version.rb +1 -1
- data/lib/xcode/install.rb +27 -11
- data/spec/install_spec.rb +8 -0
- data/spec/list_spec.rb +27 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f963f106ba542c0705d573d9262d8fb92595df9d
|
|
4
|
+
data.tar.gz: ac247b88aba2b1548179b04c7e7a6eb6358c5004
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e525ac44989fb47d31f0b976228eb1952f4d710fef60def7c3aaee7059312332c9d29e258b3a3a0760f6d39d2a1b067af9f3b3fc622c49a3780a14bd8fd61593
|
|
7
|
+
data.tar.gz: e630821045db39f07f64840f17e6d96df9ba3cfaeca05cc3391f9b9dc8843d48038382580b96743c3ea5868afda8aed92e8135153bea24320680b99f4f7933c9
|
data/README.md
CHANGED
|
@@ -149,9 +149,11 @@ XcodeInstall automatically installs additional components so that it is immediat
|
|
|
149
149
|
commandline. Unfortunately, Xcode will load third-party plugins even in that situation, which leads
|
|
150
150
|
to a dialog popping up. Feel free to dupe [the radar][5]. 📡
|
|
151
151
|
|
|
152
|
-
XcodeInstall
|
|
152
|
+
XcodeInstall normally relies on the Spotlight index to locate installed versions of Xcode. If you use it while
|
|
153
153
|
indexing is happening, it might show inaccurate results and it will not be able to see installed
|
|
154
|
-
versions on unindexed volumes.
|
|
154
|
+
versions on unindexed volumes.
|
|
155
|
+
|
|
156
|
+
To workaround the Spotlight limitation, XcodeInstall searches `/Applications` folder to locate Xcodes when Spotlight is disabled on the machine, or when Spotlight query for Xcode does not return any results. But it still won't work if your Xcodes are not located under `/Applications` folder.
|
|
155
157
|
|
|
156
158
|
## Thanks
|
|
157
159
|
|
|
@@ -23,6 +23,7 @@ module XcodeInstall
|
|
|
23
23
|
def initialize(argv)
|
|
24
24
|
@installer = Installer.new
|
|
25
25
|
@version = argv.shift_argument
|
|
26
|
+
@version ||= File.read('.xcode-version') if File.exist?('.xcode-version')
|
|
26
27
|
@url = argv.option('url')
|
|
27
28
|
@force = argv.flag?('force', false)
|
|
28
29
|
@should_clean = argv.flag?('clean', true)
|
|
@@ -37,7 +38,10 @@ module XcodeInstall
|
|
|
37
38
|
super
|
|
38
39
|
|
|
39
40
|
help! 'A VERSION argument is required.' unless @version
|
|
40
|
-
|
|
41
|
+
if @installer.installed?(@version) && !@force
|
|
42
|
+
print "Version #{@version} already installed."
|
|
43
|
+
exit(0)
|
|
44
|
+
end
|
|
41
45
|
fail Informative, "Version #{@version} doesn't exist." unless @url || @installer.exist?(@version)
|
|
42
46
|
fail Informative, "Invalid URL: `#{@url}`" unless !@url || @url =~ /\A#{URI.regexp}\z/
|
|
43
47
|
end
|
data/lib/xcode/install.rb
CHANGED
|
@@ -95,7 +95,7 @@ module XcodeInstall
|
|
|
95
95
|
|
|
96
96
|
# Call back the block for other processes that might be interested
|
|
97
97
|
matched = progress_content.match(/^\s*(\d+)/)
|
|
98
|
-
next unless matched.length == 2
|
|
98
|
+
next unless matched && matched.length == 2
|
|
99
99
|
percent = matched[1].to_i
|
|
100
100
|
progress_block.call(percent) if progress_block
|
|
101
101
|
end
|
|
@@ -277,7 +277,7 @@ HELP
|
|
|
277
277
|
fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil?
|
|
278
278
|
|
|
279
279
|
if install
|
|
280
|
-
install_dmg(dmg_path, "-#{version.to_s.split(' ')
|
|
280
|
+
install_dmg(dmg_path, "-#{version.to_s.split(' ').join('.')}", switch, clean)
|
|
281
281
|
else
|
|
282
282
|
puts "Downloaded Xcode #{version} to '#{dmg_path}'"
|
|
283
283
|
end
|
|
@@ -293,11 +293,16 @@ HELP
|
|
|
293
293
|
|
|
294
294
|
def list_annotated(xcodes_list)
|
|
295
295
|
installed = installed_versions.map(&:version)
|
|
296
|
-
xcodes_list.map
|
|
296
|
+
xcodes_list.map do |x|
|
|
297
|
+
xcode_version = x.split(' ').first # exclude "beta N", "for Lion".
|
|
298
|
+
xcode_version << '.0' unless xcode_version.include?('.')
|
|
299
|
+
|
|
300
|
+
installed.include?(xcode_version) ? "#{x} (installed)" : x
|
|
301
|
+
end.join("\n")
|
|
297
302
|
end
|
|
298
303
|
|
|
299
304
|
def list
|
|
300
|
-
list_annotated(list_versions.
|
|
305
|
+
list_annotated(list_versions.sort_by(&:to_f))
|
|
301
306
|
end
|
|
302
307
|
|
|
303
308
|
def rm_list_cache
|
|
@@ -381,11 +386,13 @@ HELP
|
|
|
381
386
|
end
|
|
382
387
|
|
|
383
388
|
def installed
|
|
384
|
-
|
|
385
|
-
|
|
389
|
+
result = `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'" 2>/dev/null`.split("\n")
|
|
390
|
+
if result.empty?
|
|
391
|
+
result = `find /Applications -maxdepth 1 -name '*.app' -type d -exec sh -c \
|
|
392
|
+
'if [ "$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" \
|
|
393
|
+
"{}/Contents/Info.plist" 2>/dev/null)" == "com.apple.dt.Xcode" ]; then echo "{}"; fi' ';'`.split("\n")
|
|
386
394
|
end
|
|
387
|
-
|
|
388
|
-
`mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'" 2>/dev/null`.split("\n")
|
|
395
|
+
result
|
|
389
396
|
end
|
|
390
397
|
|
|
391
398
|
def parse_seedlist(seedlist)
|
|
@@ -433,7 +440,7 @@ HELP
|
|
|
433
440
|
return [] if scan.empty?
|
|
434
441
|
|
|
435
442
|
version = scan.first.gsub(/<.*?>/, '').gsub(/.*Xcode /, '')
|
|
436
|
-
link = body.scan(%r{<button .*"(.+?.xip)".*</button>}).first.first
|
|
443
|
+
link = body.scan(%r{<button .*"(.+?.(dmg|xip))".*</button>}).first.first
|
|
437
444
|
notes = body.scan(%r{<a.+?href="(/go/\?id=xcode-.+?)".*>(.*)</a>}).first.first
|
|
438
445
|
links << Xcode.new(version, link, notes)
|
|
439
446
|
end
|
|
@@ -587,7 +594,7 @@ HELP
|
|
|
587
594
|
end
|
|
588
595
|
|
|
589
596
|
def bundle_version
|
|
590
|
-
@bundle_version ||= Gem::Version.new(
|
|
597
|
+
@bundle_version ||= Gem::Version.new(bundle_version_string)
|
|
591
598
|
end
|
|
592
599
|
|
|
593
600
|
def uuid
|
|
@@ -628,7 +635,7 @@ HELP
|
|
|
628
635
|
def install_components
|
|
629
636
|
# starting with Xcode 9, we have `xcodebuild -runFirstLaunch` available to do package
|
|
630
637
|
# postinstalls using a documented option
|
|
631
|
-
if Gem::Version.new(
|
|
638
|
+
if Gem::Version.new(version) >= Gem::Version.new('9')
|
|
632
639
|
`sudo #{@path}/Contents/Developer/usr/bin/xcodebuild -runFirstLaunch`
|
|
633
640
|
else
|
|
634
641
|
Dir.glob("#{@path}/Contents/Resources/Packages/*.pkg").each do |pkg|
|
|
@@ -650,6 +657,15 @@ HELP
|
|
|
650
657
|
|
|
651
658
|
:private
|
|
652
659
|
|
|
660
|
+
def bundle_version_string
|
|
661
|
+
digits = plist_entry(':DTXcode').to_i.to_s
|
|
662
|
+
if digits.length < 3
|
|
663
|
+
digits.split(//).join('.')
|
|
664
|
+
else
|
|
665
|
+
"#{digits[0..-3]}.#{digits[-2]}.#{digits[-1]}"
|
|
666
|
+
end
|
|
667
|
+
end
|
|
668
|
+
|
|
653
669
|
def plist_entry(keypath)
|
|
654
670
|
`/usr/libexec/PlistBuddy -c "Print :#{keypath}" "#{path}/Contents/Info.plist"`.chomp
|
|
655
671
|
end
|
data/spec/install_spec.rb
CHANGED
|
@@ -35,6 +35,14 @@ module XcodeInstall
|
|
|
35
35
|
Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
|
|
36
36
|
Command::Install.run(['6.3', '--no-progress'])
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
it 'reads .xcode-version' do
|
|
40
|
+
Installer.any_instance.expects(:download).with('6.3', true, nil, nil).returns('/some/path')
|
|
41
|
+
Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
|
|
42
|
+
File.expects(:exist?).with('.xcode-version').returns(true)
|
|
43
|
+
File.expects(:read).returns('6.3')
|
|
44
|
+
Command::Install.run([])
|
|
45
|
+
end
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
it 'parses hdiutil output' do
|
data/spec/list_spec.rb
CHANGED
|
@@ -4,7 +4,6 @@ module XcodeInstall
|
|
|
4
4
|
describe Command::List do
|
|
5
5
|
before do
|
|
6
6
|
installer.stubs(:exists).returns(true)
|
|
7
|
-
installer.stubs(:installed_versions).returns([])
|
|
8
7
|
end
|
|
9
8
|
|
|
10
9
|
def installer
|
|
@@ -23,10 +22,35 @@ module XcodeInstall
|
|
|
23
22
|
installer.stubs(:xcodes).returns(xcodes)
|
|
24
23
|
end
|
|
25
24
|
|
|
25
|
+
def fake_installed_xcode(name)
|
|
26
|
+
xcode_path = "/Applications/Xcode-#{name}.app"
|
|
27
|
+
xcode_version = name
|
|
28
|
+
xcode_version << '.0' unless name.include? '.'
|
|
29
|
+
|
|
30
|
+
installed_xcode = InstalledXcode.new(xcode_path)
|
|
31
|
+
installed_xcode.stubs(:version).returns(xcode_version)
|
|
32
|
+
installed_xcode.stubs(:bundle_version).returns(Gem::Version.new(xcode_version))
|
|
33
|
+
installed_xcode
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def fake_installed_xcodes(*names)
|
|
37
|
+
xcodes = names.map { |name| fake_installed_xcode(name) }
|
|
38
|
+
installer.stubs(:installed_versions).returns(xcodes)
|
|
39
|
+
end
|
|
40
|
+
|
|
26
41
|
describe '#list' do
|
|
27
42
|
it 'lists all versions' do
|
|
28
|
-
fake_xcodes '1', '2.3', '3 some', '4 beta'
|
|
29
|
-
|
|
43
|
+
fake_xcodes '1', '2.3', '2.3.1', '2.3.2', '3 some', '4 beta', '10 beta'
|
|
44
|
+
fake_installed_xcodes
|
|
45
|
+
installer.list.should == "1\n2.3\n2.3.1\n2.3.2\n3 some\n4 beta\n10 beta"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe '#list_annotated' do
|
|
50
|
+
it 'lists all versions with annotations' do
|
|
51
|
+
fake_xcodes '1', '2.3', '2.3.1', '2.3.2', '3 some', '4.3.1 for Lion', '9.4.1', '10 beta'
|
|
52
|
+
fake_installed_xcodes '2.3', '4.3.1', '10'
|
|
53
|
+
installer.list.should == "1\n2.3 (installed)\n2.3.1\n2.3.2\n3 some\n4.3.1 for Lion (installed)\n9.4.1\n10 beta (installed)"
|
|
30
54
|
end
|
|
31
55
|
end
|
|
32
56
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xcode-install
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Boris Bügling
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: claide
|
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
160
160
|
version: '0'
|
|
161
161
|
requirements: []
|
|
162
162
|
rubyforge_project:
|
|
163
|
-
rubygems_version: 2.6.
|
|
163
|
+
rubygems_version: 2.6.8
|
|
164
164
|
signing_key:
|
|
165
165
|
specification_version: 4
|
|
166
166
|
summary: Xcode installation manager.
|