lib/xcres/analyzer/strings_analyzer.rb
def read_plist_key(path, key)
      raise ArgumentError, "File '#{path}' doesn't exist" unless path.exist?
      raise ArgumentError, 'Path is required, but nil' if path.nil?
      raise ArgumentError, 'Key is required, but nil' if key.nil?
      out = `/usr/libexec/PlistBuddy -c "Print :#{key}" "#{path}" 2>&1`.chomp
      raise ArgumentError, "Error reading plist: #{out}" unless $?.success?
      out
    end
# Extracts a given key from a plist file given as a path
#
# @param  [Pathname] path
#         the path of the plist file
#
# @param  [String] key
#         the key, whose value should been extracted
#
# @return [String]
#
Extracts a given key from a plist file given as a path
Extracts a given key from a plist file given as a path
def read_plist_key(path, key)
      raise ArgumentError, "File '#{path}' doesn't exist" unless path.exist?
      raise ArgumentError, 'Path is required, but nil' if path.nil?
      raise ArgumentError, 'Key is required, but nil' if key.nil?
      out = `/usr/libexec/PlistBuddy -c "Print :#{key}" "#{path}" 2>&1`.chomp
      raise ArgumentError, "Error reading plist: #{out}" unless $?.success?
      out
    end
def read_plist_key ( path , key ) raise ArgumentError , "File '#{path}' doesn't exist" unless path . exist? raise ArgumentError , 'Path is required, but nil' if path . nil? raise ArgumentError , 'Key is required, but nil' if key . nil? out = ` /usr/libexec/PlistBuddy -c "Print : #{ key } " " #{ path } " 2>&1 ` . chomp raise ArgumentError , "Error reading plist: #{out}" unless $? . success? out end
Extracts a given key from a plist file given as a path
Extracts a given key from a plist file given as a path
None
String
path
key
key the key, whose value should been extracted
key the key whose value should been extracted