You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
526 B

#!/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