lib/xcode/install.rb in xcode-install-1.3.0 vs lib/xcode/install.rb in xcode-install-1.4.0

- old
+ new

@@ -47,12 +47,12 @@ def current_symlink File.symlink?(SYMLINK_PATH) ? SYMLINK_PATH : nil end def download(version, progress, url = nil) - return unless exist?(version) || url - xcode = seedlist.find { |x| x.name == version } + return unless url || exist?(version) + xcode = seedlist.find { |x| x.name == version } unless url dmg_file = Pathname.new(File.basename(url || xcode.path)) result = Curl.new.fetch(url || xcode.url, CACHE_DIR, url ? nil : spaceship.cookie, dmg_file, progress) result ? CACHE_DIR + dmg_file : nil end @@ -73,11 +73,10 @@ def install_dmg(dmg_path, suffix = '', switch = true, clean = true) xcode_path = "/Applications/Xcode#{suffix}.app" mount_dir = mount(dmg_path) - puts 'Please authenticate for Xcode installation...' source = Dir.glob(File.join(mount_dir, 'Xcode*.app')).first if source.nil? out = <<-HELP No `Xcode.app` found in DMG. Please remove #{dmg_path} if you suspect a corrupted @@ -86,11 +85,12 @@ HELP $stderr.puts out.tr("\n", ' ') return end - `sudo ditto "#{source}" "#{xcode_path}"` + prompt = "Please authenticate for Xcode installation.\nPassword: " + `sudo -p "#{prompt}" ditto "#{source}" "#{xcode_path}"` `umount "/Volumes/Xcode"` unless verify_integrity(xcode_path) `sudo rm -f #{xcode_path}` return @@ -116,11 +116,11 @@ dmg_path = get_dmg(version, progress, url) fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil? install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean) if install - open_release_notes_url(version) + open_release_notes_url(version) unless url end def open_release_notes_url(version) return if version.nil? xcode = seedlist.find { |x| x.name == version } @@ -434,10 +434,12 @@ Simulator.new(downloadable) end end def install_components - `sudo installer -pkg #{@path}/Contents/Resources/Packages/MobileDevice.pkg -target /` + Dir.glob("#{@path}/Contents/Resources/Packages/*.pkg").each do |pkg| + `sudo installer -pkg #{pkg} -target /` + end osx_build_version = `sw_vers -buildVersion`.chomp tools_version = `/usr/libexec/PlistBuddy -c "Print :ProductBuildVersion" "#{@path}/Contents/version.plist"`.chomp cache_dir = `getconf DARWIN_USER_CACHE_DIR`.chomp `touch #{cache_dir}com.apple.dt.Xcode.InstallCheckCache_#{osx_build_version}_#{tools_version}` end