class RunLoop::Otool
@!visibility private
A class for interacting with otool
Attributes
command_name[R]
@!visibility private
xcode[R]
@!visibility private
Public Class Methods
new(xcode)
click to toggle source
@!visibility private @param [RunLoop::Xcode] xcode An instance of Xcode
# File lib/run_loop/otool.rb, line 9 def initialize(xcode) @xcode = xcode end
Public Instance Methods
executable?(path)
click to toggle source
@!visibility private
# File lib/run_loop/otool.rb, line 24 def executable?(path) expect_valid_path!(path) !arch_info(path)[/is not an object file/, 0] end
inspect()
click to toggle source
@!visibility private
# File lib/run_loop/otool.rb, line 19 def inspect to_s end
to_s()
click to toggle source
@!visibility private
# File lib/run_loop/otool.rb, line 14 def to_s "#<OTOOL: Xcode #{xcode.version.to_s}>" end
Private Instance Methods
arch_info(path)
click to toggle source
@!visibility private
# File lib/run_loop/otool.rb, line 35 def arch_info(path) args = [command_name, "-hv", "-arch", "all", path] opts = { :log_cmd => false } hash = xcrun.run_command_in_context(args, opts) if hash[:exit_status] != 0 raise RuntimeError, %Q{Could not get arch info from file: #{path} #{args.join(" ")} exited #{hash[:exit_status]} with the following output: #{hash[:out]} } end hash[:out] end
expect_valid_path!(path)
click to toggle source
@!visibility private
# File lib/run_loop/otool.rb, line 59 def expect_valid_path!(path) return true if File.exist?(path) && !File.directory?(path) raise ArgumentError, %Q[ File: #{path} must exist and not be a directory. ] end
xcrun()
click to toggle source
@!visibility private
# File lib/run_loop/otool.rb, line 72 def xcrun @xcrun ||= RunLoop::Xcrun.new end