Method: RunLoop::PlistBuddy#create_plist

Defined in:
lib/run_loop/plist_buddy.rb

#create_plist(path) ⇒ Object

Creates an new empty plist at ‘path`.

Is not responsible for creating directories or ensuring write permissions.

Parameters:

  • path (String)

    Where to create the new plist.



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/run_loop/plist_buddy.rb', line 90

def create_plist(path)
  File.open(path, 'w') do |file|
    file.puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
    file.puts "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
    file.puts "<plist version=\"1.0\">"
    file.puts '<dict>'
    file.puts '</dict>'
    file.puts '</plist>'
  end
  path
end