xcode-install 2.1.1 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 425c3fc2af23deed5eced899dd8872ad250400c8
4
- data.tar.gz: f5c3e3d584a870cff1cc3759042bda3f7664b942
3
+ metadata.gz: 3d26fe330e988d0a313ffeac4386ffa27edeff03
4
+ data.tar.gz: c2d3bc67f1412c9e229697e9d7d7dcbbb96ff03a
5
5
  SHA512:
6
- metadata.gz: 356735fa355bb556d8016bae1843905a0b81617f7477b11259799a8df5d99bfb4ff30b533a66b41033515e200f42135865c8d070c9ac31148508489609cf2981
7
- data.tar.gz: 591bda404fc8e63ab6ac8c55208a8d32052d8b5e515893343f09c0f852aa0e5f03a93e04413ef48a2ea51b8e78f696de357e738c762fe49d326da6d769753ab8
6
+ metadata.gz: b712a71ce8325eab4b1afc9ba3434ae93593b31c7987d0418062dde651d114ddffe39d6d155fa3e8ce44f88cd096e36cf84691ee2c99f03fb1af0b958b204c2c
7
+ data.tar.gz: fcf747735c56f7352bee1cc492dfe95813e3caa118ab8a49cd88058cd3ffa467920ee34edfbe8c3630536e8cd1ccf6403e226f5c7969f3c09832f5c7f63899b7
@@ -1,34 +1,78 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-04-26 22:45:06 -0700 using RuboCop version 0.35.1.
3
+ # on 2017-06-12 12:01:46 +0100 using RuboCop version 0.49.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 11
9
+ # Offense count: 3
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
12
+ # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
13
+ Layout/IndentHeredoc:
14
+ Exclude:
15
+ - 'lib/xcode/install.rb'
16
+
17
+ # Offense count: 12
10
18
  Metrics/AbcSize:
11
- Max: 39
19
+ Max: 44
20
+
21
+ # Offense count: 4
22
+ # Configuration parameters: CountComments, ExcludedMethods.
23
+ Metrics/BlockLength:
24
+ Max: 76
12
25
 
13
26
  # Offense count: 1
14
27
  # Configuration parameters: CountComments.
15
28
  Metrics/ClassLength:
16
- Max: 226
29
+ Max: 252
17
30
 
18
31
  # Offense count: 3
19
32
  Metrics/CyclomaticComplexity:
20
- Max: 8
33
+ Max: 10
21
34
 
22
- # Offense count: 10
35
+ # Offense count: 12
23
36
  # Configuration parameters: CountComments.
24
37
  Metrics/MethodLength:
25
- Max: 40
38
+ Max: 51
26
39
 
27
40
  # Offense count: 1
28
41
  # Configuration parameters: CountKeywordArgs.
29
42
  Metrics/ParameterLists:
30
43
  Max: 6
31
44
 
32
- # Offense count: 2
45
+ # Offense count: 3
33
46
  Metrics/PerceivedComplexity:
34
- Max: 9
47
+ Max: 12
48
+
49
+ # Offense count: 1
50
+ # Cop supports --auto-correct.
51
+ Performance/CompareWithBlock:
52
+ Exclude:
53
+ - 'lib/xcode/install.rb'
54
+
55
+ # Offense count: 1
56
+ # Cop supports --auto-correct.
57
+ # Configuration parameters: IncludeActiveSupportAliases.
58
+ Performance/DoubleStartEndWith:
59
+ Exclude:
60
+ - 'lib/xcode/install.rb'
61
+
62
+ # Offense count: 1
63
+ Security/MarshalLoad:
64
+ Exclude:
65
+ - 'lib/xcode/install.rb'
66
+
67
+ # Offense count: 13
68
+ # Cop supports --auto-correct.
69
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
70
+ # SupportedStyles: only_raise, only_fail, semantic
71
+ Style/SignalException:
72
+ Exclude:
73
+ - 'lib/xcode/install.rb'
74
+ - 'lib/xcode/install/cli.rb'
75
+ - 'lib/xcode/install/install.rb'
76
+ - 'lib/xcode/install/select.rb'
77
+ - 'lib/xcode/install/simulators.rb'
78
+ - 'lib/xcode/install/uninstall.rb'
data/Gemfile CHANGED
@@ -4,9 +4,9 @@ gemspec
4
4
 
5
5
  group :development do
6
6
  gem 'bacon'
7
- gem 'mocha-on-bacon'
7
+ gem 'coveralls', require: false
8
8
  gem 'mocha', '~> 0.11.4'
