Sha256: eb8a6e29530a2ad853bbb2ea7bba190a4ba8f4115804e291fb7727d625efbf05

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require "open3"

class ShellWrapper
  # @return
  #   Xcode 9.2
  #   Build version 9C40b
  def xcodebuild_version
    sh("xcodebuild -version")
  end

  # @return
  #   Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
  #   Target: x86_64-apple-macosx10.9
  def swift_version
    sh("swift -version")
  end

  # @return
  #   UUID: 69BD256A-C658-3D96-9D5A-FF4B8ED6900C (i386) Carthage/Build/iOS/Attributions.framework/Attributions
  #   UUID: BA1067DB-915A-3DA2-AC16-8C2F2947095E (x86_64) Carthage/Build/iOS/Attributions.framework/Attributions
  #   UUID: DF7DA357-FF4B-3BB8-BCC3-7CE5B97E52E0 (armv7) Carthage/Build/iOS/Attributions.framework/Attributions
  #   UUID: 824033E6-7ABA-3568-A90B-6AF6AFAF4BB9 (arm64) Carthage/Build/iOS/Attributions.framework/Attributions
  def dwarfdump(path)
    sh("/usr/bin/xcrun dwarfdump --uuid \"#{path}\"")
  end

  def archive(input_paths, output_path)
    sh("zip -r #{quote output_path} #{quote input_paths}")
  end

  def unpack(archive_path)
    sh("unzip -o #{quote archive_path}")
  end

  private

  # @return command output if successful
  # @raise CmdError
  def sh(command)
    stdout, stderr, status = Open3.capture3(command)
    if status.success?
      stdout.strip
    else
      raise CmdError.new(command), "Command '#{command}' failed, error output:\n#{stderr.strip}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carthage_remote_cache-0.0.12 lib/shell_wrapper.rb
carthage_remote_cache-0.0.11 lib/shell_wrapper.rb
carthage_remote_cache-0.0.10 lib/shell_wrapper.rb