xcode-install 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +33 -0
- data/README.md +1 -1
- data/lib/xcode/install.rb +41 -18
- data/lib/xcode/install/cli.rb +4 -1
- data/lib/xcode/install/version.rb +1 -1
- data/spec/installer_spec.rb +1 -0
- metadata +4 -5
- data/circle.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 968729b1842c8f61bb71810891dd3690dd6153c64227c997e8688f1edf930b4c
|
4
|
+
data.tar.gz: 04f1e73ff7d6a7dbc33744dccc61e7f87cad8d2557d0535c85d1f502ca86f59e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f00f1dd8776dd06b58da3f4142f802af2efb248eb9fb96609148d64d909bac042b8dc55866b3f36f467cb2b80ee172977579b9ab512c5d1e13b0df230e40f3be
|
7
|
+
data.tar.gz: c2cf129e9f2afd1257243585c3c5c517f54d0d7336f86c151431fa0c57a69dc5f6aa468d7cc48d312d1ecb20e38857a24cabaf5e0e4139c7a946075bc572a13d
|
@@ -0,0 +1,33 @@
|
|
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
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Xcode::Install
|
2
2
|
|
3
|
-
[![Gem Version](http://img.shields.io/gem/v/xcode-install.svg?style=flat)](http://badge.fury.io/rb/xcode-install) [![CircleCI](https://circleci.com/gh/
|
3
|
+
[![Gem Version](http://img.shields.io/gem/v/xcode-install.svg?style=flat)](http://badge.fury.io/rb/xcode-install) [![CircleCI](https://circleci.com/gh/xcpretty/xcode-install.svg?style=svg)](https://circleci.com/gh/xcpretty/xcode-install)
|
4
4
|
|
5
5
|
Install and update your Xcodes automatically.
|
6
6
|
|
data/lib/xcode/install.rb
CHANGED
@@ -8,7 +8,8 @@ require 'xcode/install/command'
|
|
8
8
|
require 'xcode/install/version'
|
9
9
|
require 'shellwords'
|
10
10
|
require 'open3'
|
11
|
-
require '
|
11
|
+
require 'fastlane/action'
|
12
|
+
require 'fastlane/actions/verify_build'
|
12
13
|
|
13
14
|
module XcodeInstall
|
14
15
|
CACHE_DIR = Pathname.new("#{ENV['HOME']}/Library/Caches/XcodeInstall")
|
@@ -57,6 +58,7 @@ module XcodeInstall
|
|
57
58
|
retry_options = ['--retry', '3']
|
58
59
|
command = [
|
59
60
|
'curl',
|
61
|
+
'--disable',
|
60
62
|
*options,
|
61
63
|
*retry_options,
|
62
64
|
'--location',
|
@@ -210,14 +212,13 @@ module XcodeInstall
|
|
210
212
|
end
|
211
213
|
|
212
214
|
def install_dmg(dmg_path, suffix = '', switch = true, clean = true)
|
213
|
-
archive_util = '/System/Library/CoreServices/Applications/Archive Utility.app/Contents/MacOS/Archive Utility'
|
214
215
|
prompt = "Please authenticate for Xcode installation.\nPassword: "
|
215
216
|
xcode_path = "/Applications/Xcode#{suffix}.app"
|
216
217
|
|
217
218
|
if dmg_path.extname == '.xip'
|
218
|
-
`
|
219
|
-
xcode_orig_path =
|
220
|
-
xcode_beta_path =
|
219
|
+
`xip -x #{dmg_path}`
|
220
|
+
xcode_orig_path = File.join(Dir.pwd, 'Xcode.app')
|
221
|
+
xcode_beta_path = File.join(Dir.pwd, 'Xcode-beta.app')
|
221
222
|
if Pathname.new(xcode_orig_path).exist?
|
222
223
|
`sudo -p "#{prompt}" mv "#{xcode_orig_path}" "#{xcode_path}"`
|
223
224
|
elsif Pathname.new(xcode_beta_path).exist?
|
@@ -250,13 +251,14 @@ HELP
|
|
250
251
|
`umount "/Volumes/Xcode"`
|
251
252
|
end
|
252
253
|
|
253
|
-
|
254
|
+
xcode = InstalledXcode.new(xcode_path)
|
255
|
+
|
256
|
+
unless xcode.verify_integrity
|
254
257
|
`sudo rm -rf #{xcode_path}`
|
255
258
|
return
|
256
259
|
end
|
257
260
|
|
258
261
|
enable_developer_mode
|
259
|
-
xcode = InstalledXcode.new(xcode_path)
|
260
262
|
xcode.approve_license
|
261
263
|
xcode.install_components
|
262
264
|
|
@@ -364,8 +366,9 @@ HELP
|
|
364
366
|
return path if path.exist?
|
365
367
|
end
|
366
368
|
if ENV.key?('XCODE_INSTALL_CACHE_DIR')
|
367
|
-
|
368
|
-
|
369
|
+
Pathname.glob(ENV['XCODE_INSTALL_CACHE_DIR'] + '/*').each do |fpath|
|
370
|
+
return fpath if /^xcode_#{version}\.dmg|xip$/ =~ fpath.basename.to_s
|
371
|
+
end
|
369
372
|
end
|
370
373
|
|
371
374
|
download(version, progress, url, progress_block)
|
@@ -448,11 +451,6 @@ HELP
|
|
448
451
|
links
|
449
452
|
end
|
450
453
|
|
451
|
-
def verify_integrity(path)
|
452
|
-
puts `/usr/sbin/spctl --assess --verbose=4 --type execute #{path}`
|
453
|
-
$?.exitstatus.zero?
|
454
|
-
end
|
455
|
-
|
456
454
|
def hdiutil(*args)
|
457
455
|
io = IO.popen(['hdiutil', *args])
|
458
456
|
result = io.read
|
@@ -578,6 +576,9 @@ HELP
|
|
578
576
|
end
|
579
577
|
|
580
578
|
class InstalledXcode
|
579
|
+
TEAM_IDENTIFIER = '59GAB85EFG'.freeze
|
580
|
+
AUTHORITY = 'Software Signing'.freeze
|
581
|
+
|
581
582
|
attr_reader :path
|
582
583
|
attr_reader :version
|
583
584
|
attr_reader :bundle_version
|
@@ -613,12 +614,18 @@ HELP
|
|
613
614
|
|
614
615
|
def approve_license
|
615
616
|
if Gem::Version.new(version) < Gem::Version.new('7.3')
|
616
|
-
|
617
|
-
license_id =
|
617
|
+
license_info_path = File.join(@path, 'Contents/Resources/LicenseInfo.plist')
|
618
|
+
license_id = `/usr/libexec/PlistBuddy -c 'Print :licenseID' #{license_info_path}`
|
619
|
+
license_type = `/usr/libexec/PlistBuddy -c 'Print :licenseType' #{license_info_path}`
|
618
620
|
license_plist_path = '/Library/Preferences/com.apple.dt.Xcode.plist'
|
619
621
|
`sudo rm -rf #{license_plist_path}`
|
620
|
-
|
621
|
-
|
622
|
+
if license_type == 'GM'
|
623
|
+
`sudo /usr/libexec/PlistBuddy -c "add :IDELastGMLicenseAgreedTo string #{license_id}" #{license_plist_path}`
|
624
|
+
`sudo /usr/libexec/PlistBuddy -c "add :IDEXcodeVersionForAgreedToGMLicense string #{version}" #{license_plist_path}`
|
625
|
+
else
|
626
|
+
`sudo /usr/libexec/PlistBuddy -c "add :IDELastBetaLicenseAgreedTo string #{license_id}" #{license_plist_path}`
|
627
|
+
`sudo /usr/libexec/PlistBuddy -c "add :IDEXcodeVersionForAgreedToBetaLicense string #{version}" #{license_plist_path}`
|
628
|
+
end
|
622
629
|
else
|
623
630
|
`sudo #{@path}/Contents/Developer/usr/bin/xcodebuild -license accept`
|
624
631
|
end
|
@@ -655,6 +662,10 @@ HELP
|
|
655
662
|
output.split("\n").first.split(' ')[1]
|
656
663
|
end
|
657
664
|
|
665
|
+
def verify_integrity
|
666
|
+
verify_app_security_assessment && verify_app_cert
|
667
|
+
end
|
668
|
+
|
658
669
|
:private
|
659
670
|
|
660
671
|
def bundle_version_string
|
@@ -669,6 +680,18 @@ HELP
|
|
669
680
|
def plist_entry(keypath)
|
670
681
|
`/usr/libexec/PlistBuddy -c "Print :#{keypath}" "#{path}/Contents/Info.plist"`.chomp
|
671
682
|
end
|
683
|
+
|
684
|
+
def verify_app_security_assessment
|
685
|
+
puts `/usr/sbin/spctl --assess --verbose=4 --type execute #{@path}`
|
686
|
+
$?.exitstatus.zero?
|
687
|
+
end
|
688
|
+
|
689
|
+
def verify_app_cert
|
690
|
+
cert_info = Fastlane::Actions::VerifyBuildAction.gather_cert_info(@path.to_s)
|
691
|
+
apple_team_identifier_result = cert_info['team_identifier'] == TEAM_IDENTIFIER
|
692
|
+
apple_authority_result = cert_info['authority'].include?(AUTHORITY)
|
693
|
+
apple_team_identifier_result && apple_authority_result
|
694
|
+
end
|
672
695
|
end
|
673
696
|
|
674
697
|
# A version of Xcode we fetched from the Apple Developer Portal
|
data/lib/xcode/install/cli.rb
CHANGED
@@ -5,7 +5,10 @@ module XcodeInstall
|
|
5
5
|
self.summary = 'Installs Xcode Command Line Tools.'
|
6
6
|
|
7
7
|
def run
|
8
|
-
|
8
|
+
if installed?
|
9
|
+
print 'Xcode CLI Tools are already installed.'
|
10
|
+
exit(0)
|
11
|
+
end
|
9
12
|
install
|
10
13
|
end
|
11
14
|
|
data/spec/installer_spec.rb
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.
|
4
|
+
version: 2.6.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:
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: claide
|
@@ -87,6 +87,7 @@ executables:
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".circleci/config.yml"
|
90
91
|
- ".gitattributes"
|
91
92
|
- ".gitignore"
|
92
93
|
- ".rubocop.yml"
|
@@ -97,7 +98,6 @@ files:
|
|
97
98
|
- Rakefile
|
98
99
|
- bin/xcversion
|
99
100
|
- "bin/\U0001F389"
|
100
|
-
- circle.yml
|
101
101
|
- lib/xcode/install.rb
|
102
102
|
- lib/xcode/install/cleanup.rb
|
103
103
|
- lib/xcode/install/cli.rb
|
@@ -159,8 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
|
-
|
163
|
-
rubygems_version: 2.6.8
|
162
|
+
rubygems_version: 3.0.1
|
164
163
|
signing_key:
|
165
164
|
specification_version: 4
|
166
165
|
summary: Xcode installation manager.
|