aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2008-12-10 19:04:21 +0000
committerstuconnolly <stuart02@gmail.com>2008-12-10 19:04:21 +0000
commita291848bceeb1dc59a1ae803148b8988d94ace54 (patch)
tree75e8bcf80b42bd622c75cf3f3366fdd4d4f92b38 /Scripts
parent6ec61f4201c87741fb99ea0c65b2e4055ce46b9d (diff)
downloadsequelpro-a291848bceeb1dc59a1ae803148b8988d94ace54.tar.gz
sequelpro-a291848bceeb1dc59a1ae803148b8988d94ace54.tar.bz2
sequelpro-a291848bceeb1dc59a1ae803148b8988d94ace54.zip
Added perl script to automatically add the build version to Info.plist.
Diffstat (limited to 'Scripts')
-rwxr-xr-xScripts/build-version.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/Scripts/build-version.pl b/Scripts/build-version.pl
new file mode 100755
index 00000000..f8cd47ec
--- /dev/null
+++ b/Scripts/build-version.pl
@@ -0,0 +1,32 @@
+#! /usr/bin/perl -w
+
+## Author: Stuart Connolly (stuconnolly.com)
+## Copyright (c) 2008 Stuart Connolly. All rights reserved.
+##
+## Paramters: <none>
+##
+## Description: Updates the application/bundle's Info.plist CFBundleVersion to match that of the current
+## Subversion revision.
+
+use strict;
+
+die "$0: Must be run from within Xcode. Exiting..." unless $ENV{"BUILT_PRODUCTS_DIR"};
+
+my $revision = `svnversion -n ./`;
+my $info_plist = "$ENV{BUILT_PRODUCTS_DIR}/$ENV{INFOPLIST_PATH}";
+
+my $version = $revision;
+
+($version =~ m/(\d+)[MS]*$/) && ($version = $1);
+
+die "$0: No Subversion revision found. Exiting..." unless $version;
+
+open(INFO_FH, "$info_plist") or die "$0: $info_plist: $!";
+my $info = join("", <INFO_FH>);
+close(INFO_FH);
+
+$info =~ s/([\t ]+<key>CFBundleVersion<\/key>\n[\t ]+<string>).*?(<\/string>)/$1$version$2/;
+
+open(INFO_FH, ">$info_plist") or die "$0: $info_plist: $!";
+print INFO_FH $info;
+close(INFO_FH);