xcode-install 2.6.0 → 2.7.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.
data/spec/install_spec.rb CHANGED
@@ -12,32 +12,32 @@ module XcodeInstall
12
12
  end
13
13
 
14
14
  it 'downloads and installs' do
15
- Installer.any_instance.expects(:download).with('6.3', true, nil, nil).returns('/some/path')
15
+ Installer.any_instance.expects(:download).with('6.3', true, nil, nil, 3).returns('/some/path')
16
16
  Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
17
17
  Command::Install.run(['6.3'])
18
18
  end
19
19
 
20
20
  it 'downloads and installs with custom HTTP URL' do
21
21
  url = 'http://yolo.com/xcode.dmg'
22
- Installer.any_instance.expects(:download).with('6.3', true, url, nil).returns('/some/path')
22
+ Installer.any_instance.expects(:download).with('6.3', true, url, nil, 3).returns('/some/path')
23
23
  Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
24
24
  Command::Install.run(['6.3', "--url=#{url}"])
25
25
  end
26
26
 
27
27
  it 'downloads and installs and does not switch if --no-switch given' do
28
- Installer.any_instance.expects(:download).with('6.3', true, nil, nil).returns('/some/path')
28
+ Installer.any_instance.expects(:download).with('6.3', true, nil, nil, 3).returns('/some/path')
29
29
  Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', false, true)
30
30
  Command::Install.run(['6.3', '--no-switch'])
31
31
  end
32
32
 
33
33
  it 'downloads without progress if switch --no-progress is given' do
34
- Installer.any_instance.expects(:download).with('6.3', false, nil, nil).returns('/some/path')
34
+ Installer.any_instance.expects(:download).with('6.3', false, nil, nil, 3).returns('/some/path')
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
38
 
39
39
  it 'reads .xcode-version' do
40
- Installer.any_instance.expects(:download).with('6.3', true, nil, nil).returns('/some/path')
40
+ Installer.any_instance.expects(:download).with('6.3', true, nil, nil, 3).returns('/some/path')
41
41
  Installer.any_instance.expects(:install_dmg).with('/some/path', '-6.3', true, true)
42
42
  File.expects(:exist?).with('.xcode-version').returns(true)
43
43
  File.expects(:read).returns('6.3')
@@ -1,101 +1,126 @@
1
1
  require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  module XcodeInstall
4
- describe '#fetch' do
5
- before do
6
- client = mock
7
- client.stubs(:cookie).returns('customCookie')
8
- Spaceship::PortalClient.stubs(:login).returns(client)
9
- end
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
- it 'downloads the file and calls the `progress_block` with the percentage' do
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
- xcode = XcodeInstall::Xcode.new('name' => 'Xcode 9.3',
15
- 'files' => [{
16
- 'remotePath' => '/Developer_Tools/Xcode_9.3/Xcode_9.3.xip'
17
- }])
18
-
19
- installer.stubs(:fetch_seedlist).returns([xcode])
20
-
21
- stdin = 'stdin'
22
- stdout = 'stdout'
23
- stderr = 'stderr'
24
- wait_thr = 'wait_thr'
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
- Open3.stubs(:popen3).with(command.join(' ')).returns([stdin, stdout, stderr, wait_thr])
49
-
50
- wait_thr.stubs(:alive?).returns(true)
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 == 1_413_472_373_000
10
- xcode.name.should == 'Command Line Tools (OS X 10.9) for Xcode - Xcode 6.1'
11
- xcode.url.should == 'https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/command_line_tools_os_x_10.9_for_xcode__xcode_6.1/command_line_tools_for_osx_10.9_for_xcode_6.1.dmg'
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
- installer.list.should == "6.1\n6.1.1\n6.2"
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
- xcode_path = "/Applications/Xcode-#{name}.app"
27
- xcode_version = name
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
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  # contains spaceship, which is used for auth and dev portal interactions
28
28
  spec.add_dependency 'fastlane', '>= 2.1.0', '< 3.0.0'
29
29
 
30
- spec.add_development_dependency 'bundler', '~> 1.7'
31
- spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'bundler', '>= 2.0.0', '< 3.0.0'
31
+ spec.add_development_dependency 'rake', '>= 12.3.3'
32
32
  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.6.0
4
+ version: 2.7.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: 2019-07-23 00:00:00.000000000 Z
11
+ date: 2021-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -54,30 +54,36 @@ dependencies:
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.0.0
60
+ - - "<"
58
61
  - !ruby/object:Gem::Version
59
- version: '1.7'
62
+ version: 3.0.0
60
63
  type: :development
61
64
  prerelease: false
62
65
  version_requirements: !ruby/object:Gem::Requirement
63
66
  requirements:
64
- - - "~>"
67
+ - - ">="
65
68
  - !ruby/object:Gem::Version
66
- version: '1.7'
69
+ version: 2.0.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: 3.0.0
67
73
  - !ruby/object:Gem::Dependency
68
74
  name: rake
69
75
  requirement: !ruby/object:Gem::Requirement
70
76
  requirements:
71
- - - "~>"
77
+ - - ">="
72
78
  - !ruby/object:Gem::Version
73
- version: '10.0'
79
+ version: 12.3.3
74
80
  type: :development
75
81
  prerelease: false
76
82
  version_requirements: !ruby/object:Gem::Requirement
77
83
  requirements:
78
- - - "~>"
84
+ - - ">="
79
85
  - !ruby/object:Gem::Version
80
- version: '10.0'
86
+ version: 12.3.3
81
87
  description: Download, install and upgrade Xcodes with ease.
82
88
  email:
83
89
  - boris@icculus.org
@@ -87,8 +93,8 @@ executables:
87
93
  extensions: []
88
94
  extra_rdoc_files: []
89
95
  files:
90
- - ".circleci/config.yml"
91
96
  - ".gitattributes"
97
+ - ".github/workflows/ci.yml"
92
98
  - ".gitignore"
93
99
  - ".rubocop.yml"
94
100
  - ".rubocop_todo.yml"
@@ -96,6 +102,7 @@ files:
96
102
  - LICENSE
97
103
  - README.md
98
104
  - Rakefile
105
+ - XCODE_VERSION.md
99
106
  - bin/xcversion
100
107
  - "bin/\U0001F389"
101
108
  - lib/xcode/install.rb
@@ -159,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
166
  - !ruby/object:Gem::Version
160
167
  version: '0'
161
168
  requirements: []
162
- rubygems_version: 3.0.1
169
+ rubygems_version: 3.1.4
163
170
  signing_key:
164
171
  specification_version: 4
165
172
  summary: Xcode installation manager.
data/.circleci/config.yml DELETED
@@ -1,33 +0,0 @@
1
- version: 2
2
-
3
- jobs:
4
- build:
5
- macos:
6
- xcode: "9.0"
7
- working_directory: ~/xcode-install
8
- shell: /bin/bash --login -eo pipefail
9
- steps:
10
- - checkout
11
-
12
- # See Also: https://discuss.circleci.com/t/circleci-2-0-ios-error-installing-gems/23291/4
13
- - run:
14
- name: Set Ruby Version
15
- command: echo "ruby-2.4" > ~/.ruby-version
16
-
17
- - run:
18
- name: Install ruby dependencies
19
- command: bundle install
20
-
21
- - run:
22
- name: Run test
23
- command: bundle exec rake spec
24
-
25
- - run:
26
- name: Run lint
27
- command: bundle exec rake rubocop
28
-
29
- workflows:
30
- version: 2
31
- build_and_test:
32
- jobs:
33
- - build