wincent-strings-util.git
8 years agoMore build setting adjustments master
Greg Hurrell [Sun, 18 May 2014 20:05:10 +0000 (13:05 -0700)] 
More build setting adjustments

To make sure we can build on 10.9.

Signed-off-by: Greg Hurrell <greg@hurrell.net>
8 years agoClean up old radar files
Greg Hurrell [Sun, 18 May 2014 19:58:30 +0000 (12:58 -0700)] 
Clean up old radar files

Not sure if anything ever came of this bug report, but regardless, this
code is unlikely to serve any useful purpose now, so removing it.

Signed-off-by: Greg Hurrell <greg@hurrell.net>
8 years agoUpdate .gitignore
Greg Hurrell [Sun, 18 May 2014 19:57:51 +0000 (12:57 -0700)] 
Update .gitignore

Taken from: http://www.gitignore.io/api/xcode

Included the project files that make it through the .gitignore filter.

Signed-off-by: Greg Hurrell <greg@hurrell.net>
8 years agoDisable GC
Greg Hurrell [Sun, 18 May 2014 19:54:54 +0000 (12:54 -0700)] 
Disable GC

This setting is actually coming from buildtools, but I don't have
network connectivity at the moment, so I can't upgrade the submodule.
Applying a local override for now.

Signed-off-by: Greg Hurrell <greg@hurrell.net>
8 years agoLet Xcode upgrade project settings
Greg Hurrell [Sun, 18 May 2014 19:54:23 +0000 (12:54 -0700)] 
Let Xcode upgrade project settings

Signed-off-by: Greg Hurrell <greg@hurrell.net>
8 years agoConvert from Objective-C GC to ARC
Greg Hurrell [Sun, 18 May 2014 19:48:20 +0000 (12:48 -0700)] 
Convert from Objective-C GC to ARC

Can't compile on Mavericks without doing this, so, so be it. This was
done with the Xcode conversion tool.

Signed-off-by: Greg Hurrell <greg@hurrell.net>
12 years agodistro.sh: distribute package file without zip wrapper
Wincent Colaiuta [Sat, 29 Aug 2009 15:25:25 +0000 (17:25 +0200)] 
distro.sh: distribute package file without zip wrapper

I've now configured the web servers (both nginx and Apache) to serve
".pkg" files with a MIME type of "application/octet-stream" instead of
the default "text/plain". This means that it is no longer necessary to
wrap them up inside zip archives to prevent them from being
inappropriately displayed in the user's browser window rather than
downloaded to disk.

So, drop the zip wrapper and instead just give the package a unique
name. Flat packages are compressed in any case, so the download size
should be basically the same, give or take a few bytes.

