diff options
author | stuconnolly <stuart02@gmail.com> | 2011-01-27 20:38:23 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-01-27 20:38:23 +0000 |
commit | 8db2f78294982e89fce5a162d92b2be6d9291aa1 (patch) | |
tree | b8dc7736f4af896aa3ed3fa9a96d1f3c4bfd0e59 /Scripts/build-version.pl | |
parent | fa7cff57548edc51420693e6909fe2adb3c18951 (diff) | |
parent | 7cc062247ff23496dd0390cf07b5d45d6bc49777 (diff) | |
download | sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.tar.gz sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.tar.bz2 sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.zip |
Bring outline view branch up to date with trunk (r3056:r3162).
Diffstat (limited to 'Scripts/build-version.pl')
-rwxr-xr-x | Scripts/build-version.pl | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/Scripts/build-version.pl b/Scripts/build-version.pl index fa12bfdb..92dcc15b 100755 --- a/Scripts/build-version.pl +++ b/Scripts/build-version.pl @@ -1,22 +1,42 @@ -#! /usr/bin/perl -w - -## $Id$ -## -## Author: Stuart Connolly (stuconnolly.com) -## Copyright (c) 2009 Stuart Connolly. All rights reserved. -## -## Paramters: <none> -## -## Description: Updates the application/bundle's Info.plist CFBundleVersion to match that of the current -## Subversion revision. +#! /usr/bin/perl + +# +# $Id$ +# +# build-version.pl +# sequel-pro +# +# Created by Stuart Connolly (stuconnolly.com) +# Copyright (c) 2009 Stuart Connolly. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# More info at <http://code.google.com/p/sequel-pro/> + +# Updates the application/bundle's Info.plist CFBundleVersion to match that of the current +# Subversion revision. use strict; use warnings; +use Carp; + 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 $plist_path = "$ENV{BUILT_PRODUCTS_DIR}/$ENV{INFOPLIST_PATH}"; my $version = $revision; @@ -24,12 +44,18 @@ my $version = $revision; 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); +open(my $plist, $plist_path) || croak "Unable to open plist file for reading: $!"; + +my $info = join('', <$plist>); + +close($plist); $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); +open($plist, '>', $plist_path) || croak "Unable to open plist file for writing: $!"; + +print $plist $info; + +close($plist); + +exit 0 |