All pastes #954614 Raw Edit

dynamic plist generation

public diff v1 · immutable
#954614 ·published 2008-03-24 00:33 UTC
rendered paste body
Index: macosx/plist-generator.rb===================================================================--- macosx/plist-generator.rb	(revision 0)+++ macosx/plist-generator.rb	(revision 0)@@ -0,0 +1,41 @@+#! /usr/bin/ruby+# Dynamically generates the macosx/HandBrake.plist file at build-time.++# Passed arguments in the order: path/to/trunk/dir/ HB_VERSION HB_BUILD+$full_path = ARGV[0]+hb_version = ARGV[1]+hb_build =   ARGV[2]++plistArray = # These will be the keys and values of the plist dictionary+  [ +    { "CFBundleDevelopmentRegion" =>         "English" },+    { "CFBundleDisplayName" =>             "HandBrake" },+    { "CFBundleExecutable" =>              "HandBrake" },+    { "CFBundleGetInfoString" =>       "#{hb_version}" }, # HB_VERSION+    { "CFBundleIconFile" =>                "HandBrake" },+    { "CFBundleIdentifier" =>      "org.m0k.handbrake" },+    { "CFBundleInfoDictionaryVersion" =>         "6.0" },+    { "CFBundleName" =>                    "HandBrake" },+    { "CFBundlePackageType" =>                  "APPL" },+    { "CFBundleShortVersionString" =>  "#{hb_version}" }, # HB_VERSION+    { "CFBundleSignature" =>                     "HB##"},+    { "CFBundleVersion" =>               "#{hb_build}" }, # HB_BUILD+    { "NSHumanReadableCopyright" =>   "HandBrake Devs" },+    { "NSMainNibFile" =>                    "MainMenu" },+    { "NSPrincipalClass" =>            "NSApplication" },+    { "SUFeedURL" => "http://handbrake.fr/appcast.xml" }  # Sparke feed URL+  ]++def writeDefaults(plistArray) # Wrutes the plist from a given array of hashed key value pairs+  plistArray.each do |plistHash|+    plistHash.each do |key, value|+      `defaults write #{$full_path}/macosx/HandBrake-test #{key} '#{value}'`+    end+  end+  +  # Make the plist xml, instead of the default binary.+  `plutil -convert xml1 #{$full_path}/macosx/HandBrake-test.plist`    +end++writeDefaults(plistArray) # Run everything+Property changes on: macosx/plist-generator.rb___________________________________________________________________Name: svn:executable   + *Index: Jamrules===================================================================--- Jamrules	(revision 1353)+++ Jamrules	(working copy)@@ -44,7 +44,8 @@ actions OSXApp {     $(RM) $(<) macosx/build/HandBrake.app && \-      ( cd macosx && \+      (  cd macosx && \+         ./plist-generator.rb "$(FULL_PATH)" "$(HB_VERSION)" "$(HB_BUILD)" &&\          defaults write "$(FULL_PATH)"/macosx/HandBrake CFBundleGetInfoString '"$(HB_VERSION)"' &&\          defaults write "$(FULL_PATH)"/macosx/HandBrake CFBundleShortVersionString '"$(HB_VERSION)"' &&\          defaults write "$(FULL_PATH)"/macosx/HandBrake CFBundleVersion '"$(HB_BUILD)"' &&\