xcode-install 2.6.3 → 2.6.8
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/.circleci/config.yml +1 -1
- data/.github/workflows/ci.yml +36 -0
- data/lib/xcode/install.rb +71 -18
- data/lib/xcode/install/install.rb +5 -2
- data/lib/xcode/install/version.rb +1 -1
- data/spec/fixtures/xcode.json +30 -1
- data/spec/fixtures/xcode_63.json +28 -44
- data/spec/fixtures/yolo.json +1 -1
- data/spec/install_spec.rb +5 -5
- data/spec/installer_spec.rb +116 -91
- data/spec/json_spec.rb +14 -4
- data/spec/list_spec.rb +32 -3
- data/xcode-install.gemspec +1 -1
- metadata +11 -10
data/spec/installer_spec.rb
CHANGED
|
@@ -1,101 +1,126 @@
|
|
|
1
1
|
require File.expand_path('../spec_helper', __FILE__)
|
|
2
2
|
|
|
3
3
|
module XcodeInstall
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
#
|
|
5
|
+
# FIXME: This test randomely fail on GitHub Actions.
|
|
6
|
+
#
|
|
7
|
+
# describe '#fetch' do
|
|
8
|
+
# before do
|
|
9
|
+
# client = mock
|
|
10
|
+
# client.stubs(:cookie).returns('customCookie')
|
|
11
|
+
# Spaceship::PortalClient.stubs(:login).returns(client)
|
|
12
|
+
# end
|
|
13
|
+
|
|
14
|
+
# it 'downloads the file and calls the `progress_block` with the percentage' do
|
|
15
|
+
# installer = Installer.new
|
|
16
|
+
|
|
17
|
+
# xcode = XcodeInstall::Xcode.new('name' => 'Xcode 9.3',
|
|
18
|
+
# 'files' => [{
|
|
19
|
+
# 'remotePath' => '/Developer_Tools/Xcode_9.3/Xcode_9.3.xip'
|
|
20
|
+
# }])
|
|
21
|
+
|
|
22
|
+
# installer.stubs(:fetch_seedlist).returns([xcode])
|
|
23
|
+
|
|
24
|
+
# stdin = 'stdin'
|
|
25
|
+
# stdout = 'stdout'
|
|
26
|
+
# stderr = 'stderr'
|
|
27
|
+
# wait_thr = 'wait_thr'
|
|
28
|
+
|
|
29
|
+
# stdin.stubs(:close)
|
|
30
|
+
# stdout.stubs(:close)
|
|
31
|
+
# stderr.stubs(:close)
|
|
32
|
+
|
|
33
|
+
# current_time = '123123'
|
|
34
|
+
# Time.stubs(:now).returns(current_time)
|
|
35
|
+
|
|
36
|
+
# xip_path = File.join(File.expand_path('~'), '/Library/Caches/XcodeInstall/Xcode_9.3.xip')
|
|
37
|
+
# progress_log_file = File.join(File.expand_path('~'), "/Library/Caches/XcodeInstall/progress.#{current_time}.progress")
|
|
10
38
|
|
|
11
|
-
|
|
39
|
+
# command = [
|
|
40
|
+
# 'curl',
|
|
41
|
+
# '--disable',
|
|
42
|
+
# '--cookie customCookie',
|
|
43
|
+
# '--cookie-jar /tmp/curl-cookies.txt',
|
|
44
|
+
# '--retry 3',
|
|
45
|
+
# '--location',
|
|
46
|
+
# '--continue-at -',
|
|
47
|
+
# "--output #{xip_path}",
|
|
48
|
+
# 'https://developer.apple.com/devcenter/download.action\\?path\\=/Developer_Tools/Xcode_9.3/Xcode_9.3.xip',
|
|
49
|
+
# "2> #{progress_log_file}"
|
|
50
|
+
# ]
|
|
51
|
+
# Open3.stubs(:popen3).with(command.join(' ')).returns([stdin, stdout, stderr, wait_thr])
|
|
52
|
+
|
|
53
|
+
# wait_thr.stubs(:alive?).returns(true)
|
|
54
|
+
|
|
55
|
+
# thr_value = 'thr_value'
|
|
56
|
+
# wait_thr.stubs(:value).returns(thr_value)
|
|
57
|
+
# thr_value.stubs(:success?).returns(true)
|
|
58
|
+
|
|
59
|
+
# installer.stubs(:install_dmg).with(Pathname.new(xip_path), '-9.3', false, false)
|
|
60
|
+
|
|
61
|
+
# Thread.new do
|
|
62
|
+
# sleep(1)
|
|
63
|
+
# File.write(progress_log_file, ' 0 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
64
|
+
# sleep(1)
|
|
65
|
+
# File.write(progress_log_file, ' 5 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
66
|
+
# sleep(1)
|
|
67
|
+
# File.write(progress_log_file, '50 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
68
|
+
# sleep(1)
|
|
69
|
+
# File.write(progress_log_file, '100 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
70
|
+
# sleep(0.5)
|
|
71
|
+
# wait_thr.stubs(:alive?).returns(false)
|
|
72
|
+
# end
|
|
73
|
+
|
|
74
|
+
# percentages = []
|
|
75
|
+
# installer.install_version(
|
|
76
|
+
# # version: the version to install
|
|
77
|
+
# '9.3',
|
|
78
|
+
# # `should_switch
|
|
79
|
+
# false,
|
|
80
|
+
# # `should_clean`
|
|
81
|
+
# false, # false for now for faster debugging
|
|
82
|
+
# # `should_install`
|
|
83
|
+
# true,
|
|
84
|
+
# # `progress`
|
|
85
|
+
# false,
|
|
86
|
+
# # `url` is nil, as we don't have a custom source
|
|
87
|
+
# nil,
|
|
88
|
+
# # `show_release_notes` is `false`, as this is a non-interactive machine
|
|
89
|
+
# false,
|
|
90
|
+
# # `progress_block` be updated on the download progress
|
|
91
|
+
# proc do |percent|
|
|
92
|
+
# percentages << percent
|
|
93
|
+
# end
|
|
94
|
+
# )
|
|
95
|
+
|
|
96
|
+
# percentages.each do |current_percent|
|
|
97
|
+
# # Verify all reported percentages are between 0 and 100
|
|
98
|
+
# current_percent.should.be.close(50, 50)
|
|
99
|
+
# end
|
|
100
|
+
# # Verify we got a good amount of percentages reported
|
|
101
|
+
# percentages.count.should.be.close(8, 4)
|
|
102
|
+
# end
|
|
103
|
+
# end
|
|
104
|
+
|
|
105
|
+
describe '#find_xcode_version' do
|
|
106
|
+
it 'should find the one with the matching name' do
|
|
12
107
|
installer = Installer.new
|
|
13
108
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
stdin.stubs(:close)
|
|
27
|
-
stdout.stubs(:close)
|
|
28
|
-
stderr.stubs(:close)
|
|
29
|
-
|
|
30
|
-
current_time = '123123'
|
|
31
|
-
Time.stubs(:now).returns(current_time)
|
|
32
|
-
|
|
33
|
-
xip_path = File.join(File.expand_path('~'), '/Library/Caches/XcodeInstall/Xcode_9.3.xip')
|
|
34
|
-
progress_log_file = File.join(File.expand_path('~'), "/Library/Caches/XcodeInstall/progress.#{current_time}.progress")
|
|
35
|
-
|
|
36
|
-
command = [
|
|
37
|
-
'curl',
|
|
38
|
-
'--disable',
|
|
39
|
-
'--cookie customCookie',
|
|
40
|
-
'--cookie-jar /tmp/curl-cookies.txt',
|
|
41
|
-
'--retry 3',
|
|
42
|
-
'--location',
|
|
43
|
-
'--continue-at -',
|
|
44
|
-
"--output #{xip_path}",
|
|
45
|
-
'https://developer.apple.com/devcenter/download.action\\?path\\=/Developer_Tools/Xcode_9.3/Xcode_9.3.xip',
|
|
46
|
-
"2> #{progress_log_file}"
|
|
109
|
+
xcodes = [
|
|
110
|
+
XcodeInstall::Xcode.new('name' => '11.4 beta 2',
|
|
111
|
+
'dateModified' => '12/11/19 14:28',
|
|
112
|
+
'files' => [{
|
|
113
|
+
'remotePath' => '/Developer_Tools/Xcode_11.4_beta_2/Xcode_11.4_beta_2.xip'
|
|
114
|
+
}]),
|
|
115
|
+
XcodeInstall::Xcode.new('name' => '11.4',
|
|
116
|
+
'dateModified' => '12/15/19 11:28',
|
|
117
|
+
'files' => [{
|
|
118
|
+
'remotePath' => '/Developer_Tools/Xcode_11.4/Xcode_11.4.xip'
|
|
119
|
+
}])
|
|
47
120
|
]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
thr_value = 'thr_value'
|
|
53
|
-
wait_thr.stubs(:value).returns(thr_value)
|
|
54
|
-
thr_value.stubs(:success?).returns(true)
|
|
55
|
-
|
|
56
|
-
installer.stubs(:install_dmg).with(Pathname.new(xip_path), '-9.3', false, false)
|
|
57
|
-
|
|
58
|
-
Thread.new do
|
|
59
|
-
sleep(1)
|
|
60
|
-
File.write(progress_log_file, ' 0 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
61
|
-
sleep(1)
|
|
62
|
-
File.write(progress_log_file, ' 5 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
63
|
-
sleep(1)
|
|
64
|
-
File.write(progress_log_file, '50 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
65
|
-
sleep(1)
|
|
66
|
-
File.write(progress_log_file, '100 4766M 0 6835k 0 0 573k 0 2:21:58 0:00:11 2:21:47 902k')
|
|
67
|
-
sleep(0.5)
|
|
68
|
-
wait_thr.stubs(:alive?).returns(false)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
percentages = []
|
|
72
|
-
installer.install_version(
|
|
73
|
-
# version: the version to install
|
|
74
|
-
'9.3',
|
|
75
|
-
# `should_switch
|
|
76
|
-
false,
|
|
77
|
-
# `should_clean`
|
|
78
|
-
false, # false for now for faster debugging
|
|
79
|
-
# `should_install`
|
|
80
|
-
true,
|
|
81
|
-
# `progress`
|
|
82
|
-
false,
|
|
83
|
-
# `url` is nil, as we don't have a custom source
|
|
84
|
-
nil,
|
|
85
|
-
# `show_release_notes` is `false`, as this is a non-interactive machine
|
|
86
|
-
false,
|
|
87
|
-
# `progress_block` be updated on the download progress
|
|
88
|
-
proc do |percent|
|
|
89
|
-
percentages << percent
|
|
90
|
-
end
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
percentages.each do |current_percent|
|
|
94
|
-
# Verify all reported percentages are between 0 and 100
|
|
95
|
-
current_percent.should.be.close(50, 50)
|
|
96
|
-
end
|
|
97
|
-
# Verify we got a good amount of percentages reported
|
|
98
|
-
percentages.count.should.be.close(8, 4)
|
|
121
|
+
|
|
122
|
+
installer.stubs(:fetch_seedlist).returns(xcodes)
|
|
123
|
+
installer.find_xcode_version('11.4').name.should.be.equal('11.4')
|
|
99
124
|
end
|
|
100
125
|
end
|
|
101
126
|
end
|
data/spec/json_spec.rb
CHANGED
|
@@ -6,9 +6,9 @@ module XcodeInstall
|
|
|
6
6
|
fixture = Pathname.new('spec/fixtures/xcode.json').read
|
|
7
7
|
xcode = Xcode.new(JSON.parse(fixture))
|
|
8
8
|
|
|
9
|
-
xcode.date_modified.should ==
|
|
10
|
-
xcode.name.should == '
|
|
11
|
-
xcode.url.should == 'https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/
|
|
9
|
+
xcode.date_modified.should == 1_572_613_080
|
|
10
|
+
xcode.name.should == '9.3'
|
|
11
|
+
xcode.url.should == 'https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_9.3/Xcode_9.3.xip'
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it 'can parse list of all Xcodes' do
|
|
@@ -19,7 +19,17 @@ module XcodeInstall
|
|
|
19
19
|
installer.stubs(:installed_versions).returns([])
|
|
20
20
|
installer.stubs(:xcodes).returns(seedlist)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
versions = [
|
|
23
|
+
'4.3 for Lion', '4.3.1 for Lion', '4.3.2 for Lion', '4.3.3 for Lion', '4.4.1', '4.5', '4.6', '4.6.1', '4.6.2', '4.6.3',
|
|
24
|
+
'5', '5.0.1', '5.0.2', '5.1', '5.1.1',
|
|
25
|
+
'6.0.1', '6.1', '6.1.1', '6.2', '6.3', '6.3.1', '6.3.2', '6.4',
|
|
26
|
+
'7', '7.0.1', '7.1', '7.1.1', '7.2', '7.2.1', '7.3', '7.3.1',
|
|
27
|
+
'8', '8.1', '8.2', '8.2.1', '8.3', '8.3.2', '8.3.3',
|
|
28
|
+
'9', '9.0.1', '9.1', '9.2', '9.3', '9.3.1', '9.4', '9.4.1',
|
|
29
|
+
'10', '10.1', '10.2', '10.2.1', '10.3',
|
|
30
|
+
'11', '11.1', '11.2', '11.2.1', '11.3 beta', '11.3', '11.3.1', '11.4 beta', '11.4 beta 2', '11.4 beta 3', '11.4', '11.4.1', '11.5 beta', '11.5 beta 2', '11.5 GM Seed', '11.5'
|
|
31
|
+
]
|
|
32
|
+
installer.list.split("\n").should == versions
|
|
23
33
|
end
|
|
24
34
|
|
|
25
35
|
it 'raises informative error when account is not registered as a developer' do
|
data/spec/list_spec.rb
CHANGED
|
@@ -23,8 +23,9 @@ module XcodeInstall
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def fake_installed_xcode(name)
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
installed_name = name.split(' ').join('.')
|
|
27
|
+
xcode_path = "/Applications/Xcode-#{installed_name}.app"
|
|
28
|
+
xcode_version = name.split(' ').first
|
|
28
29
|
xcode_version << '.0' unless name.include? '.'
|
|
29
30
|
|
|
30
31
|
installed_xcode = InstalledXcode.new(xcode_path)
|
|
@@ -44,14 +45,42 @@ module XcodeInstall
|
|
|
44
45
|
fake_installed_xcodes
|
|
45
46
|
installer.list.should == "1\n2.3\n2.3.1\n2.3.2\n3 some\n4 beta\n10 beta"
|
|
46
47
|
end
|
|
48
|
+
|
|
49
|
+
it 'lists all versions in the correct order' do
|
|
50
|
+
fake_xcodes(
|
|
51
|
+
'12 beta 4', '12 beta 3', '12 beta 2', '12 for macOS Universal Apps beta 2',
|
|
52
|
+
'12 beta', '12 for macOS Universal Apps beta', '12.0.1', '12', '12 beta 6',
|
|
53
|
+
'12 beta 5', '12.1 GM seed', '12.2 beta 3', '12.2 beta', '12.2 beta 2'
|
|
54
|
+
)
|
|
55
|
+
fake_installed_xcodes
|
|
56
|
+
|
|
57
|
+
versions = [
|
|
58
|
+
'12 beta', '12 beta 2', '12 beta 3', '12 beta 4', '12 beta 5', '12 beta 6',
|
|
59
|
+
'12 for macOS Universal Apps beta', '12 for macOS Universal Apps beta 2',
|
|
60
|
+
'12', '12.0.1', '12.1 GM seed', '12.2 beta', '12.2 beta 2', '12.2 beta 3'
|
|
61
|
+
]
|
|
62
|
+
installer.list.split("\n").should == versions
|
|
63
|
+
end
|
|
47
64
|
end
|
|
48
65
|
|
|
49
66
|
describe '#list_annotated' do
|
|
50
67
|
it 'lists all versions with annotations' do
|
|
51
68
|
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'
|
|
69
|
+
fake_installed_xcodes '2.3', '4.3.1 for Lion', '10 beta'
|
|
53
70
|
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)"
|
|
54
71
|
end
|
|
72
|
+
|
|
73
|
+
it 'distinguish between beta and official_version' do
|
|
74
|
+
fake_xcodes '11.4', '11.4 beta'
|
|
75
|
+
fake_installed_xcodes '11.4'
|
|
76
|
+
installer.list.should == "11.4 beta\n11.4 (installed)"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'distinguish each beta versions' do
|
|
80
|
+
fake_xcodes '11.4 beta 3', '11.4 beta'
|
|
81
|
+
fake_installed_xcodes '11.4 beta'
|
|
82
|
+
installer.list.should == "11.4 beta (installed)\n11.4 beta 3"
|
|
83
|
+
end
|
|
55
84
|
end
|
|
56
85
|
end
|
|
57
86
|
end
|
data/xcode-install.gemspec
CHANGED
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.6.
|
|
4
|
+
version: 2.6.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Boris Bügling
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: claide
|
|
@@ -68,16 +68,16 @@ dependencies:
|
|
|
68
68
|
name: rake
|
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
|
-
- - "
|
|
71
|
+
- - ">="
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version:
|
|
73
|
+
version: 12.3.3
|
|
74
74
|
type: :development
|
|
75
75
|
prerelease: false
|
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
|
-
- - "
|
|
78
|
+
- - ">="
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version:
|
|
80
|
+
version: 12.3.3
|
|
81
81
|
description: Download, install and upgrade Xcodes with ease.
|
|
82
82
|
email:
|
|
83
83
|
- boris@icculus.org
|
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
|
89
89
|
files:
|
|
90
90
|
- ".circleci/config.yml"
|
|
91
91
|
- ".gitattributes"
|
|
92
|
+
- ".github/workflows/ci.yml"
|
|
92
93
|
- ".gitignore"
|
|
93
94
|
- ".rubocop.yml"
|
|
94
95
|
- ".rubocop_todo.yml"
|
|
@@ -144,7 +145,7 @@ homepage: https://github.com/neonichu/xcode-install
|
|
|
144
145
|
licenses:
|
|
145
146
|
- MIT
|
|
146
147
|
metadata: {}
|
|
147
|
-
post_install_message:
|
|
148
|
+
post_install_message:
|
|
148
149
|
rdoc_options: []
|
|
149
150
|
require_paths:
|
|
150
151
|
- lib
|
|
@@ -159,8 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
159
160
|
- !ruby/object:Gem::Version
|
|
160
161
|
version: '0'
|
|
161
162
|
requirements: []
|
|
162
|
-
rubygems_version: 3.
|
|
163
|
-
signing_key:
|
|
163
|
+
rubygems_version: 3.1.4
|
|
164
|
+
signing_key:
|
|
164
165
|
specification_version: 4
|
|
165
166
|
summary: Xcode installation manager.
|
|
166
167
|
test_files:
|