xcode-install 2.3.1 → 2.6.7

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,29 +12,37 @@ 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).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).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).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).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
+
39
+ it 'reads .xcode-version' do
40
+ Installer.any_instance.expects(:download).with('6.3', true, nil, nil, 3).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
@@ -0,0 +1,126 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module XcodeInstall
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")
38
+
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
107
+ installer = Installer.new
108
+
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
+ }])
120
+ ]
121
+
122
+ installer.stubs(:fetch_seedlist).returns(xcodes)
123
+ installer.find_xcode_version('11.4').name.should.be.equal('11.4')
124
+ end
125
+ end
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
@@ -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,64 @@ module XcodeInstall
23
22
  installer.stubs(:xcodes).returns(xcodes)
24
23
  end
25
24
 
25
+ def fake_installed_xcode(name)
26
+ installed_name = name.split(' ').join('.')
27
+ xcode_path = "/Applications/Xcode-#{installed_name}.app"
28
+ xcode_version = name.split(' ').first
29
+ xcode_version << '.0' unless name.include? '.'
30
+
31
+ installed_xcode = InstalledXcode.new(xcode_path)
32
+ installed_xcode.stubs(:version).returns(xcode_version)
33
+ installed_xcode.stubs(:bundle_version).returns(Gem::Version.new(xcode_version))
34
+ installed_xcode
35
+ end
36
+
37
+ def fake_installed_xcodes(*names)
38
+ xcodes = names.map { |name| fake_installed_xcode(name) }
39
+ installer.stubs(:installed_versions).returns(xcodes)
40
+ end
41
+
26
42
  describe '#list' do
27
43
  it 'lists all versions' do
28
- fake_xcodes '1', '2.3', '3 some', '4 beta'
29
- installer.list.should == "1\n2.3\n3 some\n4 beta"
44
+ fake_xcodes '1', '2.3', '2.3.1', '2.3.2', '3 some', '4 beta', '10 beta'
45
+ fake_installed_xcodes
46
+ installer.list.should == "1\n2.3\n2.3.1\n2.3.2\n3 some\n4 beta\n10 beta"
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
64
+ end
65
+
66
+ describe '#list_annotated' do
67
+ it 'lists all versions with annotations' do
68
+ fake_xcodes '1', '2.3', '2.3.1', '2.3.2', '3 some', '4.3.1 for Lion', '9.4.1', '10 beta'
69
+ fake_installed_xcodes '2.3', '4.3.1 for Lion', '10 beta'
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)"
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"
30
83
  end
31
84
  end
32
85
  end
@@ -29,7 +29,7 @@ module XcodeInstall
29
29
  it 'can parse prereleases from 20150414' do
30
30
  prereleases = parse_prereleases('20150414')
31
31
 
32
- prereleases.should == [Xcode.new_prerelease('6.4', '/Developer_Tools/Xcode_6.4_Beta/Xcode_6.4_beta.dmg', '/Developer_Tools/Xcode_6.4_Beta/Xcode_6.4_beta_Release_Notes.pdf')]
32
+ prereleases.should == [Xcode.new_prerelease('6.4 beta', '/Developer_Tools/Xcode_6.4_Beta/Xcode_6.4_beta.dmg', '/Developer_Tools/Xcode_6.4_Beta/Xcode_6.4_beta_Release_Notes.pdf')]
33
33
  end
34
34
 
35
35
  it 'can parse prereleases from 20150427' do
@@ -21,9 +21,12 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
  spec.require_paths = ['lib']
23
23
 
24
+ # CLI parsing
24
25
  spec.add_dependency 'claide', '>= 0.9.1', '< 1.1.0'
26
+
27
+ # contains spaceship, which is used for auth and dev portal interactions
25
28
  spec.add_dependency 'fastlane', '>= 2.1.0', '< 3.0.0'
26
29
 
27
30
  spec.add_development_dependency 'bundler', '~> 1.7'
28
- spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rake', '>= 12.3.3'
29
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.3.1
4
+ version: 2.6.7
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: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2020-10-28 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: '10.0'
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: '10.0'
80
+ version: 12.3.3
81
81
  description: Download, install and upgrade Xcodes with ease.
82
82
  email:
83
83
  - boris@icculus.org
@@ -87,11 +87,12 @@ executables:
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".circleci/config.yml"
90
91
  - ".gitattributes"
92
+ - ".github/workflows/ci.yml"
91
93
  - ".gitignore"
92
94
  - ".rubocop.yml"
93
95
  - ".rubocop_todo.yml"
94
- - ".travis.yml"
95
96
  - Gemfile
96
97
  - LICENSE
97
98
  - README.md
@@ -133,6 +134,7 @@ files:
133
134
  - spec/fixtures/yolo.json
134
135
  - spec/install_spec.rb
135
136
  - spec/installed_spec.rb
137
+ - spec/installer_spec.rb
136
138
  - spec/json_spec.rb
137
139
  - spec/list_spec.rb
138
140
  - spec/prerelease_spec.rb
@@ -143,7 +145,7 @@ homepage: https://github.com/neonichu/xcode-install
143
145
  licenses:
144
146
  - MIT
145
147
  metadata: {}
146
- post_install_message:
148
+ post_install_message:
147
149
  rdoc_options: []
148
150
  require_paths:
149
151
  - lib
@@ -158,9 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
160
  - !ruby/object:Gem::Version
159
161
  version: '0'
160
162
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.6.10
163
- signing_key:
163
+ rubygems_version: 3.0.6
164
+ signing_key:
164
165
  specification_version: 4
165
166
  summary: Xcode installation manager.
166
167
  test_files:
@@ -186,9 +187,9 @@ test_files:
186
187
  - spec/fixtures/yolo.json
187
188
  - spec/install_spec.rb
188
189
  - spec/installed_spec.rb
190
+ - spec/installer_spec.rb
189
191
  - spec/json_spec.rb
190
192
  - spec/list_spec.rb
191
193
  - spec/prerelease_spec.rb
192
194
  - spec/spec_helper.rb
193
195
  - spec/uninstall_spec.rb
194
- has_rdoc:
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- language: ruby
2
- os: osx
3
- osx_image: xcode7.3
4
- rvm: 2.0.0-p598
5
- cache: bundler
6
- before_install:
7
- - gem install bundler
8
- script:
9
- - bundle exec rake spec
10
- - bundle exec rake rubocop