9
+ gem 'mocha-on-bacon'
9
10
  gem 'prettybacon'
10
- gem 'rubocop', '0.35.1'
11
- gem 'coveralls', require: false
11
+ gem 'rubocop', '~> 0.49.1', require: false
12
12
  end
data/Rakefile CHANGED
@@ -13,4 +13,4 @@ end
13
13
  desc 'Lints all the files'
14
14
  RuboCop::RakeTask.new(:rubocop)
15
15
 
16
- task default: [:spec, :rubocop]
16
+ task default: %i[spec rubocop]
@@ -1 +1 @@
1
- xcversion
1
+ bin/xcversion
@@ -20,16 +20,25 @@ module XcodeInstall
20
20
  output ||= File.basename(uri.path)
21
21
  output = (Pathname.new(directory) + Pathname.new(output)) if directory
22
22
 
23
+ retry_options = ['--retry', '3']
23
24
  progress = progress ? '--progress-bar' : '--silent'
24
- command = ['curl', *options, '--location', '--continue-at', '-', progress, '--output', output, url].map(&:to_s)
25
- io = IO.popen(command)
26
- io.each { |line| puts line }
27
- io.close
28
-
29
- result = $?.exitstatus == 0
30
-
25
+ command = ['curl', *options, *retry_options, '--location', '--continue-at', '-', progress, '--output', output, url].map(&:to_s)
26
+
27
+ # Run the curl command in a loop, retry when curl exit status is 18
28
+ # "Partial file. Only a part of the file was transferred."
29
+ # https://curl.haxx.se/mail/archive-2008-07/0098.html
30
+ # https://github.com/KrauseFx/xcode-install/issues/210
31
+ 3.times do
32
+ io = IO.popen(command)
33
+ io.each { |line| puts line }
34
+ io.close
35
+
36
+ exit_code = $?.exitstatus
37
+ return exit_code.zero? unless exit_code == 18
38
+ end
39
+ false
40
+ ensure
31
41
  FileUtils.rm_f(COOKIES_PATH)
32
- result
33
42
  end
34
43
  end
35
44
 
@@ -113,7 +122,7 @@ HELP
113
122
  end
114
123
 
115
124
  unless verify_integrity(xcode_path)
116
- `sudo rm -f #{xcode_path}`
125
+ `sudo rm -rf #{xcode_path}`
117
126
  return
118
127
  end
119
128
 
@@ -251,7 +260,7 @@ HELP
251
260
  names = @xcodes.map(&:name)
252
261
  @xcodes += prereleases.reject { |pre| names.include?(pre.name) }
253
262
 
254
- File.open(LIST_FILE, 'w') do |f|
263
+ File.open(LIST_FILE, 'wb') do |f|
255
264
  f << Marshal.dump(xcodes)
256
265
  end
257
266
 
@@ -298,11 +307,11 @@ HELP
298
307
  end
299
308
  links = links.map { |pre| Xcode.new_prerelease(pre[2].strip.gsub(/.*Xcode /, ''), pre[0], pre[3]) }
300
309
 
301
- if links.count == 0
310
+ if links.count.zero?
302
311
  rg = %r{platform-title.*Xcode.* beta.*<\/p>}
303
312
  scan = body.scan(rg)
304
313
 
305
- if scan.count == 0
314
+ if scan.count.zero?
306
315
  rg = %r{Xcode.* GM.*<\/p>}
307
316
  scan = body.scan(rg)
308
317
  end
@@ -325,14 +334,14 @@ HELP
325
334
 
326
335
  def verify_integrity(path)
327
336
  puts `/usr/sbin/spctl --assess --verbose=4 --type execute #{path}`
328
- $?.exitstatus == 0
337
+ $?.exitstatus.zero?
329
338
  end
330
339
 
331
340
  def hdiutil(*args)
332
341
  io = IO.popen(['hdiutil', *args])
333
342
  result = io.read
334
343
  io.close
335
- unless $?.exitstatus == 0
344
+ unless $?.exitstatus.zero?
336
345
  file_path = args[-1]
337
346
  if `file -b #{file_path}`.start_with?('HTML')
338
347
  fail Informative, "Failed to mount #{file_path}, logging into your account from a browser should tell you what is going wrong."
@@ -379,13 +388,13 @@ HELP
379
388
  end
380
389
  end
381
390
 
382
- def download
383
- result = Curl.new.fetch(source, CACHE_DIR)
391
+ def download(progress)
392
+ result = Curl.new.fetch(source, CACHE_DIR, nil, nil, progress)
384
393
  result ? dmg_path : nil