This commit is the equivalent of the change made in 17fb9e0 in Wincent
Icon Utility.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoXcode project file buzz
Wincent Colaiuta [Sat, 29 Aug 2009 12:43:23 +0000 (14:43 +0200)] 
Xcode project file buzz

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number post-release
Wincent Colaiuta [Sat, 29 Aug 2009 12:43:13 +0000 (14:43 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoMake "tag-release.sh" script executable 2.0.1
Wincent Colaiuta [Sat, 29 Aug 2009 12:28:52 +0000 (14:28 +0200)] 
Make "tag-release.sh" script executable

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number prior to 2.0.1 release
Wincent Colaiuta [Sat, 29 Aug 2009 12:28:20 +0000 (14:28 +0200)] 
Bump version number prior to 2.0.1 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agodistro.sh: prepare plaintext version of man page
Wincent Colaiuta [Sat, 29 Aug 2009 12:27:41 +0000 (14:27 +0200)] 
distro.sh: prepare plaintext version of man page

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate buildtools submodule 6656431..1cd84ad
Wincent Colaiuta [Sat, 29 Aug 2009 12:24:37 +0000 (14:24 +0200)] 
Update buildtools submodule 6656431..1cd84ad

  1cd84ad ReleaseNotes.sh: handle submodules ahead of annotated tags

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agodistro.sh: prepare release notes
Wincent Colaiuta [Sat, 29 Aug 2009 11:56:32 +0000 (13:56 +0200)] 
distro.sh: prepare release notes

This prepares both short and detailed release notes, including
submodules (if and only if there were any changes in the submodules).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agodistro.sh: use temp directory to avoid cluttering up BUILT_PRODUCTS_DIR
Wincent Colaiuta [Sat, 29 Aug 2009 11:31:04 +0000 (13:31 +0200)] 
distro.sh: use temp directory to avoid cluttering up BUILT_PRODUCTS_DIR

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agodistro.sh: include submodules in source archive
Wincent Colaiuta [Sat, 29 Aug 2009 11:23:36 +0000 (13:23 +0200)] 
distro.sh: include submodules in source archive

Not the prettiest of solutions but it basically does the right thing:

  1. Use "git archive" to produce the standard tar archive of the
     repository
  2. Use "git ls-tree", combined with "grep", to iterate over all
     submodules at the top level of the repo; at present this just
     means the "buildtools" submodule
     a. Create a temporary directory for each submodule
     b. Use "git archive" and "tar" to get a copy of the submodule
        source in the temporary directory
     c. Add the submodule source to the main tar archive
  6. After iterating over all submodules, use "bzip2" to compress the
     archive.

By design this is not recursive, nor do I anticipate any need for it to
be so. When/if "git archive" gets built-in submodule support this part
of the script can be considerably simplified.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agodistro.sh: prepare source archive
Wincent Colaiuta [Sat, 29 Aug 2009 10:57:30 +0000 (12:57 +0200)] 
distro.sh: prepare source archive

This is just the basic implementation at this stage: still have to
incorporate submodules in the archive.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoSecond phase of "distro.sh" (zip up package file)
Wincent Colaiuta [Sat, 29 Aug 2009 10:39:11 +0000 (12:39 +0200)] 
Second phase of "distro.sh" (zip up package file)

This will produce zip names like:

  wincent-strings-util-2.0-7-gbfb53d7.zip

For untagged "releases", and names like:

  wincent-strings-util-2.0.zip

For tagged releases.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoClarify comment
Wincent Colaiuta [Sat, 29 Aug 2009 10:38:41 +0000 (12:38 +0200)] 
Clarify comment

Clarify what is meant by "this" in the code comment.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd "Distro" target
Wincent Colaiuta [Sat, 29 Aug 2009 10:21:07 +0000 (12:21 +0200)] 
Add "Distro" target

For running "distro.sh" script from within Xcode.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agodistro.sh: implement tag checking
Wincent Colaiuta [Sat, 29 Aug 2009 10:16:39 +0000 (12:16 +0200)] 
distro.sh: implement tag checking

This is the first stage of the distro script. Issue a warning if current
HEAD is not a signed/annotated commit.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd script references to Xcode project
Wincent Colaiuta [Sat, 29 Aug 2009 10:01:05 +0000 (12:01 +0200)] 
Add script references to Xcode project

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd schema for "distro.sh" script
Wincent Colaiuta [Sat, 29 Aug 2009 10:00:41 +0000 (12:00 +0200)] 
Add schema for "distro.sh" script

At this stage just a plan of what we want the script to do eventually.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd tag-release.sh script
Wincent Colaiuta [Sat, 29 Aug 2009 00:19:21 +0000 (02:19 +0200)] 
Add tag-release.sh script

This is an edited version of the equivalent script from the Synergy
repo.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoEnforce minimum system version in installer package
Wincent Colaiuta [Fri, 28 Aug 2009 13:56:15 +0000 (15:56 +0200)] 
Enforce minimum system version in installer package

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number post-release
Wincent Colaiuta [Fri, 28 Aug 2009 11:26:19 +0000 (13:26 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd missing system header import maint 2.0
Wincent Colaiuta [Fri, 28 Aug 2009 11:19:56 +0000 (13:19 +0200)] 
Add missing system header import

This was needed for objc_startCollectorThread().

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate buildtools submodule d49b922..6656431
Wincent Colaiuta [Fri, 28 Aug 2009 11:15:44 +0000 (13:15 +0200)] 
Update buildtools submodule d49b922..6656431

  6656431 Switch to Clang/LLVM
  93e282e Switch to Snow Leopard SDK
  04230fd README: update for Snow Leopard
  1bf82fa Drop PowerPC support

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd call to objc_startCollectorThread()
Wincent Colaiuta [Fri, 28 Aug 2009 10:55:44 +0000 (12:55 +0200)] 
Add call to objc_startCollectorThread()

This is handled automatically in Cocoa desktop applications, but in
Foundation tools you have to do it yourself.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoGit: ignore "build" folder created by Xcode
Wincent Colaiuta [Fri, 28 Aug 2009 10:52:34 +0000 (12:52 +0200)] 
Git: ignore "build" folder created by Xcode

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number for 2.0 release
Wincent Colaiuta [Fri, 28 Aug 2009 10:40:07 +0000 (12:40 +0200)] 
Bump version number for 2.0 release

We're jumping to 2.0 here to indicate that this is a
compatibility-breaking update which will only run on Snow Leopard and
up.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump copyright dates in man page
Wincent Colaiuta [Fri, 28 Aug 2009 10:39:53 +0000 (12:39 +0200)] 
Bump copyright dates in man page

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove unneeded PowerPC code
Wincent Colaiuta [Fri, 28 Aug 2009 10:36:59 +0000 (12:36 +0200)] 
Remove unneeded PowerPC code

These conditionals will never trigger on this branch, seeing as we don't
compile for PowerPC.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRename "Run script" phase
Wincent Colaiuta [Thu, 27 Aug 2009 12:00:55 +0000 (14:00 +0200)] 
Rename "Run script" phase

Xcode 3.2 allows you to rename script phases and shows their names in
the build results window, so do this to make build logs more
informative.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRework references to buildtools
Wincent Colaiuta [Thu, 27 Aug 2009 11:59:43 +0000 (13:59 +0200)] 
Rework references to buildtools

Make it easier to inspect scripts from buildtools used in this project
by adding a project reference.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate references to buildtools files
Wincent Colaiuta [Thu, 27 Aug 2009 11:56:38 +0000 (13:56 +0200)] 
Update references to buildtools files

These must reflect the new locations within the buildtools submodule.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd buildtools as a submodule
Wincent Colaiuta [Thu, 27 Aug 2009 11:53:31 +0000 (13:53 +0200)] 
Add buildtools as a submodule

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove redundant autotest require leopard
Wincent Colaiuta [Tue, 15 Jan 2008 12:07:08 +0000 (13:07 +0100)] 
Remove redundant autotest require

This was cruft left in from a temporary investigation. Harmless, but
cruft nonetheless.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoTeach autotest to re-run specs when executable changes
Wincent Colaiuta [Tue, 15 Jan 2008 12:03:05 +0000 (13:03 +0100)] 
Teach autotest to re-run specs when executable changes

Re-run all specs whenever any source file changes, the project file
changes, or the built executable is produced.

This requires ZenTest 3.8.0, I believe.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoReally add double-hyphen form
Wincent Colaiuta [Sun, 6 Jan 2008 19:38:59 +0000 (20:38 +0100)] 
Really add double-hyphen form

The previous commit didn't go far enough because the Fl macro only
appends a single hyphen, so explicitly add another.

Also, for better consistency, use Fl everywhere, not just on optional
switches. This means that non-optional switches also appear in bold.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate man page to use double-hyphen form
Wincent Colaiuta [Sun, 6 Jan 2008 19:06:00 +0000 (20:06 +0100)] 
Update man page to use double-hyphen form

Although the usage information inside the executable was updated when
the options changed from single to double-hyphen form, the man page
was not.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate date in manual page
Wincent Colaiuta [Sun, 6 Jan 2008 18:22:08 +0000 (19:22 +0100)] 
Update date in manual page

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number post-release
Wincent Colaiuta [Sun, 6 Jan 2008 18:10:41 +0000 (19:10 +0100)] 
Bump version number post-release

To 1.2+.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate version number pre-release 1.2
Wincent Colaiuta [Sun, 6 Jan 2008 18:08:23 +0000 (19:08 +0100)] 
Update version number pre-release

Update to 1.2.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate copyright years
Wincent Colaiuta [Sun, 6 Jan 2008 18:07:37 +0000 (19:07 +0100)] 
Update copyright years

Update ranges to include 2008.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number post-release
Wincent Colaiuta [Mon, 24 Dec 2007 15:20:51 +0000 (16:20 +0100)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number for second release candidate release 1.2-rc2
Wincent Colaiuta [Mon, 24 Dec 2007 15:19:40 +0000 (16:19 +0100)] 
Bump version number for second release candidate release

Now at 1.2-rc2.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoTweak some spec descriptions
Wincent Colaiuta [Mon, 24 Dec 2007 15:16:57 +0000 (16:16 +0100)] 
Tweak some spec descriptions

Reviewing the output of "spec -f html" I noticed that a couple of the
example descriptions aren't as accurate as they could be, so fix that.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAvoid unnecessary object instantiation
Wincent Colaiuta [Mon, 24 Dec 2007 15:12:56 +0000 (16:12 +0100)] 
Avoid unnecessary object instantiation

There is no need to create a new string object here; we can just return
the string object returned to us by the system.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoSupport recursive substitution
Wincent Colaiuta [Mon, 24 Dec 2007 15:08:24 +0000 (16:08 +0100)] 
Support recursive substitution

In updating my apps to match the latest documentation in Apple's
"Property List Key Reference" I noticed that it would be useful to be
able to do recursive substitution when using the --info and --strings
switches; that is, have one key refer to the value of another key
in an InfoPlist.strings file rather than one in the Info.plist.

This commit therefore gets rid of the simplistic find-and-replace
substitution that was previously implemented and replaces it with a
proper recursive substitution mechanism that allows keys in a strings
file to refer to other keys in the same file, using multiple levels of
recursion if need be, and finally falling back to look-up in the
Info.plist file.

The algorithm is smart enough to detect direct and indirect infinite
recursion (self-referential subsitutions), allow repeated substitutions,
and bail in the event that no suitable substitution can be found.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd specs for missing command line switches
Wincent Colaiuta [Mon, 24 Dec 2007 13:57:44 +0000 (14:57 +0100)] 
Add specs for missing command line switches

Test case where --strings is supplied without --info and vice versa.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoWarn about C99 comments
Wincent Colaiuta [Mon, 24 Dec 2007 13:51:47 +0000 (14:51 +0100)] 
Warn about C99 comments

Although the scanner knows how to recognize both C99 (single-line,
Objective-C-style comments) and traditional C commnets (multi-line
comments) it is almost certainly an error for the former to be present
in a plist or strings file, so issue a warning if found.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUse double-hyphens for all switches
Wincent Colaiuta [Sun, 23 Dec 2007 18:34:14 +0000 (19:34 +0100)] 
Use double-hyphens for all switches

The NSUserDefaults standard for command-line switches uses only a single
hyphen, which is a little unorthodox. Use more conventional double
hyphens instead by inserting an additional hyphen in the default names.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number post-release
Wincent Colaiuta [Sun, 23 Dec 2007 18:31:15 +0000 (19:31 +0100)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number for 1.2 release candidate 1 1.2-rc1
Wincent Colaiuta [Sat, 22 Dec 2007 20:58:12 +0000 (21:58 +0100)] 
Bump version number for 1.2 release candidate 1

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd specs for -combine functionality
Wincent Colaiuta [Sat, 22 Dec 2007 20:55:59 +0000 (21:55 +0100)] 
Add specs for -combine functionality

And based on usability assessment running the specs tweak the warning
issued for duplicate keys to be a little more helpful (ie. explicitly
mention that the same key was found in both files and that the value
from the second file will take precedence).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd checks for duplicate keys within the same file
Wincent Colaiuta [Sat, 22 Dec 2007 20:37:51 +0000 (21:37 +0100)] 
Add checks for duplicate keys within the same file

Emit error messages during parsing if duplicate keys found. This is a
serious-enough problem to warrant issuing an error rather than a mere
warning, but we continue processing anyway.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoFavor member: over containsObject:
Wincent Colaiuta [Sat, 22 Dec 2007 20:30:36 +0000 (21:30 +0100)] 
Favor member: over containsObject:

The looser check done by member: (using isEqual:) is more appropriate
here than the one done by containsObject: (an identity comparison done
using pointer equality, I believe).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoFix file mode on encode_spec.rb
Wincent Colaiuta [Sat, 22 Dec 2007 20:29:43 +0000 (21:29 +0100)] 
Fix file mode on encode_spec.rb

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd extract() specs and fix a bug
Wincent Colaiuta [Sat, 22 Dec 2007 20:28:59 +0000 (21:28 +0100)] 
Add extract() specs and fix a bug

Add specs for the -extract switch and fix a bug discovered as a result.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoMinor comment cleanup
Wincent Colaiuta [Sat, 22 Dec 2007 20:04:11 +0000 (21:04 +0100)] 
Minor comment cleanup

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoTry multiple encodings in -info/-strings code path
Wincent Colaiuta [Sat, 22 Dec 2007 19:38:03 +0000 (20:38 +0100)] 
Try multiple encodings in -info/-strings code path

Although we don't strictly need to parse the input file passed in using
the -strings switch (as we're just doing a simple find and replace)
parse it anyway because in this way we can hopefully get the encoding
right on files which don't have BOMs.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoFix pending tests by using fallback encodings
Wincent Colaiuta [Sat, 22 Dec 2007 19:22:23 +0000 (20:22 +0100)] 
Fix pending tests by using fallback encodings

Instead of using the deprecated NSString stringWithContentsOfFile:
method (not sure why no deprecation warnings were being issued) instead
use stringWithContentsOfFile:encoding:error:. The problem with the
former is that any strings file without a BOM was being interpreted
using the normal C string encoding, which was incorrect and would in
turn cause parsing to fail.

In this way we can explicitly try NSUTF16StringEncoding (should work
for any file that has a BOM) and then fall back to
NSUTF16LittleEndianStringEncoding and NSUTF16BigEndianStringEncoding if
parsing fails.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd specs for automatic addition of BOMs to output
Wincent Colaiuta [Sat, 22 Dec 2007 18:58:57 +0000 (19:58 +0100)] 
Add specs for automatic addition of BOMs to output

Make sure that when the input file has no BOM, we automatically add one
to the output stream.

At the moment these specs are marked as pending because the parse()
function is choking on input files that don't have BOMs.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd test case for CFStringCreateExternalRepresentation() bug
Wincent Colaiuta [Sat, 22 Dec 2007 18:48:49 +0000 (19:48 +0100)] 
Add test case for CFStringCreateExternalRepresentation() bug

I've now created a basic test case demonstrating the
CFStringCreateExternalRepresentation() bug; the Radar for the issue is
5661397.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoWork around CFStringCreateExternalRepresentation() bug
Wincent Colaiuta [Sat, 22 Dec 2007 18:22:49 +0000 (19:22 +0100)] 
Work around CFStringCreateExternalRepresentation() bug

This commit adds some specs to test the operation of the -encode switch
and in so doing has uncovered what looks to be a bug in the
CFStringCreateExternalRepresentation() function.

The docs suggest that a BOM should be added to the beginning of the
string, but in my testing this is not the case.

The workaround is to manually add the BOM, while double-checking to
make sure that the system doesn't add one (just in case the behaviour of
the system changes in the future).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAllow explicit override of output encoding
Wincent Colaiuta [Sat, 22 Dec 2007 16:01:35 +0000 (17:01 +0100)] 
Allow explicit override of output encoding

This allows wincent-strings-util to be used as a general "clean up" tool
for localizations. For example, a localization might be completed but
have excess whitespace and be encoded with a different endianness (ie.
the original version is sent to the localizer as little-endian but the
localizer uses an editor which saves it in big-endian encoding).

To make performing diffs easier we can use wincent-strings-util to
normalize these non-significant differences, hopefully making the task
of integrating changes much easier.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoSplit specs into separate files
Wincent Colaiuta [Sat, 22 Dec 2007 15:05:24 +0000 (16:05 +0100)] 
Split specs into separate files

Break the specs up into multiple files to make them easier to maintain.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRun just-built copy by default
Wincent Colaiuta [Sat, 22 Dec 2007 14:59:48 +0000 (15:59 +0100)] 
Run just-built copy by default

When run from inside an Xcode shell script phase the TARGET_BUILD_DIR
environment variable enables us to find the just-built copy for testing
purposes. The same effect can be achieved by manually exporting the
environment variable and running the specs by hand from the command
line.

When the environment variable is not set, fall back to just running
whatever copy of wincent-strings-util happens to be found first in the
PATH.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoMove input files into subdirectory
Wincent Colaiuta [Sat, 22 Dec 2007 14:54:00 +0000 (15:54 +0100)] 
Move input files into subdirectory

Keep the spec directory cleaner by moving the input files into their own
subdirectory.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd specs for basic -merge use
Wincent Colaiuta [Fri, 21 Dec 2007 19:31:55 +0000 (20:31 +0100)] 
Add specs for basic -merge use

Test some simple cases: merging using an untranslated,
partially translated, and fully translated target localization.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoInitial specs
Wincent Colaiuta [Fri, 21 Dec 2007 18:38:47 +0000 (19:38 +0100)] 
Initial specs

This is an initial batch of specs written using RSpec. Seeing as this is
such a simple tool there doesn't seem to be much sense in doing internal
testing at the Objective-C level; instead just run the tool itself and
make sure it does what it's supposed to do. RSpec is used despite the
fact that wincent-strings-util has absolutely no Ruby in it, simply
because it's a nice framework for doing this kind of thing.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoHandle case where -base is supplied with no other options
Wincent Colaiuta [Fri, 21 Dec 2007 17:36:42 +0000 (18:36 +0100)] 
Handle case where -base is supplied with no other options

Supplying -base without any options is legal; it just means that no
transformation is applied to the input before outputting.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove unused variable
Wincent Colaiuta [Fri, 21 Dec 2007 15:59:17 +0000 (16:59 +0100)] 
Remove unused variable

Clean up unused variable lying around from previous version (when
duplicate keys were considered an error during combining).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate man page for new features
Wincent Colaiuta [Fri, 21 Dec 2007 15:58:22 +0000 (16:58 +0100)] 
Update man page for new features

Revise man page to document the new -extract and -combine switches.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoMake duplicate keys a warning rather than an error
Wincent Colaiuta [Fri, 21 Dec 2007 15:28:28 +0000 (16:28 +0100)] 
Make duplicate keys a warning rather than an error

Instead of disallowing duplicate keys during a combine operation, issue
a warning and allow the "target" version to take precedence.

This facilitates a common workflow wherein a localization is incomplete
and its strings file contains a number of key/value pairs that are
unlocalized. In this case those pairs will be extracted with extract()
and the partial strings file that results can be localized. When it
comes time to integrate the partial file, it is necessary to allow
those new strings to override the existing, unlocalized ones in the
previous version of the localizations' string file.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoHook up new combine() and extract() functions
Wincent Colaiuta [Fri, 21 Dec 2007 15:07:09 +0000 (16:07 +0100)] 
Hook up new combine() and extract() functions

These two functions can be used to help with incremental localization.

The extract() function looks at a base strings file (in the development
language) and compares it with a target strings file (in the target
langauge). All strings which are new (not present in the target) or
untranslated (present in the target but with the same value as in the
base) are extracted. The output can then be sent to translators for
translation.

The combine() function takes a partial strings file (of the kind
produced by the extract() function) and integrates it with an existing
file using a simple additive algorithm (not a merge). It is considered
an error if there is any overlap in the keys in the two files.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRefactoring and new functions
Wincent Colaiuta [Fri, 21 Dec 2007 14:40:54 +0000 (15:40 +0100)] 
Refactoring and new functions

This is part of a major clean-up to make way for some new functionality.
The NSScanner category has been split off into a separate file, and a
simple wrapper class has been added so as to eliminate the error-prone
and tedious use of an NSDictionary to model an "entry".

In many places the code has been touched up for better readability.

The functions for handling the new options are in place but not
hooked up yet.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoWhitespace fixes
Wincent Colaiuta [Fri, 21 Dec 2007 11:17:03 +0000 (12:17 +0100)] 
Whitespace fixes

Remove trailing whitespace.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump internal version number to 1.2
Wincent Colaiuta [Fri, 21 Dec 2007 11:12:24 +0000 (12:12 +0100)] 
Bump internal version number to 1.2

This is not yet an official release, but when it becomes
one it will be 1.2.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd x86_64 info for what(1)
Wincent Colaiuta [Fri, 21 Dec 2007 11:11:33 +0000 (12:11 +0100)] 
Add x86_64 info for what(1)

Although we don't produce an x86_64 build yet, make sure the what(1)
output is ready for it if and when we do.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoMove macro definitions to top of file
Wincent Colaiuta [Fri, 21 Dec 2007 11:10:41 +0000 (12:10 +0100)] 
Move macro definitions to top of file

These seem to confuse Xcode's function pop-up menu if they appear in
the middle of a function body, so move them up out of the way.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoSet-up top-level git ignore file
Wincent Colaiuta [Wed, 19 Dec 2007 11:48:21 +0000 (12:48 +0100)] 
Set-up top-level git ignore file

Ignore the "index" directory created in the SRCROOT by Xcode 3.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd installer package target
Wincent Colaiuta [Wed, 19 Dec 2007 11:47:17 +0000 (12:47 +0100)] 
Add installer package target

At the same time the project bundle format was upgraded to the latest
version of Xcode.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoInstaller package
Wincent Colaiuta [Sat, 28 Jul 2007 14:38:52 +0000 (16:38 +0200)] 
Installer package

Set up installer package (PackageMaker document, installer window background
PDF, GPL version 3 license in RTF format) and accompanying Shell Script build
phase.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoDrain pool before exiting
Wincent Colaiuta [Thu, 26 Jul 2007 20:12:58 +0000 (22:12 +0200)] 
Drain pool before exiting

Rather than just letting the autorelease pool leak at the end of execution do
the right thing and drain it first. There's no real need for it in this case
but it's a general good practice so I should get into the habit of doing it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoSilence GCC unused variable warning
Wincent Colaiuta [Tue, 17 Jul 2007 17:58:53 +0000 (19:58 +0200)] 
Silence GCC unused variable warning

Suppress "unused variable" warning for autorelease pools.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoReadability improvements
Wincent Colaiuta [Tue, 17 Jul 2007 17:46:36 +0000 (19:46 +0200)] 
Readability improvements

More source code reformatting for increased readability.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove workaround for auto-indentation bug
Wincent Colaiuta [Tue, 17 Jul 2007 17:41:53 +0000 (19:41 +0200)] 
Remove workaround for auto-indentation bug

The auto-indentation bug discovered in the Xcode 2 series (<rdar://problem/4450544>) no longer appears to be a problem in Xcode 3, so remove the workaround.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoReformatting for readability
Wincent Colaiuta [Tue, 17 Jul 2007 17:36:20 +0000 (19:36 +0200)] 
Reformatting for readability

Mostly whitespace adjustments (horizontal and vertical) to make better use of available space.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoObjective-C 2.0: fast enumeration
Wincent Colaiuta [Tue, 17 Jul 2007 17:26:24 +0000 (19:26 +0200)] 
Objective-C 2.0: fast enumeration

Replace old explicit for loops with Objective-C 2.0 fast enumeration.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoObjective C 2.0: garbarge collection
Wincent Colaiuta [Tue, 17 Jul 2007 17:13:28 +0000 (19:13 +0200)] 
Objective C 2.0: garbarge collection

Garbarge collection is already turned on; remove release and autorelease messages which are now redundant.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove references to no longer included Omni files
Wincent Colaiuta [Tue, 17 Jul 2007 17:09:20 +0000 (19:09 +0200)] 
Remove references to no longer included Omni files

Remove dead references to Omni files no longer included in repository.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number
Wincent Colaiuta [Tue, 17 Jul 2007 17:07:43 +0000 (19:07 +0200)] 
Bump version number

Bump version number (1.1+) in between releases.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUse default prefix header
Wincent Colaiuta [Tue, 17 Jul 2007 17:02:44 +0000 (19:02 +0200)] 
Use default prefix header

Rather than using a custom prefix header use the default prefix header for Foundation tools (inherited via build setting from Wincent Build Tools configuration).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUse configuration from Wincent Build Tools
Wincent Colaiuta [Tue, 17 Jul 2007 17:00:17 +0000 (19:00 +0200)] 
Use configuration from Wincent Build Tools

Replace hard-coded settings with configuration inherited from the Wincent Build Tools.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate project file to Xcode 3 format
Wincent Colaiuta [Tue, 17 Jul 2007 16:54:48 +0000 (18:54 +0200)] 
Update project file to Xcode 3 format

Update compatibility option to Xcode 3.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate Xcode project bundle ignore file
Wincent Colaiuta [Tue, 17 Jul 2007 16:52:53 +0000 (18:52 +0200)] 
Update Xcode project bundle ignore file

Update for Xcode 3, where mode files now have a "mode1v3" extension.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoIgnore files inside Xcode project bundle
Wincent Colaiuta [Mon, 16 Jul 2007 16:53:57 +0000 (18:53 +0200)] 
Ignore files inside Xcode project bundle

Set up ".gitignore" file inside Xcode project bundle to ignore all "pbxuser"
and "mode1" files, except for "default.pbxuser".

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove redundant RCSID tagging
Wincent Colaiuta [Mon, 16 Jul 2007 16:51:53 +0000 (18:51 +0200)] 
Remove redundant RCSID tagging

Remove now-redundant embedded $Id$ tag and the accompanying macro used to
embed it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>