lib/xcode/install.rb in xcode-install-1.2.0 vs lib/xcode/install.rb in xcode-install-1.2.1

- old
+ new

@@ -149,10 +149,18 @@ def symlinks_to File.absolute_path(File.readlink(current_symlink), SYMLINK_PATH.dirname) if current_symlink end + def mount(dmg_path) + plist = hdiutil('mount', '-plist', '-nobrowse', '-noverify', dmg_path.to_s) + document = REXML::Document.new(plist) + node = REXML::XPath.first(document, "//key[.='mount-point']/following-sibling::*[1]") + fail Informative, 'Failed to mount image.' unless node + node.text + end + private def spaceship @spaceship ||= begin begin @@ -274,18 +282,10 @@ result = io.read io.close fail Informative, 'Failed to invoke hdiutil.' unless $?.exitstatus == 0 result end - - def mount(dmg_path) - plist = hdiutil('mount', '-plist', '-nobrowse', '-noverify', dmg_path.to_s) - document = REXML::Document.new(plist) - node = REXML::XPath.first(document, "//key[.='mount-point']/following-sibling::*[1]") - fail Informative, 'Failed to mount image.' unless node - node.text - end end class Simulator attr_reader :version attr_reader :name @@ -343,10 +343,10 @@ :private def prepare_package puts 'Mounting DMG' - mount_location = mount(dmg_path) + mount_location = Installer.new.mount(dmg_path) puts 'Expanding pkg' expanded_pkg_path = CACHE_DIR + identifier FileUtils.rm_rf(expanded_pkg_path) `pkgutil --expand #{mount_location}/*.pkg #{expanded_pkg_path}` puts "Expanded pkg into #{expanded_pkg_path}"