lib/xcode/install.rb in xcode-install-0.9.5 vs lib/xcode/install.rb in xcode-install-0.9.6

- old
+ new

@@ -55,25 +55,21 @@ def exist?(version) list_versions.include?(version) end - def install_components(xcode_path) - `#{xcode_path}/Contents/MacOS/Xcode -installComponents` - end - def installed?(version) installed_versions.map(&:version).include?(version) end def installed_versions @installed ||= installed.map { |x| InstalledXcode.new(x) }.sort do |a, b| Gem::Version.new(a.version) <=> Gem::Version.new(b.version) end end - def install_dmg(dmgPath, suffix = '', switch = true, clean = true, components = true) + def install_dmg(dmgPath, suffix = '', switch = true, clean = true) xcode_path = "/Applications/Xcode#{suffix}.app" `hdiutil mount -nobrowse -noverify #{dmgPath}` puts 'Please authenticate for Xcode installation...' source = Dir.glob('/Volumes/Xcode/Xcode*.app').first @@ -90,15 +86,15 @@ `sudo ditto "#{source}" "#{xcode_path}"` `umount "/Volumes/Xcode"` if not verify_integrity(xcode_path) `sudo rm -f #{xcode_path}` + return end enable_developer_mode - `sudo xcodebuild -license` unless xcode_license_approved? - install_components(xcode_path) if components + `sudo xcodebuild -license accept` unless xcode_license_approved? if switch `sudo rm -f #{SYMLINK_PATH}` unless current_symlink.nil? `sudo ln -sf #{xcode_path} #{SYMLINK_PATH}` unless SYMLINK_PATH.exist? @@ -107,17 +103,16 @@ end FileUtils.rm_f(dmgPath) if clean end - def install_version(version, switch = true, clean = true, install = true, progress = true, - components = true) + def install_version(version, switch = true, clean = true, install = true, progress = true) return if version.nil? dmg_path = get_dmg(version, progress) fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil? - install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean, components) if install + install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean) if install end def list_current stable_majors = list_versions.reject { |v| /beta/i =~ v }.map { |v| v.split('.')[0] }.map { |v| v.split(' ')[0] } latest_stable_major = stable_majors.select { |v| v.length == 1 }.uniq.sort.last.to_i @@ -243,10 +238,10 @@ @xcodes = Marshal.load(File.read(LIST_FILE)) if LIST_FILE.exist? && xcodes.nil? xcodes || fetch_seedlist end def verify_integrity(path) - puts `codesign --verify --verbose #{path}` + puts `/usr/sbin/spctl --assess --verbose=4 --type execute #{path}` $?.exitstatus == 0 end def xcode_license_approved? !(`/usr/bin/xcrun clang 2>&1` =~ /license/ && !$CHILD_STATUS.success?)