Sha256: 6dcf637aa95e6a7a5094abf7395f5f83766d8799b9af11cb18484f7bb895838a

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

= Info Plist Example

In this example, we edit an Apple Info.plist, to modify a couple of the keys and write them back to the same file. For setting the plist file attributes see {Plist4r::Plist}. For more information specifically about Info Plists, see {Plist4r::PlistType::Info}.

  # standard method
  info_plist = Plist4r.open "/Applications/MyApp.app/Contents/Info.plist"
  info_plist[:c_f_bundle_signature] # => "????"
  info_plist["LSUIElement"] = true
  info_plist.save

  # block method
  info_plist = Plist4r.open "/Applications/MyApp.app/Contents/Info.plist" do

    # plist attributes
    filename    # => "/Applications/MyApp.app/Contents/Info.plist"
    file_format # => :xml
    plist_type  # => :info

    # read
    c_f_bundle_executable # => "MyApp"
    c_f_bundle_icon_file  # => "Icon"
    c_f_bundle_identifier # => "com.mydomain.MyApp"
    c_f_bundle_name       # => "MyApp"
    c_f_bundle_signature  # => "????"

    # write
    c_f_bundle_signature "MYAP"
    store "LSUIElement" true
    
    # call info_plist.save
    save
  end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
plist4r-1.1.2 lib/plist4r/docs/InfoPlistExample.rdoc
plist4r-1.1.1 lib/plist4r/docs/InfoPlistExample.rdoc
plist4r-1.1.0 lib/plist4r/docs/InfoPlistExample.rdoc
plist4r-1.0.1 lib/plist4r/docs/InfoPlistExample.rdoc
plist4r-1.0.0 lib/plist4r/docs/InfoPlistExample.rdoc