#!/usr/bin/env ruby require 'tempfile' def with_tempfile(name) file = Tempfile.new(name) yield file ensure file.close end plist = ARGF.read puts plist and exit unless File.exist?("/usr/libexec/PlistBuddy") with_tempfile('info.plist') do |f| f << plist f.flush vars = `/usr/libexec/PlistBuddy -c "Print :variablesdontexport" #{f.path}` vars = vars.split("\n")[1..-2].map(&:strip) vars.each do |var| `/usr/libexec/PlistBuddy -c "Set :variables:#{var} ''" #{f.path}` end f.rewind puts f.read end