aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-01-27 20:38:23 +0000
committerstuconnolly <stuart02@gmail.com>2011-01-27 20:38:23 +0000
commit8db2f78294982e89fce5a162d92b2be6d9291aa1 (patch)
treeb8dc7736f4af896aa3ed3fa9a96d1f3c4bfd0e59 /Scripts
parentfa7cff57548edc51420693e6909fe2adb3c18951 (diff)
parent7cc062247ff23496dd0390cf07b5d45d6bc49777 (diff)
downloadsequelpro-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')
-rwxr-xr-xScripts/build-mysql-client.sh42
-rwxr-xr-xScripts/build-version.pl62
-rwxr-xr-xScripts/build.sh38
-rwxr-xr-xScripts/create-test-stubs.pl191
-rwxr-xr-xScripts/localize.sh38
-rwxr-xr-xScripts/package-application.sh33
-rwxr-xr-xScripts/run-tests.sh36
-rwxr-xr-xScripts/trim-application.sh60
8 files changed, 423 insertions, 77 deletions
diff --git a/Scripts/build-mysql-client.sh b/Scripts/build-mysql-client.sh
index 1641053c..fbaef809 100755
--- a/Scripts/build-mysql-client.sh
+++ b/Scripts/build-mysql-client.sh
@@ -1,16 +1,36 @@
#! /bin/ksh
-## $Id: build-mysql-client.sh 1044 2009-07-17 14:30:58Z stuart02 $
-##
-## Author: Stuart Connolly (stuconnolly.com)
-## Copyright (c) 2009 Stuart Connolly. All rights reserved.
-##
-## Paramters: -s -- The path to the MySQL source directory.
-## -q -- Quiet. Don't output any compiler messages.
-## -c -- Clean the source after build completes.
-## -d -- Debug. Output the build statements.
-##
-## Description: Builds the MySQL client libraries for distrubution in Sequel Pro's MCPKit MySQL framework.
+#
+# $Id$
+#
+# build-mysql-client.sh
+# 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/>
+
+# Builds the MySQL client libraries for distrubution in Sequel Pro's MCPKit MySQL framework.
+#
+# Paramters: -s -- The path to the MySQL source directory.
+# -q -- Quiet. Don't output any compiler messages.
+# -c -- Clean the source after build completes.
+# -d -- Debug. Output the build statements.
QUIET='NO'
DEBUG='NO'
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
diff --git a/Scripts/build.sh b/Scripts/build.sh
index a9291abb..51ae052c 100755
--- a/Scripts/build.sh
+++ b/Scripts/build.sh
@@ -1,15 +1,33 @@
#! /bin/ksh
-## $Id$
-##
-## Author: Stuart Connolly (stuconnolly.com)
-## Copyright (c) 2009 Stuart Connolly. All rights reserved.
-##
-## Paramters: <none>
-##
-## Description: Generic Sequel Pro build script. This script is intended to replace entering lots of code
-## into Xcode's 'Run Scripts' build phase to make it easier to work with. As such this script
-## can only be run by Xcode.
+#
+# $Id$
+#
+# build.sh
+# 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/>
+
+# Generic Sequel Pro build script. This script is intended to replace entering lots of code
+# into Xcode's 'Run Scripts' build phase to make it easier to work with. As such this script
+# can only be run by Xcode.
if [ "${BUILT_PRODUCTS_DIR}x" == 'x' ]
then
diff --git a/Scripts/create-test-stubs.pl b/Scripts/create-test-stubs.pl
new file mode 100755
index 00000000..ac4193ca
--- /dev/null
+++ b/Scripts/create-test-stubs.pl
@@ -0,0 +1,191 @@
+#! /usr/bin/perl
+
+#
+# $Id$
+#
+# create-test-stubs.sh
+# sequel-pro
+#
+# Created by Stuart Connolly (stuconnolly.com) on January 8, 2011
+# Copyright (c) 2011 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/>
+
+use strict;
+use warnings;
+
+use Carp;
+use Getopt::Long;
+
+use constant PROJECT_NAME => 'sequel-pro';
+use constant PROJECT_URL => 'http://code.google.com/p/sequel-pro/';
+
+#
+# Print this script's usage.
+#
+sub usage
+{
+ print << "EOF";
+Usage: perl $0 [options]
+
+Possible options are:
+
+ --header (-h) Source header file path (required)
+ --output (-c) The output path (required)
+ --author (-a) The author of the eventual test cases (required)
+ --help (-h) Print this help message
+
+EOF
+
+ exit 0;
+}
+
+#
+# Writes the standard license/copyright header to the supplied file handle;
+#
+sub write_header_to_file
+{
+ my ($handle, $filename, $author, $is_header) = @_;
+
+ my @date = localtime(time);
+
+ my @months = qw(January February March April May June July August September October November December);
+
+ my $year = ($date[5] + 1900);
+ my $month = $months[$date[4]];
+
+ my $project = PROJECT_NAME;
+ my $project_url = PROJECT_URL;
+
+ $filename = ($is_header) ? "${filename}.h" : "${filename}.m";
+
+ my $content = << "EOF";
+//
+// \$Id\$
+//
+// $filename
+// $project
+//
+// Created by $author on $month $date[3], $year
+// Copyright (c) $year ${author}. 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 <${project_url}>
+
+EOF
+
+ print $handle $content;
+}
+
+my ($header, $output, $author, $comments, $help);
+
+# Get options
+GetOptions('header|s=s' => \$header,
+ 'output|o=s' => \$output,
+ 'author|a=s' => \$author,
+ 'comments|c' => \$comments,
+ 'help|h' => \$help);
+
+usage if $help;
+usage if ((!$header) && (!$output) && (!$author));
+
+open(my $header_handle, $header) || croak "Unable to open source header file: $!";
+
+my @methods;
+my $class_name;
+my $category_name;
+
+# Extract all the methods (both instance and class) from the source header
+while (<$header_handle>)
+{
+ ($_ =~ /^\s*\@interface\s*([a-zA-z0-9_-]+)\s*\(([a-zA-z0-9_-]+)\)\s*$/) && ($class_name = $1, $category_name = $2);
+ ($_ =~ /^\s*[-|+]\s*\([a-zA-Z\s*\*_-]+\)(.*)$/) && (my $method_sig = $1);
+
+ $class_name =~ s/^\s+// if $class_name;
+ $class_name =~ s/\s+$// if $class_name;
+
+ $category_name =~ s/^\s+// if $category_name;
+ $category_name =~ s/\s+$// if $category_name;
+
+ push(@methods, $method_sig) if $method_sig;
+}
+
+close($header_handle);
+
+my $filename = ($category_name) ? $category_name : $class_name;
+my $new_filename = "${filename}Tests";
+
+my $header_file = "${output}/${new_filename}.h";
+my $imp_file = "${output}/${new_filename}.m";
+
+# Create the new header and implementation files
+open(my $output_header_handle, '>', $header_file) || croak "Unable to open output file: $!";
+open(my $output_imp_handle, '>', $imp_file) || croak "Unable to open output file: $!";
+
+print "Creating file '${header_file}'...\n";
+print "Creating file '${imp_file}'...\n";
+
+# Write the license header to the new files
+write_header_to_file($output_header_handle, $new_filename, $author, 1);
+write_header_to_file($output_imp_handle, $new_filename, $author, 0);
+
+print $output_header_handle "#import <SenTestingKit/SenTestingKit.h>\n\n\@interface $new_filename : SenTestCase\n{\n\n}\n\n\@end\n";
+print $output_imp_handle "#import \"${new_filename}.h\"\n#import \"${filename}.h\"\n\n\@implementation $new_filename\n\n";
+
+# Write the setup and tear down methods
+print $output_imp_handle "/**\n * Test case setup.\n */\n" if $comments;
+print $output_imp_handle "- (void)setUp\n{\n\n}\n\n";
+print $output_imp_handle "/**\n * Test case tear down.\n */\n" if $comments;
+print $output_imp_handle "- (void)tearDown\n{\n\n}\n\n";
+
+# For each of the extracted methods write a test case stub to the new test implementation file
+foreach (@methods)
+{
+ $_ =~ s/\([a-zA-Z\s*\*_-]*\)\s*[a-zA-z0-9_-]+//gi;
+ $_ =~ s/:\s*([a-zA-z0-9_-]+)\s*/\u$1/gi;
+ $_ =~ s/://;
+ $_ =~ s/;//;
+
+ my $method = "test\u$_";
+
+ print "Writing test case stub: $method\n";
+
+ print $output_imp_handle "/**\n * $_ test case.\n */\n" if $comments;
+ print $output_imp_handle "- (void)${method}\n{\n\n}\n\n";
+}
+
+print $output_imp_handle "\@end\n\n";
+
+close($output_header_handle);
+close($output_imp_handle);
+
+print "Test case stub generation complete for class '${filename}'\n";
+
+exit 0
diff --git a/Scripts/localize.sh b/Scripts/localize.sh
index e3de6957..0c74a01f 100755
--- a/Scripts/localize.sh
+++ b/Scripts/localize.sh
@@ -1,13 +1,31 @@
-#! /bin/ksh
-
-## $Id$
-##
-## Author: Created by Rowan Beentje.
-## Copyright (c) 2010 Sequel Pro Team. All rights reserved.
-##
-## Paramters: <none>
-##
-## Description: Localizes all of the application's NIB files. This script should only be run by Xcode.
+#! /bin/ksh
+
+#
+# $Id$
+#
+# localize.sh
+# sequel-pro
+#
+# Created by Rowan Beentje.
+# Copyright (c) 2010 Sequel Pro Team. 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/>
+
+# Localizes all of the application's NIB files. This script should only be run by Xcode.
if [ "${BUILT_PRODUCTS_DIR}x" == 'x' ]
then
diff --git a/Scripts/package-application.sh b/Scripts/package-application.sh
index 69e14058..7bc402b9 100755
--- a/Scripts/package-application.sh
+++ b/Scripts/package-application.sh
@@ -1,17 +1,34 @@
#!/bin/sh
-# $Id$
#
-# package-application.sh
-# sequel-pro
+# $Id$
#
-# A very basic script to build and sign a disk image for Sequel Pro; based on better work by Stuart Connolly.
+# package-application.sh
+# sequel-pro
#
-# Created by Rowan Beentje on 25/03/2009.
-# Copyright 2009 Sequel Pro Team. All rights reserved.
+# Created by Rowan Beentje on March 25, 2009.
+# Copyright (c) 2009 Sequel Pro Team. 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/>
-# Ensure the path to the application has been supplied - should have occurred when the
-# script was run by selecting "Distribution" target and building.
+# A very basic script to build and sign a disk image for Sequel Pro; based on better work by Stuart Connolly.
+#
+# Ensure the path to the application has been supplied - should have occurred when the
+# script was run by selecting 'Distribution' target and building.
if [ $# -eq 0 ]
then
diff --git a/Scripts/run-tests.sh b/Scripts/run-tests.sh
new file mode 100755
index 00000000..22ed51dd
--- /dev/null
+++ b/Scripts/run-tests.sh
@@ -0,0 +1,36 @@
+#! /bin/ksh
+
+#
+# $Id$
+#
+# run-tests.sh
+# sequel-pro
+#
+# Created by Stuart Connolly (stuconnolly.com)
+# Copyright (c) 2011 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/>
+
+# Runs Sequel Pro's unit tests. This script should only be run by Xcode.
+
+# Add the unit test bundle's Frameworks/ path to the search paths for dynamic libraries
+export DYLD_FRAMEWORK_PATH="${CONFIGURATION_BUILD_DIR}/${FULL_PRODUCT_NAME}/Contents/Frameworks"
+
+# Run the unit tests in this test bundle
+"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
+
+exit 0
diff --git a/Scripts/trim-application.sh b/Scripts/trim-application.sh
index a8194060..bc6a99ec 100755
--- a/Scripts/trim-application.sh
+++ b/Scripts/trim-application.sh
@@ -1,23 +1,43 @@
-#! /bin/ksh
-
-## $Id$
-##
-## Author: Stuart Connolly (stuconnolly.com)
-## Copyright (c) 2009 Stuart Connolly. All rights reserved.
-##
-## Largely based on 'trim-app' by Ankur Kothari ( http://lipidity.com/downloads/trim-app/ )
-##
-## Paramters: -p -- The path to the application that is to be trimmed
-## -d -- Remove unnecessary files (i.e. .DS_Store files, etc) (optional).
-## -n -- Trim nib files (i.e. remove .info.nib, classes.nib, data.dependency and designable.nib) (optional).
-## -s -- Strip debug symbols from application binary (optional).
-## -t -- Compress tiff images using LZW compression (optional).
-## -f -- Remove framework headers (optional).
-## -r -- Remove resource forks (optional).
-## -a -- All of above optional options. Equivalent to '-d -n -s -t -f -r'.
-##
-## Description: Trims an application bundle of unnecessary files and resources that are generally not required and otherwise
-## waste disk space.
+#! /bin/ksh
+
+#
+# $Id$
+#
+# trim-application.sh
+# 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/>
+
+# Trims an application bundle of unnecessary files and resources that are generally not required and otherwise
+# waste disk space.
+#
+# Largely based on 'trim-app' by Ankur Kothari ( http://lipidity.com/downloads/trim-app/ )
+#
+# Parameters: -p -- The path to the application that is to be trimmed
+# -d -- Remove unnecessary files (i.e. .DS_Store files, etc) (optional).
+# -n -- Trim nib files (i.e. remove .info.nib, classes.nib, data.dependency and designable.nib) (optional).
+# -s -- Strip debug symbols from application binary (optional).
+# -t -- Compress tiff images using LZW compression (optional).
+# -f -- Remove framework headers (optional).
+# -r -- Remove resource forks (optional).
+# -a -- All of above optional options. Equivalent to '-d -n -s -t -f -r'.
usage()
{