385
394
  end
386
395
 
387
- def install
388
- download unless dmg_path.exist?
396
+ def install(progress)
397
+ download(progress)
389
398
  prepare_package unless pkg_path.exist?
390
399
  puts "Please authenticate to install #{name}..."
391
400
  `sudo installer -pkg #{pkg_path} -target /`
@@ -491,11 +500,19 @@ HELP
491
500
  @available_simulators ||= JSON.parse(`curl -Ls #{downloadable_index_url} | plutil -convert json -o - -`)['downloadables'].map do |downloadable|
492
501
  Simulator.new(downloadable)
493
502
  end
503
+ rescue JSON::ParserError
504
+ return []
494
505
  end
495
506
 
496
507
  def install_components
497
- Dir.glob("#{@path}/Contents/Resources/Packages/*.pkg").each do |pkg|
498
- `sudo installer -pkg #{pkg} -target /`
508
+ # starting with Xcode 9, we have `xcodebuild -runFirstLaunch` available to do package
509
+ # postinstalls using a documented option
510
+ if Gem::Version.new(@version) >= Gem::Version.new('9')
511
+ `sudo #{@path}/Contents/Developer/usr/bin/xcodebuild -runFirstLaunch`
512
+ else
513
+ Dir.glob("#{@path}/Contents/Resources/Packages/*.pkg").each do |pkg|
514
+ `sudo installer -pkg #{pkg} -target /`
515
+ end
499
516
  end
500
517
  osx_build_version = `sw_vers -buildVersion`.chomp
501
518
  tools_version = `/usr/libexec/PlistBuddy -c "Print :ProductBuildVersion" "#{@path}/Contents/version.plist"`.chomp
@@ -511,7 +528,7 @@ HELP
511
528
 
512
529
  def fetch_version
513
530
  output = `DEVELOPER_DIR='' "#{@path}/Contents/Developer/usr/bin/xcodebuild" -version`
514
- return '0.0' if output.nil? # ¯\_(ツ)_/¯
531
+ return '0.0' if output.nil? || output.empty? # ¯\_(ツ)_/¯
515
532
  output.split("\n").first.split(' ')[1]
516
533
  end
517
534
  end
@@ -7,12 +7,14 @@ module XcodeInstall
7
7
  self.summary = 'List or install iOS simulators.'
8
8
 
9
9
  def self.options
10
- [['--install=name', 'Install simulator beginning with name, e.g. \'iOS 8.4\', \'tvOS 9.0\'.']].concat(super)
10
+ [['--install=name', 'Install simulator beginning with name, e.g. \'iOS 8.4\', \'tvOS 9.0\'.'],
11
+ ['--no-progress', 'Don’t show download progress.']].concat(super)
11
12
  end
12
13
 
13
14
  def initialize(argv)
14
15
  @installed_xcodes = Installer.new.installed_versions
15
16
  @install = argv.option('install')
17
+ @progress = argv.flag?('progress', true)
16
18
  super
17
19
  end
18
20
 
@@ -36,7 +38,7 @@ module XcodeInstall
36
38
  simulator = filtered_simulators.first
37
39
  fail Informative, "#{simulator.name} is already installed." if simulator.installed?
38
40
  puts "Installing #{simulator.name} for Xcode #{simulator.xcode.bundle_version}..."
39
- simulator.install
41
+ simulator.install(@progress)
40
42
  else
41
43
  puts "[!] More than one simulator matching #{@install} was found. Please specify the full version.".ansi.red
42
44
  filtered_simulators.each do |candidate|
@@ -1,3 +1,3 @@
1
1
  module XcodeInstall
2
- VERSION = '2.1.1'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
@@ -48,7 +48,7 @@ module XcodeInstall
48
48
  it 'gives more helpful error when downloaded DMG turns out to be HTML' do
49
49
  installer = Installer.new
50
50
  should.raise(Informative) { installer.mount('spec/fixtures/mail-verify.html') }.message
51
- .should.include 'logging into your account from a browser'
51
+ .should.include 'logging into your account from a browser'
52
52
  end
53
53
  end
54
54
  end
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'xcode/install/version'
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.1.1
4
+ version: 2.2.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: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.5.1
161
+ rubygems_version: 2.6.11
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Xcode installation manager.
@@ -189,4 +189,3 @@ test_files:
189
189
  - spec/prerelease_spec.rb
190
190
  - spec/spec_helper.rb
191
191
  - spec/uninstall_spec.rb
192
- has_rdoc: