sproutcore 1.6.0.rc.1-x86-mingw32 → 1.6.0.rc.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +31 -6
- data/{History.txt → History.rdoc} +0 -0
- data/{README.txt → README.rdoc} +3 -2
- data/Rakefile +15 -15
- data/{Todo.txt → Todo.rdoc} +0 -0
- data/VERSION.yml +1 -1
- data/lib/buildtasks/manifest.rake +11 -4
- data/lib/buildtasks/target.rake +20 -23
- data/lib/frameworks/sproutcore/CHANGELOG.md +36 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +2 -42
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +29 -12
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +110 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +63 -26
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +25 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +26 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +74 -53
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +6 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +25 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +46 -49
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +14 -2
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +2 -76
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +3348 -1591
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +25 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +0 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/requiredObjectForPropertyPath.js +29 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue.js +98 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +1 -1
- data/lib/gen/language/Buildfile +1 -1
- data/lib/sproutcore.rb +1 -14
- data/lib/sproutcore/buildfile/string_ext.rb +0 -4
- data/lib/sproutcore/helpers/cssmin.rb +44 -59
- data/lib/sproutcore/helpers/text_helper.rb +11 -13
- data/lib/sproutcore/models/manifest.rb +4 -4
- data/lib/sproutcore/models/target.rb +11 -110
- data/lib/sproutcore/rack.rb +0 -1
- data/lib/sproutcore/rack/dev.rb +0 -1
- data/lib/sproutcore/rack/proxy.rb +9 -8
- data/lib/sproutcore/rack/service.rb +1 -1
- data/lib/sproutcore/render_engines/haml.rb +2 -5
- data/lib/sproutcore/tools/build.rb +2 -0
- data/lib/sproutcore/tools/docs.rb +7 -36
- data/lib/sproutcore/tools/manifest.rb +1 -1
- data/spec/buildtasks/target_spec.rb +9 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +1 -1
- data/sproutcore.gemspec +3 -4
- data/vendor/chance/lib/chance/instance.rb +5 -8
- metadata +41 -207
- data/lib/doc_templates/jsdoc/allclasses.tmpl +0 -17
- data/lib/doc_templates/jsdoc/allfiles.tmpl +0 -56
- data/lib/doc_templates/jsdoc/class.tmpl +0 -487
- data/lib/doc_templates/jsdoc/index.tmpl +0 -38
- data/lib/doc_templates/jsdoc/publish.js +0 -170
- data/lib/doc_templates/jsdoc/static/default.css +0 -162
- data/lib/doc_templates/jsdoc/static/header.html +0 -2
- data/lib/doc_templates/jsdoc/static/index.html +0 -19
- data/lib/doc_templates/jsdoc/symbol.tmpl +0 -35
- data/lib/doc_templates/sproutcore/allclasses.tmpl +0 -0
- data/lib/doc_templates/sproutcore/allfiles.tmpl +0 -56
- data/lib/doc_templates/sproutcore/class.tmpl +0 -674
- data/lib/doc_templates/sproutcore/classes-json.tmpl +0 -55
- data/lib/doc_templates/sproutcore/index.tmpl +0 -62
- data/lib/doc_templates/sproutcore/publish.js +0 -346
- data/lib/doc_templates/sproutcore/static/default.css +0 -258
- data/lib/doc_templates/sproutcore/static/header.html +0 -2
- data/lib/doc_templates/sproutcore/static/index.html +0 -19
- data/lib/doc_templates/sproutcore/symbol.tmpl +0 -35
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +0 -55
- data/lib/sproutcore/rack/docs.rb +0 -24
- data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
- data/vendor/jsdoc/README.txt +0 -151
- data/vendor/jsdoc/app/frame.js +0 -33
- data/vendor/jsdoc/app/frame/Chain.js +0 -102
- data/vendor/jsdoc/app/frame/Dumper.js +0 -144
- data/vendor/jsdoc/app/frame/Hash.js +0 -47
- data/vendor/jsdoc/app/frame/Link.js +0 -142
- data/vendor/jsdoc/app/frame/Namespace.js +0 -10
- data/vendor/jsdoc/app/frame/Opt.js +0 -134
- data/vendor/jsdoc/app/frame/Reflection.js +0 -26
- data/vendor/jsdoc/app/frame/String.js +0 -93
- data/vendor/jsdoc/app/frame/Testrun.js +0 -129
- data/vendor/jsdoc/app/handlers/FOODOC.js +0 -26
- data/vendor/jsdoc/app/handlers/XMLDOC.js +0 -26
- data/vendor/jsdoc/app/handlers/XMLDOC/DomReader.js +0 -159
- data/vendor/jsdoc/app/handlers/XMLDOC/XMLDoc.js +0 -16
- data/vendor/jsdoc/app/handlers/XMLDOC/XMLParse.js +0 -292
- data/vendor/jsdoc/app/lib/JSDOC.js +0 -98
- data/vendor/jsdoc/app/lib/JSDOC/DocComment.js +0 -200
- data/vendor/jsdoc/app/lib/JSDOC/DocTag.js +0 -294
- data/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +0 -162
- data/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +0 -100
- data/vendor/jsdoc/app/lib/JSDOC/Lang.js +0 -144
- data/vendor/jsdoc/app/lib/JSDOC/Parser.js +0 -109
- data/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +0 -33
- data/vendor/jsdoc/app/lib/JSDOC/Symbol.js +0 -681
- data/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +0 -226
- data/vendor/jsdoc/app/lib/JSDOC/TextStream.js +0 -41
- data/vendor/jsdoc/app/lib/JSDOC/Token.js +0 -18
- data/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +0 -332
- data/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +0 -133
- data/vendor/jsdoc/app/lib/JSDOC/Util.js +0 -32
- data/vendor/jsdoc/app/lib/JSDOC/Walker.js +0 -453
- data/vendor/jsdoc/app/main.js +0 -74
- data/vendor/jsdoc/app/plugins/commentSrcJson.js +0 -19
- data/vendor/jsdoc/app/plugins/frameworkPrototype.js +0 -16
- data/vendor/jsdoc/app/plugins/functionCall.js +0 -10
- data/vendor/jsdoc/app/plugins/publishSrcHilite.js +0 -62
- data/vendor/jsdoc/app/plugins/sproutcoreTags.js +0 -26
- data/vendor/jsdoc/app/plugins/symbolLink.js +0 -9
- data/vendor/jsdoc/app/plugins/tagParamConfig.js +0 -31
- data/vendor/jsdoc/app/plugins/tagSynonyms.js +0 -43
- data/vendor/jsdoc/app/run.js +0 -346
- data/vendor/jsdoc/app/t/TestDoc.js +0 -144
- data/vendor/jsdoc/app/t/runner.js +0 -13
- data/vendor/jsdoc/app/test.js +0 -304
- data/vendor/jsdoc/app/test/addon.js +0 -24
- data/vendor/jsdoc/app/test/anon_inner.js +0 -14
- data/vendor/jsdoc/app/test/augments.js +0 -31
- data/vendor/jsdoc/app/test/augments2.js +0 -26
- data/vendor/jsdoc/app/test/borrows.js +0 -41
- data/vendor/jsdoc/app/test/borrows2.js +0 -23
- data/vendor/jsdoc/app/test/config.js +0 -22
- data/vendor/jsdoc/app/test/constructs.js +0 -18
- data/vendor/jsdoc/app/test/encoding.js +0 -10
- data/vendor/jsdoc/app/test/encoding_other.js +0 -12
- data/vendor/jsdoc/app/test/functions_anon.js +0 -39
- data/vendor/jsdoc/app/test/functions_nested.js +0 -33
- data/vendor/jsdoc/app/test/global.js +0 -13
- data/vendor/jsdoc/app/test/globals.js +0 -25
- data/vendor/jsdoc/app/test/ignore.js +0 -10
- data/vendor/jsdoc/app/test/inner.js +0 -16
- data/vendor/jsdoc/app/test/jsdoc_test.js +0 -477
- data/vendor/jsdoc/app/test/lend.js +0 -33
- data/vendor/jsdoc/app/test/memberof.js +0 -20
- data/vendor/jsdoc/app/test/memberof_constructor.js +0 -15
- data/vendor/jsdoc/app/test/name.js +0 -19
- data/vendor/jsdoc/app/test/namespace_nested.js +0 -23
- data/vendor/jsdoc/app/test/nocode.js +0 -13
- data/vendor/jsdoc/app/test/oblit_anon.js +0 -20
- data/vendor/jsdoc/app/test/overview.js +0 -20
- data/vendor/jsdoc/app/test/param_inline.js +0 -37
- data/vendor/jsdoc/app/test/params_optional.js +0 -8
- data/vendor/jsdoc/app/test/prototype.js +0 -17
- data/vendor/jsdoc/app/test/prototype_nested.js +0 -9
- data/vendor/jsdoc/app/test/prototype_oblit.js +0 -13
- data/vendor/jsdoc/app/test/prototype_oblit_constructor.js +0 -24
- data/vendor/jsdoc/app/test/public.js +0 -10
- data/vendor/jsdoc/app/test/shared.js +0 -42
- data/vendor/jsdoc/app/test/shared2.js +0 -2
- data/vendor/jsdoc/app/test/shortcuts.js +0 -22
- data/vendor/jsdoc/app/test/static_this.js +0 -13
- data/vendor/jsdoc/app/test/synonyms.js +0 -23
- data/vendor/jsdoc/app/test/tosource.js +0 -23
- data/vendor/jsdoc/app/test/variable_redefine.js +0 -14
- data/vendor/jsdoc/changes.txt +0 -47
- data/vendor/jsdoc/conf/sample.conf +0 -31
- data/vendor/jsdoc/java/build.xml +0 -36
- data/vendor/jsdoc/java/build_1.4.xml +0 -36
- data/vendor/jsdoc/java/classes/js.jar +0 -0
- data/vendor/jsdoc/java/src/JsDebugRun.java +0 -21
- data/vendor/jsdoc/java/src/JsRun.java +0 -21
- data/vendor/jsdoc/jsdebug.jar +0 -0
- data/vendor/jsdoc/jsrun.jar +0 -0
- data/vendor/jsdoc/t/TestDoc.js +0 -144
- data/vendor/jsdoc/t/runner.js +0 -13
- data/vendor/jsdoc/test.js +0 -304
- data/vendor/jsdoc/test/addon.js +0 -24
- data/vendor/jsdoc/test/anon_inner.js +0 -14
- data/vendor/jsdoc/test/augments.js +0 -31
- data/vendor/jsdoc/test/augments2.js +0 -26
- data/vendor/jsdoc/test/borrows.js +0 -41
- data/vendor/jsdoc/test/borrows2.js +0 -23
- data/vendor/jsdoc/test/config.js +0 -22
- data/vendor/jsdoc/test/constructs.js +0 -18
- data/vendor/jsdoc/test/encoding.js +0 -10
- data/vendor/jsdoc/test/encoding_other.js +0 -12
- data/vendor/jsdoc/test/functions_anon.js +0 -39
- data/vendor/jsdoc/test/functions_nested.js +0 -33
- data/vendor/jsdoc/test/global.js +0 -13
- data/vendor/jsdoc/test/globals.js +0 -25
- data/vendor/jsdoc/test/ignore.js +0 -10
- data/vendor/jsdoc/test/inner.js +0 -16
- data/vendor/jsdoc/test/jsdoc_test.js +0 -477
- data/vendor/jsdoc/test/lend.js +0 -33
- data/vendor/jsdoc/test/memberof.js +0 -20
- data/vendor/jsdoc/test/memberof_constructor.js +0 -15
- data/vendor/jsdoc/test/name.js +0 -19
- data/vendor/jsdoc/test/namespace_nested.js +0 -23
- data/vendor/jsdoc/test/nocode.js +0 -13
- data/vendor/jsdoc/test/oblit_anon.js +0 -20
- data/vendor/jsdoc/test/overview.js +0 -20
- data/vendor/jsdoc/test/param_inline.js +0 -37
- data/vendor/jsdoc/test/params_optional.js +0 -8
- data/vendor/jsdoc/test/prototype.js +0 -17
- data/vendor/jsdoc/test/prototype_nested.js +0 -9
- data/vendor/jsdoc/test/prototype_oblit.js +0 -13
- data/vendor/jsdoc/test/prototype_oblit_constructor.js +0 -24
- data/vendor/jsdoc/test/public.js +0 -10
- data/vendor/jsdoc/test/shared.js +0 -42
- data/vendor/jsdoc/test/shared2.js +0 -2
- data/vendor/jsdoc/test/shortcuts.js +0 -22
- data/vendor/jsdoc/test/static_this.js +0 -13
- data/vendor/jsdoc/test/synonyms.js +0 -23
- data/vendor/jsdoc/test/tosource.js +0 -23
- data/vendor/jsdoc/test/variable_redefine.js +0 -14
@@ -29,6 +29,9 @@ if (typeof console === 'undefined') {
|
|
29
29
|
console.log = console.info = console.warn = console.error = function(){};
|
30
30
|
}
|
31
31
|
|
32
|
+
window.SC = window.SC || {} ;
|
33
|
+
window.SproutCore = window.SproutCore || SC ;
|
34
|
+
|
32
35
|
// ........................................
|
33
36
|
// BOOTSTRAP
|
34
37
|
//
|
@@ -36,7 +39,7 @@ if (typeof console === 'undefined') {
|
|
36
39
|
// rest of the methods go into the mixin defined below.
|
37
40
|
|
38
41
|
/**
|
39
|
-
@version 1.6.0.rc.
|
42
|
+
@version 1.6.0.rc.2
|
40
43
|
@namespace
|
41
44
|
|
42
45
|
All SproutCore methods and functions are defined
|
@@ -54,10 +57,9 @@ if (typeof console === 'undefined') {
|
|
54
57
|
The core Base framework is based on the jQuery API with a number of
|
55
58
|
performance optimizations.
|
56
59
|
*/
|
57
|
-
|
58
|
-
window.SproutCore = window.SproutCore || SC ;
|
60
|
+
SC = window.SC; // This is dumb but necessary for jsdoc to get it right
|
59
61
|
|
60
|
-
SC.VERSION = '1.6.0.rc.
|
62
|
+
SC.VERSION = '1.6.0.rc.2';
|
61
63
|
|
62
64
|
/**
|
63
65
|
@private
|
@@ -304,7 +306,8 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
304
306
|
// GUIDS & HASHES
|
305
307
|
//
|
306
308
|
|
307
|
-
|
309
|
+
// Like jQuery.expando but without any risk of conflict
|
310
|
+
guidKey: "SproutCore" + ( SC.VERSION + Math.random() ).replace( /\D/g, "" ),
|
308
311
|
|
309
312
|
// Used for guid generation...
|
310
313
|
_guidPrefixes: {"number": "nu", "string": "st"},
|
@@ -731,6 +734,23 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
731
734
|
}
|
732
735
|
|
733
736
|
return root ;
|
737
|
+
},
|
738
|
+
|
739
|
+
/**
|
740
|
+
Acts very similar to SC.objectForPropertyPath(), the only difference is
|
741
|
+
that it will throw an error when object can't be found.
|
742
|
+
|
743
|
+
@param {String} path the path
|
744
|
+
@param {Object} root optional root object. window is used otherwise
|
745
|
+
@param {Integer} stopAt optional point to stop searching the path.
|
746
|
+
@returns {Object} the found object or throws an error.
|
747
|
+
*/
|
748
|
+
requiredObjectForPropertyPath: function(path, root, stopAt) {
|
749
|
+
var o = SC.objectForPropertyPath(path, root, stopAt);
|
750
|
+
if(!o) {
|
751
|
+
throw path + " could not be found";
|
752
|
+
}
|
753
|
+
return o;
|
734
754
|
}
|
735
755
|
|
736
756
|
}); // end mixin
|
@@ -28,9 +28,6 @@ sc_require('mixins/copyable');
|
|
28
28
|
// uses a backing SC.Array object to return each index
|
29
29
|
set.forEach(function(object) { .. })
|
30
30
|
|
31
|
-
// returns the index
|
32
|
-
set.forEachIndex(function(index) { ... });
|
33
|
-
|
34
31
|
// returns ranges
|
35
32
|
set.forEachRange(function(start, length) { .. });
|
36
33
|
|
@@ -9,17 +9,22 @@
|
|
9
9
|
// ========================================================================
|
10
10
|
/*globals module test ok same equals expects */
|
11
11
|
|
12
|
-
// An ObjectController will make a content object or an array of content objects
|
12
|
+
// An ObjectController will make a content object or an array of content objects
|
13
13
|
module("SC.objectForPropertyPath") ;
|
14
14
|
|
15
15
|
test("should be able to resolve an object on the window", function() {
|
16
16
|
var myLocal = (window.myGlobal = { test: 'this '}) ;
|
17
|
-
|
17
|
+
|
18
18
|
same(myLocal, { test: 'this '}) ;
|
19
19
|
same(window.myGlobal, { test: 'this '}) ;
|
20
|
-
|
20
|
+
|
21
21
|
// verify we can resolve our binding path
|
22
22
|
same(SC.objectForPropertyPath('myGlobal'), { test: 'this '}) ;
|
23
|
-
|
24
|
-
window.myGlobal =null
|
23
|
+
|
24
|
+
window.myGlobal = null;
|
25
|
+
});
|
26
|
+
|
27
|
+
test("should return undefined if object can't be found", function() {
|
28
|
+
var result = SC.objectForPropertyPath("notExistingObject");
|
29
|
+
same(result, undefined);
|
25
30
|
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
4
|
+
// ©2008-2011 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
// ========================================================================
|
8
|
+
// SC.requiredObjectForPropertyPath Tests
|
9
|
+
// ========================================================================
|
10
|
+
/*globals module test ok same equals expects */
|
11
|
+
|
12
|
+
module("SC.requiredObjectForPropertyPath") ;
|
13
|
+
|
14
|
+
test("should be able to resolve an object on the window", function() {
|
15
|
+
var myLocal = (window.myGlobal = { test: 'this '}) ;
|
16
|
+
|
17
|
+
same(myLocal, { test: 'this '}) ;
|
18
|
+
same(window.myGlobal, { test: 'this '}) ;
|
19
|
+
|
20
|
+
// verify we can resolve our binding path
|
21
|
+
same(SC.requiredObjectForPropertyPath('myGlobal'), { test: 'this '}) ;
|
22
|
+
|
23
|
+
window.myGlobal = null;
|
24
|
+
});
|
25
|
+
|
26
|
+
test("should throw error when object can't be found", function() {
|
27
|
+
should_throw(function(){ SC.requiredObjectForPropertyPath('notExistingObject'); },
|
28
|
+
Error, "notExistingObject could not be found");
|
29
|
+
});
|
@@ -0,0 +1,98 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore Costello - Property Observing Library
|
3
|
+
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
4
|
+
// Portions ©2008-2010 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
var callCount, obj;
|
9
|
+
|
10
|
+
module("SC.Observers.isObservingSuspended", {
|
11
|
+
setup: function() {
|
12
|
+
callCount = 0;
|
13
|
+
|
14
|
+
obj = SC.Object.create({
|
15
|
+
foo: "bar",
|
16
|
+
|
17
|
+
fooDidChange: function() {
|
18
|
+
callCount++;
|
19
|
+
}.observes('foo')
|
20
|
+
});
|
21
|
+
}
|
22
|
+
});
|
23
|
+
|
24
|
+
test("suspending observers stops notification", function() {
|
25
|
+
SC.Observers.suspendPropertyObserving();
|
26
|
+
SC.Observers.suspendPropertyObserving();
|
27
|
+
obj.set("foo");
|
28
|
+
equals(callCount, 0, 'should not notify observer while suspended');
|
29
|
+
|
30
|
+
SC.Observers.resumePropertyObserving();
|
31
|
+
equals(callCount, 0, 'should not notify observer while still suspended');
|
32
|
+
|
33
|
+
SC.Observers.resumePropertyObserving();
|
34
|
+
equals(callCount, 1, 'should notify observer when resumed');
|
35
|
+
|
36
|
+
});
|
37
|
+
|
38
|
+
// ..........................................................
|
39
|
+
// SPECIAL CASES
|
40
|
+
//
|
41
|
+
|
42
|
+
// this test verifies a specific bug in the SC.Observing.propertyDidChange method.
|
43
|
+
test("suspended notifications should work when nesting property change groups", function() {
|
44
|
+
|
45
|
+
SC.Observers.suspendPropertyObserving();
|
46
|
+
obj.beginPropertyChanges();
|
47
|
+
obj.set("foo");
|
48
|
+
equals(callCount, 0, 'should not notify observer while suspended');
|
49
|
+
|
50
|
+
obj.endPropertyChanges();
|
51
|
+
equals(callCount, 0, 'should not notify observer while suspended');
|
52
|
+
|
53
|
+
SC.Observers.resumePropertyObserving();
|
54
|
+
equals(callCount, 1, 'should notify observer when resumed');
|
55
|
+
});
|
56
|
+
|
57
|
+
|
58
|
+
module("SC.Observers.addObserver");
|
59
|
+
|
60
|
+
test("Object not yet instantiated", function() {
|
61
|
+
var garage, car, observer;
|
62
|
+
|
63
|
+
garage = SC.Object.create({
|
64
|
+
car: SC.Object.extend({
|
65
|
+
make: null
|
66
|
+
})
|
67
|
+
});
|
68
|
+
|
69
|
+
car = garage.get('car');
|
70
|
+
|
71
|
+
observer = SC.Object.create({
|
72
|
+
callCount: 0,
|
73
|
+
makeDidChange: function() {
|
74
|
+
this.callCount += 1;
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
ok(car.isClass, "The car object is not yet an instance, it's a class for now.");
|
79
|
+
|
80
|
+
// 1. SC.Observers.addObserver should queue the class, waiting for it to be an instance
|
81
|
+
SC.Observers.addObserver('car.make', observer, 'makeDidChange', garage);
|
82
|
+
ok(SC.Observers.queue.some(function(el) { return el[1] === observer; }), "The observer should have been queued because the car object is a class, not an instance.");
|
83
|
+
|
84
|
+
// 2. A call to SC.Observers.flush should leave the class in the queue because it's not yet an instance
|
85
|
+
SC.Observers.flush(garage);
|
86
|
+
ok(SC.Observers.queue.some(function(el) { return el[1] === observer; }), "The observer should still be in the queue.");
|
87
|
+
|
88
|
+
// 3. After we instantiate the class, a call to SC.Observers.flush shoud remove the object from the queue...
|
89
|
+
car = garage.car = car.create({ make: 'Renault' });
|
90
|
+
SC.Observers.flush(garage);
|
91
|
+
ok(!SC.Observers.queue.some(function(el) { return el[1] === observer; }), "The observer should have been removed from the queue.");
|
92
|
+
|
93
|
+
// 4. ...and the observer should work
|
94
|
+
car.set('make', 'Ferrari');
|
95
|
+
equals(observer.callCount, 1, "The observer should have been alled once.");
|
96
|
+
});
|
97
|
+
|
98
|
+
|
data/lib/gen/language/Buildfile
CHANGED
@@ -11,7 +11,7 @@ namespace :generator do
|
|
11
11
|
# name.
|
12
12
|
task :prepare do
|
13
13
|
long_languages = %w(english french german italian spanish japanese)
|
14
|
-
if language = GENERATOR.arguments[
|
14
|
+
if language = GENERATOR.arguments[1]
|
15
15
|
if long_languages.include?(language.downcase)
|
16
16
|
GENERATOR.language = language.downcase.capitalize
|
17
17
|
GENERATOR.filename = language.downcase + '.lproj'
|
data/lib/sproutcore.rb
CHANGED
@@ -11,25 +11,12 @@ require 'yaml'
|
|
11
11
|
|
12
12
|
$:.delete_if {|f| f =~ /json_pure-/ } if $:.any? {|f| f =~ /json-/ }
|
13
13
|
|
14
|
-
|
15
|
-
if (RUBY_VERSION.match(/1\.8/))
|
14
|
+
if RUBY_VERSION <= '1.8'
|
16
15
|
$KCODE = 'u'
|
17
16
|
require 'jcode'
|
18
17
|
class String ; def valid_encoding? ; true ; end ; end
|
19
18
|
end
|
20
19
|
|
21
|
-
# Ruby 1.9 Compatibility
|
22
|
-
if (RUBY_VERSION.match(/1\.9/))
|
23
|
-
# Fix for Rack Ruby 1.9 incompatibility. This makes 404s render again.
|
24
|
-
class String
|
25
|
-
alias each each_line unless ''.respond_to?(:each)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Makes code more readable
|
30
|
-
YES = true
|
31
|
-
NO = false
|
32
|
-
|
33
20
|
require "sproutcore/version"
|
34
21
|
|
35
22
|
module SproutCore
|
@@ -32,10 +32,6 @@ end # module Module
|
|
32
32
|
#
|
33
33
|
class String
|
34
34
|
rake_extension("ext") do
|
35
|
-
def replace_ext(newext)
|
36
|
-
sub(%r(([^/\\]\.)[^./\\]*$)) { $1 + newext }
|
37
|
-
end
|
38
|
-
|
39
35
|
# Replace the file extension with +newext+. If there is no extenson on
|
40
36
|
# the string, append the new extension to the end. If the new extension
|
41
37
|
# is not given, or is the empty string, remove any existing extension.
|
@@ -107,32 +107,31 @@ module SC::Helpers
|
|
107
107
|
# 2. Remove spaces around ;:{},
|
108
108
|
# 3. Remove tabs
|
109
109
|
def remove_spaces(script)
|
110
|
-
|
111
|
-
script
|
112
|
-
script
|
113
|
-
script
|
114
|
-
script
|
115
|
-
script
|
116
|
-
script.gsub("\t",'');
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
110
|
+
script.gsub!(/(\s(\s)+)/, ' ')
|
111
|
+
script.gsub!(/\s*;\s*/,';')
|
112
|
+
script.gsub!(/\s*:\s*/,':')
|
113
|
+
script.gsub!(/\s*\{\s*/,'{')
|
114
|
+
script.gsub!(/\s*\}\s*/,'}')
|
115
|
+
script.gsub!(/\s*,\s*/,',')
|
116
|
+
script.gsub!("\t",'');
|
117
|
+
script
|
118
|
+
end
|
119
|
+
|
120
|
+
# Replace color values with their shorter equivalent
|
121
|
+
#
|
122
|
+
# 1. Turn rgb(,,)-colors into #-values
|
123
|
+
# 2. Shorten #AABBCC down to #ABC
|
124
|
+
# 3. Replace names with their shorter hex-equivalent
|
125
|
+
# * white -> #fff
|
126
|
+
# * black -> #000
|
127
|
+
# 4. Replace #-values with their shorter name
|
128
|
+
# * #f00 -> red
|
129
|
+
def shorten_colors(style)
|
130
|
+
# rgb(50,101,152) to #326598
|
130
131
|
style = style.gsub(/rgb\s*\(\s*([0-9,\s]+)\s*\)/) do |match|
|
131
132
|
out = '#'
|
132
133
|
$1.split(',').each do |num|
|
133
|
-
if num.to_i < 16
|
134
|
-
out += '0'
|
135
|
-
end
|
134
|
+
out += '0' if num.to_i < 16
|
136
135
|
out += num.to_i.to_s(16) # convert to hex
|
137
136
|
end
|
138
137
|
out
|
@@ -146,54 +145,40 @@ module SC::Helpers
|
|
146
145
|
out
|
147
146
|
end
|
148
147
|
# shorten several names to numbers
|
149
|
-
style
|
150
|
-
style
|
151
|
-
style
|
152
|
-
style
|
148
|
+
style.gsub!(/:[\s]*white[\s]*;/, ':#fff;')
|
149
|
+
style.gsub!(/:[\s]*white[\s]*\}/, ':#fff}')
|
150
|
+
style.gsub!(/:[\s]*black[\s]*;/, ':#000;')
|
151
|
+
style.gsub!(/:[\s]*black[\s]*\}/, ':#000}')
|
153
152
|
# shotern several numbers to names
|
154
|
-
style
|
155
|
-
style
|
156
|
-
|
157
|
-
style
|
153
|
+
style.gsub!(/:[\s]*#([fF]00|[fF]{2}0000);/, ':red;')
|
154
|
+
style.gsub!(/:[\s]*#([fF]00|[fF]{2}0000)\}/, ':red}')
|
155
|
+
style
|
158
156
|
end
|
159
157
|
|
160
158
|
# Do miscellaneous compression methods on the style
|
161
159
|
def do_misc(script)
|
162
160
|
# Replace 0(pt,px,em,%) with 0 but only when preceded by : or a white-space
|
163
|
-
script
|
164
|
-
match.gsub(/(px|em|%|in|cm|mm|pc|pt|ex)/,'')
|
165
|
-
end
|
161
|
+
script.gsub!(/([\s:]+)(0)(px|em|%|in|cm|mm|pc|pt|ex)/) { |match| match.gsub(/(px|em|%|in|cm|mm|pc|pt|ex)/,'') }
|
166
162
|
# Replace 0 0 0 0; with 0.
|
167
|
-
script
|
168
|
-
script
|
169
|
-
script = script.gsub(':0 0 0;', ':0;')
|
170
|
-
script = script.gsub(':0 0 0}', ':0}')
|
171
|
-
script = script.gsub(':0 0}', ':0}')
|
172
|
-
script = script.gsub(':0 0;', ':0;')
|
163
|
+
script.gsub!(/:(0\s){0,3}0;/, ':0;')
|
164
|
+
script.gsub!(/:(0\s){0,3}0\}/, ':0}')
|
173
165
|
# Replace background-position:0; with background-position:0 0;
|
174
|
-
script
|
175
|
-
# Replace 0.6 to .6, but only when preceded by : or a white-space
|
176
|
-
script
|
177
|
-
match.sub('0', '') # only first '0' !!
|
178
|
-
end
|
166
|
+
script.gsub!('background-position:0;', 'background-position:0 0;');
|
167
|
+
# Replace 0.6 to .6, but only the first 0 and only when preceded by : or a white-space
|
168
|
+
script.gsub!(/[:\s]0+\.(\d+)/) { |match| match.sub('0', '') }
|
179
169
|
# Replace ;;;; with ;
|
180
|
-
script
|
170
|
+
script.gsub!(/[;]+/, ';')
|
181
171
|
# Replace ;} with }
|
182
|
-
script
|
172
|
+
script.gsub!(';}', '}')
|
183
173
|
# Replace background-color: with background:
|
184
|
-
script
|
174
|
+
script.gsub!('background-color:', 'background:')
|
185
175
|
# Replace font-weight:normal; with 400, bold with 700
|
186
|
-
script
|
187
|
-
script
|
188
|
-
script
|
189
|
-
|
190
|
-
|
191
|
-
script
|
192
|
-
script = script.gsub(/font-weight[\s]*:[\s]*bold[\s]*\}/,'font-weight:700}')
|
193
|
-
script = script.gsub(/font[\s]*:[\s]*bold[\s;\}]*/) do |match|
|
194
|
-
match.sub('bold', '700')
|
195
|
-
end
|
196
|
-
|
176
|
+
script.gsub!(/font-weight[\s]*:[\s]*normal[\s]*;/,'font-weight:400;')
|
177
|
+
script.gsub!(/font-weight[\s]*:[\s]*normal[\s]*\}/,'font-weight:400}')
|
178
|
+
script.gsub!(/font[\s]*:[\s]*normal[\s;\}]*/) { |match| match.sub!('normal', '400') }
|
179
|
+
script.gsub!(/font-weight[\s]*:[\s]*bold[\s]*;/,'font-weight:700;')
|
180
|
+
script.gsub!(/font-weight[\s]*:[\s]*bold[\s]*\}/,'font-weight:700}')
|
181
|
+
script.gsub!(/font[\s]*:[\s]*bold[\s;\}]*/) { |match| match.sub!('bold', '700') }
|
197
182
|
script
|
198
183
|
end
|
199
184
|
|
@@ -82,13 +82,10 @@ module SC
|
|
82
82
|
# <i>This method is only available if RedCloth[http://whytheluckystiff.net/ruby/redcloth/]
|
83
83
|
# is available</i>.
|
84
84
|
def textilize(text)
|
85
|
-
if text.blank?
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
|
90
|
-
textilized.to_html
|
91
|
-
end
|
85
|
+
return '' if text.blank?
|
86
|
+
textilized = RedCloth.new(text, [ :hard_breaks ])
|
87
|
+
textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=")
|
88
|
+
textilized.to_html
|
92
89
|
end
|
93
90
|
|
94
91
|
# Returns the text with all the Textile codes turned into HTML tags,
|
@@ -97,9 +94,9 @@ module SC
|
|
97
94
|
# is available</i>.
|
98
95
|
def textilize_without_paragraph(text)
|
99
96
|
textiled = textilize(text)
|
100
|
-
if textiled[0..2] ==
|
101
|
-
if textiled[-4..-1] ==
|
102
|
-
|
97
|
+
textiled = textiled[3..-1] if textiled[0..2] == '<p>'
|
98
|
+
textiled = textiled[0..-5] if textiled[-4..-1] == '</p>'
|
99
|
+
textiled
|
103
100
|
end
|
104
101
|
rescue LoadError
|
105
102
|
# We can't really help what's not there
|
@@ -209,7 +206,8 @@ module SC
|
|
209
206
|
if (cycle.nil? || cycle.values != values)
|
210
207
|
cycle = set_cycle(name, Cycle.new(*values))
|
211
208
|
end
|
212
|
-
|
209
|
+
|
210
|
+
cycle.to_s
|
213
211
|
end
|
214
212
|
|
215
213
|
# Resets a cycle so that it starts from the first element the next time
|
@@ -234,7 +232,7 @@ module SC
|
|
234
232
|
def to_s
|
235
233
|
value = @values[@index].to_s
|
236
234
|
@index = (@index + 1) % @values.size
|
237
|
-
|
235
|
+
value
|
238
236
|
end
|
239
237
|
end
|
240
238
|
|
@@ -244,7 +242,7 @@ module SC
|
|
244
242
|
# uses an instance variable of ActionView::Base.
|
245
243
|
def get_cycle(name)
|
246
244
|
@_cycles = Hash.new unless defined?(@_cycles)
|
247
|
-
|
245
|
+
@_cycles[name]
|
248
246
|
end
|
249
247
|
|
250
248
|
def set_cycle(name, cycle_object)
|