Merge branch 'master' of git@github.com:280north/cappuccino

This commit is contained in:
Francisco Ryan Tolmasky I committed 2008-10-06 17:38:14 -07:00
commit 7e28bbeee9
21 files changed
+222 -115

No files matched your search

+2 -2
View File
@@ -235,7 +235,7 @@ import <AppKit/CPView.j>
*/
- (void)setAllowsMultipleSelection:(BOOL)shouldAllowMultipleSelection
{
_allowsMultipleSelection = shouldAllowsMultipleSelection;
_allowsMultipleSelection = shouldAllowMultipleSelection;
}
/*
@@ -691,4 +691,4 @@ var CPCollectionViewItemViewKey = @"CPCollectionViewItemViewKey";
[aCoder encodeObject:_view forKey:CPCollectionViewItemViewKey];
}
@end
@end
+3 -1
View File
@@ -518,7 +518,9 @@ function hexToRGB(hex)
{
if(hex.length != 6)
return null;
hex = hex.toUpperCase();
for(var i=0; i<hex.length; i++)
if(hexCharacters.indexOf(hex.charAt(i)) == -1)
return null;
+13 -9
View File
@@ -5,26 +5,26 @@
<import file = "${environment.OBJJ_HOME}/lib/steam.xml" />
<target name = "clean">
<steam>
<steam-build>
<arguments>
<arg line = "-f AppKit.steam -c ${Configuration} clean" />
</arguments>
</steam>
</steam-build>
</target>
<target name = "build">
<steam>
<steam-build>
<arguments>
<arg line = "-f AppKit.steam -c ${Configuration} -t AppKit" />
</arguments>
</steam>
</steam-build>
<steam>
<steam-build>
<arguments>
<arg line = "-f AppKit.steam -c ${Configuration} -t AppKit-Rhino" />
</arguments>
</steam>
</steam-build>
<copy file = "../LICENSE" todir = "${Build}/${Configuration}/AppKit" />
@@ -34,11 +34,15 @@
<antcall target = "prepare-release" />
<copy todir = "${Build.Cappuccino.Tools.Frameworks}/AppKit">
<!--<copy todir = "${Build.Cappuccino.Tools.Frameworks}/AppKit">
<fileset dir = "${Build}/${Configuration}/AppKit" />
</copy>
</copy>-->
<copy todir = "${Build.Cappuccino.Tools.Lib.Frameworks}/AppKit">
<fileset dir = "${Build}/${Configuration}/AppKit" />
</copy>
<copy todir = "${Build.Cappuccino.Tools.Lib.Frameworks-Rhino}/AppKit">
<fileset dir = "${Build}/${Configuration}/AppKit-Rhino" />
</copy>
+4 -9
View File
@@ -656,21 +656,16 @@ import "CPException.j"
/*
Returns a string formed by concatenating the objects in the
receiver, with the specified separator string inserted between each part.
If the element is a Cappuccino object, then the <code>description</code>
If the element is a Objective-J object, then the <code>description</code>
of that object will be used, otherwise the default JavaScript representation will be used.
@param aString the separator that will separate each object string
@return the string representation of the array
*/
- (CPString)componentsJoinedByString:(CPString)aString
{
var index = 0,
count = [self count],
string = @"";
for(; index < count; ++i)
string += self[index].isa ? [self[index] description] : self[index];
return string;
// Objective-J objects get "description" called on them automatically when coerced to strings
// (see "objj_object.prototype.toString" at bottom of CPObject.j)
return join(aString);
}
// Creating a description of the array
-9
View File
@@ -372,12 +372,3 @@ var _CPLogInitPopup = function(logWindow)
}
}, false);
}
// override toString on Objective-J objects so we print the actual description of the object instead of [Object object]
objj_object.prototype.toString = function()
{
if (this.isa && class_getInstanceMethod(this.isa, "description") != NULL)
return [this description]
else
return String(this) + " (-description not implemented)";
}
+10
View File
@@ -453,3 +453,13 @@
}
@end
// override toString on Objective-J objects so we get the actual description of the object
// when coerced to a string, instead of "[Object object]"
objj_object.prototype.toString = function()
{
if (this.isa && class_getInstanceMethod(this.isa, "description") != NULL)
return [this description]
else
return String(this) + " (-description not implemented)";
}
+6 -13
View File
@@ -465,22 +465,15 @@ var CPStringHashes = new objj_dictionary();
*/
- (CPString)capitalizedString
{
var i = 0,
last = true,
capitalized = self;
for(; i < length; ++i)
var parts = self.split(/\b/g); // split on word boundaries
for (var i = 0; i < parts.length; i++)
{
var character = charAt(i);
if (character == ' ' || character == '\t' || character == '\n') last = true;
if (i == 0 || (/\s$/).test(parts[i-1])) // only capitalize if previous token was whitespace
parts[i] = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1).toLowerCase();
else
{
if (last) capitalized = capitalized.substr(0, i - 1) + character.toUpperCase() + capitalized.substr(i);
last = false;
}
parts[i] = parts[i].toLowerCase();
}
return capitalized;
return parts.join("");
}
/*
+11 -7
View File
@@ -5,20 +5,20 @@
<import file = "${environment.OBJJ_HOME}/lib/steam.xml" />
<target name = "clean">
<steam>
<steam-build>
<arguments>
<arg line = "-f Foundation.steam -c ${Configuration} clean" />
</arguments>
</steam>
</steam-build>
</target>
<target name = "build">
<steam>
<steam-build>
<arguments>
<arg line = "-f Foundation.steam -c ${Configuration}" />
</arguments>
</steam>
</steam-build>
<copy file = "../LICENSE" todir = "${Build}/${Configuration}/Foundation" />
@@ -28,11 +28,15 @@
<antcall target = "prepare-release" />
<copy todir = "${Build.Cappuccino.Tools.Frameworks}/Foundation">
<!--<copy todir = "${Build.Cappuccino.Tools.Frameworks}/Foundation">
<fileset dir = "${Build}/${Configuration}/Foundation" />
</copy>-->
<copy todir = "${Build.Cappuccino.Tools.Lib.Frameworks}/Foundation">
<fileset dir = "${Build}/${Configuration}/Foundation" />
</copy>
<copy todir = "${Build.Cappuccino.Tools.Lib.Frameworks}/Foundation">
<copy todir = "${Build.Cappuccino.Tools.Lib.Frameworks-Rhino}/Foundation">
<fileset dir = "${Build}/${Configuration}/Foundation" />
</copy>
+11 -7
View File
@@ -64,20 +64,24 @@
<antcall target = "prepare-release" />
<mkdir dir = "${Build.Cappuccino.Tools.Frameworks}/Objective-J" />
<!--<mkdir dir = "${Build.Cappuccino.Tools.Frameworks}/Objective-J" />
<copy todir = "${Build.Cappuccino.Tools.Frameworks}/Objective-J" >
<fileset dir = "${Build.Objective-J}/Objective-J" />
</copy>
</copy>-->
<mkdir dir = "${Build.Cappuccino.Tools.Lib.Frameworks}/Objective-J" />
<copy file = "${Build.Products}/Rhino/Objective-J.js" todir = "${Build.Cappuccino.Tools.Lib.Frameworks}/Objective-J" />
<copy file = "../LICENSE" todir = "${Build.Cappuccino.Tools.Lib.Frameworks}/Objective-J" />
<copy todir = "${Build.Cappuccino.Tools.Lib.Frameworks}/Objective-J" >
<fileset dir = "${Build.Objective-J}/Objective-J" />
</copy>
<mkdir dir = "${Build.Cappuccino.Tools.Lib.Frameworks-Rhino}/Objective-J" />
<copy file = "${Build.Products}/Rhino/Objective-J.js" todir = "${Build.Cappuccino.Tools.Lib.Frameworks-Rhino}/Objective-J" />
<copy file = "../LICENSE" todir = "${Build.Cappuccino.Tools.Lib.Frameworks-Rhino}/Objective-J" />
<mkdir dir = "${Build.Cappuccino.Starter.Frameworks}/Objective-J" />
<copy todir = "${Build.Cappuccino.Starter.Frameworks}/Objective-J" >
<fileset dir = "${Build.Objective-J}/Objective-J" />
</copy>
</copy>
<mkdir dir = "${Build.Cappuccino.Starter}/NewApplication/Frameworks/Objective-J" />
<copy todir = "${Build.Cappuccino.Starter}/NewApplication/Frameworks/Objective-J" >
+21
View File
@@ -0,0 +1,21 @@
import <Foundation/CPArray.j>
import <Foundation/CPString.j>
import <Foundation/CPNumber.j>
@implementation CPArrayTest : OJTestCase
- (void)testComponentsJoinedByString
{
var testStrings = [
[[], "", ""],
[[], "-", ""],
[[1,2], "-", "1-2"],
[[1,2,3], "-", "1-2-3"],
[["123", 456], "-", "123-456"]
];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] componentsJoinedByString:testStrings[i][1]] equals:testStrings[i][2]];
}
@end
+29 -37
View File
@@ -24,47 +24,39 @@ import <Foundation/CPString.j>
message:"stringByAppendingFormat: expected:" + expectedString + " actual:" + actualString];
}
- (void) testBoolValue
- (void)testBoolValue
{
var testString = @" 090";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
var testStrings = [
[" 090", YES],
[" YES", YES],
[" true", YES],
[" True", YES],
[" tTR", YES],
[" +98", YES],
[" -98", YES],
[" +08", YES],
[" -98", YES],
[" NO", NO],
[" -N00", NO],
[" 00", NO],
[" -00", NO]
];
testString = @" YES";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" true";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" True";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] boolValue] equals:testStrings[i][1]];
}
testString = @" tTR";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" +98";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" -98";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" +08";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" -98";
[self assertTrue:[testString boolValue] message:"boolValue for the string " + testString + " should return true"];
testString = @" NO";
[self assertFalse:[testString boolValue] message:"boolValue for the string " + testString + " should return false"];
testString = @" -N00";
[self assertFalse:[testString boolValue] message:"boolValue for the string " + testString + " should return false"];
testString = @" 00";
[self assertFalse:[testString boolValue] message:"boolValue for the string " + testString + " should return false"];
testString = @" -00";
[self assertFalse:[testString boolValue] message:"boolValue for the string " + testString + " should return false"];
- (void)testCapitalizedString
{
var testStrings = [
["", ""],
["hElLo wOrLd", "Hello World"],
[" monkey-Cow", " Monkey-cow"],
["tHe QuicK bRowN-Fox JumPed_Over +the LaZy%dog", "The Quick Brown-fox Jumped_over +the Lazy%dog"]
];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] capitalizedString] equals:testStrings[i][1]];
}
+5 -1
View File
@@ -20,8 +20,12 @@
<antcall target = "prepare-release"/>
<mkdir dir = "${Build.Cappuccino.Starter}/NewApplication" />
<mkdir dir = "${Build.Cappuccino.Tools.Lib}/NewApplication" />
<copy todir = "${Build.Cappuccino.Tools.Lib}/NewApplication">
<filelist refid = "NewApplication Files" />
</copy>
<mkdir dir = "${Build.Cappuccino.Starter}/NewApplication" />
<copy todir = "${Build.Cappuccino.Starter}/NewApplication">
<filelist refid = "NewApplication Files" />
</copy>
+2 -2
View File
@@ -13,13 +13,13 @@
{
"src" : "Foundation",
"dst" : "Frameworks/Foundation",
"build" : "steam -c Release -b BUILD_PATH",
"build" : "steam build -c Release -b BUILD_PATH",
"copyFrom" : "Release/Foundation"
},
{
"src" : "AppKit",
"dst" : "Frameworks/AppKit",
"build" : "steam -c Release -b BUILD_PATH",
"build" : "steam build -c Release -b BUILD_PATH",
"copyFrom" : "Release/AppKit"
}
]
+4 -4
View File
@@ -5,20 +5,20 @@
<import file = "${environment.OBJJ_HOME}/lib/steam.xml" />
<target name = "clean">
<steam>
<steam-build>
<arguments>
<arg line = "-f nib2cib.steam -c ${Configuration} clean" />
</arguments>
</steam>
</steam-build>
</target>
<target name = "build">
<steam>
<steam-build>
<arguments>
<arg line = "-f nib2cib.steam -c ${Configuration} -t nib2cib" />
</arguments>
</steam>
</steam-build>
</target>
+4 -2
View File
@@ -43,9 +43,11 @@ if [[ `uname` == CYGWIN* ]]; then
CLASSPATH=`cygpath -wp "$CLASSPATH"`
fi
export OBJJ_LIB
#if [ -e $STEAM_BUILD/Objective-J.build/Release/Rhino ]; then
$RLWRAP java -classpath $CLASSPATH objj $OBJJ_LIB $@
#$RLWRAP java -classpath $CLASSPATH org.mozilla.javascript.tools.shell.Main $OBJJ $OBJJ_LIB $STEAM_BUILD $@
$RLWRAP java -classpath $CLASSPATH objj $@
#$RLWRAP java -classpath $CLASSPATH org.mozilla.javascript.tools.shell.Main $OBJJ $@
#else
# echo "Missing frameworks at $STEAM_BUILD/Objective-J.build/Release/Rhino" 1>&2
#fi
+17 -10
View File
@@ -1,9 +1,8 @@
debug = false;
args = arguments;
var OBJJ_LIB = arguments[0];
arguments.splice(0, 1);
// FIXME: remove Rhino/Java dependencies
var OBJJ_LIB = Packages.java.lang.System.getenv("OBJJ_LIB");
if (typeof window == "undefined")
{
@@ -14,7 +13,7 @@ if (typeof window == "undefined")
if (typeof objj_import == "undefined")
{
print("Loading Objective-J.");
load(OBJJ_LIB+'/Frameworks/Objective-J/Objective-J.js');
load(OBJJ_LIB+'/Frameworks-Rhino/Objective-J/Objective-J.js');
}
var OBJJ_INCLUDE_PATHS_STRING = getEnv("OBJJ_INCLUDE_PATHS");
@@ -24,19 +23,27 @@ if (OBJJ_INCLUDE_PATHS_STRING)
}
else
{
OBJJ_INCLUDE_PATHS = [OBJJ_LIB+'/Frameworks'];
OBJJ_INCLUDE_PATHS = [OBJJ_LIB+'/Frameworks-Rhino'];
}
try {
if (arguments.length > 0)
if (args.length > 0)
{
var main_file = arguments[0];
arguments.splice(0, 1);
var mainFilename = args.shift();
mainFile = new Packages.java.io.File(mainFilename);
if (!mainFile.exists())
{
print(mainFile.getAbsolutePath() + " not found.")
Packages.java.System.exit(1);
}
var mainFilePath = mainFile.getAbsolutePath();
if (debug)
print("Loading: " + main_file);
print("Loading: " + mainFilePath);
objj_import(main_file, YES);
objj_import(mainFilePath, YES);
serviceTimeouts();
+2
View File
@@ -32,4 +32,6 @@ if [[ `uname` == CYGWIN* ]]; then
STEAM_BUILD=`cygpath -wp "$STEAM_BUILD"`
fi
export OBJJ_LIB
java -classpath $CLASSPATH steam $@
+67
View File
@@ -317,7 +317,74 @@ Project.prototype.copyResources = function()
rsync(this._resources, this.buildProducts());
}
function printUsage(command)
{
var usage = "usage: steam COMMAND [ARGS]\n\n"+
"The most commonly used steam commands are:\n"+
"\tbuild Build a project\n"+
"\tcreate Create a new project\n\n"+
"See 'steam help COMMAND' for more information on a specific command.";
switch (command)
{
case "--help" :
case undefined :
java.lang.System.out.println(usage);
break;
default :
java.lang.System.out.println("steam: '" + command + "' is not a steam command. See 'steam --help'.");
}
java.lang.System.exit(1);
}
function main()
{
if (arguments.length < 1)
printUsage();
var command = Array.prototype.shift.apply(arguments);
switch (command)
{
case "create" :
mainCreate.apply(mainCreate, arguments);
break;
case "build" :
mainBuild.apply(mainBuild, arguments);
break;
default :
printUsage(command);
}
}
function mainCreate()
{
var OBJJ_LIB = System.getenv("OBJJ_LIB");
if (arguments.length < 1)
printUsage("create");
var dst = arguments[0];
var srcNewApp = new File(OBJJ_LIB+"/NewApplication"),
srcFrameworks = new File(OBJJ_LIB+"/Frameworks"),
dstNewApp = new File(dst),
dstFrameworks = new File(dst+"/Frameworks");
System.out.println(srcNewApp.getCanonicalPath() + "," + dstNewApp.getCanonicalPath() + "," + srcFrameworks.getCanonicalPath() + "," + dstFrameworks.getCanonicalPath());
if (!dstNewApp.exists())
{
exec(["cp", "-vR", srcNewApp.getCanonicalPath(), dstNewApp.getCanonicalPath()], true);
exec(["cp", "-vR", srcFrameworks.getCanonicalPath(), dstFrameworks.getCanonicalPath()], true);
}
else
{
System.out.println("Directory already exists");
}
}
function mainBuild()
{
var index = 0,
count = arguments.length,
+2 -1
View File
@@ -2,12 +2,13 @@
<!-- Steam -->
<macrodef name = "steam">
<macrodef name = "steam-build">
<element name = "arguments" optional = "true" />
<sequential>
<exec executable = "steam">
<arg value = "build"/>
<arguments/>
</exec>
</sequential>
+6
View File
@@ -45,5 +45,11 @@
</files>
</iterate>
</target>
<target name = "install-tools">
<exec executable = "sh" dir = "${Build}/Cappuccino/Tools">
<arg value = "install-tools" />
</exec>
</target>
</project>
+3 -1
View File
@@ -19,6 +19,7 @@
<property name = "Build.Cappuccino.Tools.Bin" location = "${Build.Cappuccino.Tools}/objj/bin" />
<property name = "Build.Cappuccino.Tools.Lib" location = "${Build.Cappuccino.Tools}/objj/lib" />
<property name = "Build.Cappuccino.Tools.Lib.Frameworks" location = "${Build.Cappuccino.Tools}/objj/lib/Frameworks" />
<property name = "Build.Cappuccino.Tools.Lib.Frameworks-Rhino" location = "${Build.Cappuccino.Tools}/objj/lib/Frameworks-Rhino" />
<property name = "Build.Cappuccino.Tools.Editors" location = "${Build.Cappuccino.Tools}/Editors" />
@@ -36,13 +37,14 @@
<mkdir dir = "${Build.Cappuccino.Starter.Frameworks}" />
<mkdir dir = "${Build.Cappuccino.Tools}" />
<mkdir dir = "${Build.Cappuccino.Tools.Frameworks}" />
<!--<mkdir dir = "${Build.Cappuccino.Tools.Frameworks}" />-->
<mkdir dir = "${Build.Cappuccino.Tools.Objj}" />
<mkdir dir = "${Build.Cappuccino.Tools.Bin}" />
<mkdir dir = "${Build.Cappuccino.Tools.Lib}" />
<mkdir dir = "${Build.Cappuccino.Tools.Lib.Frameworks}" />
<mkdir dir = "${Build.Cappuccino.Tools.Lib.Frameworks-Rhino}" />
<mkdir dir = "${Build.Cappuccino.Tools.Editors}" />