Module: Shenzhen::PlistBuddy

Defined in:
lib/shenzhen/plistbuddy.rb

Class Method Summary collapse

Class Method Details



3
4
5
6
7
# File 'lib/shenzhen/plistbuddy.rb', line 3

def print(file, key)
  output = `/usr/libexec/PlistBuddy -c "Print :#{key}" "#{file}" 2> /dev/null`

  !output || output.empty? || /Does Not Exist/ === output ? nil : output.strip
end

.set(file, key, value) ⇒ Object



9
10
11
12
# File 'lib/shenzhen/plistbuddy.rb', line 9

def set(file, key, value)
  output = `/usr/libexec/PlistBuddy -c "Set #{key} #{value}" "#{file}" 2>&1`
  output == "" ? value : nil
end