Sha256: f1b8cb628d74412814efb295c10145a5139082c501d0d2e9ca06f81ef4b9f297
Contents?: true
Size: 1.51 KB
Versions: 36
Compression:
Stored size: 1.51 KB
Contents
module RunLoop # @!visibility private # # A class for interacting with the strings tool class Strings # @!visibility private attr_reader :path # @!visibility private def initialize(path) @path = path if !Strings.valid_path?(path) raise ArgumentError, %Q{File: #{path} must exist and not be a directory. } end end # @!visibility private def to_s "#<STRINGS: #{path}>" end # @!visibility private def inspect to_s end # @!visibility private # # @return [RunLoop::Version] A version instance or nil if the file # at path does not contain server version information. def server_version regex = /CALABASH VERSION: (\d+\.\d+\.\d+(\.pre\d+)?)/ match = dump[regex, 0] if match str = match.split(":")[1] RunLoop::Version.new(str) else nil end end private # @!visibility private def dump args = ["strings", path] opts = { :log_cmd => true } hash = xcrun.run_command_in_context(args, opts) if hash[:exit_status] != 0 raise RuntimeError, %Q{Could not get strings info from file: #{path} #{args.join(" ")} exited #{hash[:exit_status]} with the following output: #{hash[:out]} } end @dump = hash[:out] end # @!visibility private def self.valid_path?(path) File.exist?(path) && !File.directory?(path) end # @!visibility private def xcrun RunLoop::Xcrun.new end end end
Version data entries
36 entries across 36 versions & 2 rubygems