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.
Files changed (217) hide show
  1. data/CHANGELOG +31 -6
  2. data/{History.txt → History.rdoc} +0 -0
  3. data/{README.txt → README.rdoc} +3 -2
  4. data/Rakefile +15 -15
  5. data/{Todo.txt → Todo.rdoc} +0 -0
  6. data/VERSION.yml +1 -1
  7. data/lib/buildtasks/manifest.rake +11 -4
  8. data/lib/buildtasks/target.rake +20 -23
  9. data/lib/frameworks/sproutcore/CHANGELOG.md +36 -0
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +2 -42
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +2 -1
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -1
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +5 -5
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +29 -12
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +4 -4
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +9 -0
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +110 -0
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +63 -26
  19. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +25 -5
  20. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +3 -3
  21. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +26 -3
  22. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +74 -53
  23. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +6 -7
  24. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +6 -3
  25. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +25 -1
  26. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -3
  27. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +20 -1
  28. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +1 -1
  29. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +46 -49
  30. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +23 -0
  31. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +14 -2
  32. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +2 -76
  33. data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +3348 -1591
  34. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +25 -5
  35. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +0 -3
  36. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +10 -5
  37. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/requiredObjectForPropertyPath.js +29 -0
  38. data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue.js +98 -0
  39. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
  40. data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +1 -1
  41. data/lib/gen/language/Buildfile +1 -1
  42. data/lib/sproutcore.rb +1 -14
  43. data/lib/sproutcore/buildfile/string_ext.rb +0 -4
  44. data/lib/sproutcore/helpers/cssmin.rb +44 -59
  45. data/lib/sproutcore/helpers/text_helper.rb +11 -13
  46. data/lib/sproutcore/models/manifest.rb +4 -4
  47. data/lib/sproutcore/models/target.rb +11 -110
  48. data/lib/sproutcore/rack.rb +0 -1
  49. data/lib/sproutcore/rack/dev.rb +0 -1
  50. data/lib/sproutcore/rack/proxy.rb +9 -8
  51. data/lib/sproutcore/rack/service.rb +1 -1
  52. data/lib/sproutcore/render_engines/haml.rb +2 -5
  53. data/lib/sproutcore/tools/build.rb +2 -0
  54. data/lib/sproutcore/tools/docs.rb +7 -36
  55. data/lib/sproutcore/tools/manifest.rb +1 -1
  56. data/spec/buildtasks/target_spec.rb +9 -0
  57. data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +1 -1
  58. data/sproutcore.gemspec +3 -4
  59. data/vendor/chance/lib/chance/instance.rb +5 -8
  60. metadata +41 -207
  61. data/lib/doc_templates/jsdoc/allclasses.tmpl +0 -17
  62. data/lib/doc_templates/jsdoc/allfiles.tmpl +0 -56
  63. data/lib/doc_templates/jsdoc/class.tmpl +0 -487
  64. data/lib/doc_templates/jsdoc/index.tmpl +0 -38
  65. data/lib/doc_templates/jsdoc/publish.js +0 -170
  66. data/lib/doc_templates/jsdoc/static/default.css +0 -162
  67. data/lib/doc_templates/jsdoc/static/header.html +0 -2
  68. data/lib/doc_templates/jsdoc/static/index.html +0 -19
  69. data/lib/doc_templates/jsdoc/symbol.tmpl +0 -35
  70. data/lib/doc_templates/sproutcore/allclasses.tmpl +0 -0
  71. data/lib/doc_templates/sproutcore/allfiles.tmpl +0 -56
  72. data/lib/doc_templates/sproutcore/class.tmpl +0 -674
  73. data/lib/doc_templates/sproutcore/classes-json.tmpl +0 -55
  74. data/lib/doc_templates/sproutcore/index.tmpl +0 -62
  75. data/lib/doc_templates/sproutcore/publish.js +0 -346
  76. data/lib/doc_templates/sproutcore/static/default.css +0 -258
  77. data/lib/doc_templates/sproutcore/static/header.html +0 -2
  78. data/lib/doc_templates/sproutcore/static/index.html +0 -19
  79. data/lib/doc_templates/sproutcore/symbol.tmpl +0 -35
  80. data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +0 -55
  81. data/lib/sproutcore/rack/docs.rb +0 -24
  82. data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
  83. data/vendor/jsdoc/README.txt +0 -151
  84. data/vendor/jsdoc/app/frame.js +0 -33
  85. data/vendor/jsdoc/app/frame/Chain.js +0 -102
  86. data/vendor/jsdoc/app/frame/Dumper.js +0 -144
  87. data/vendor/jsdoc/app/frame/Hash.js +0 -47
  88. data/vendor/jsdoc/app/frame/Link.js +0 -142
  89. data/vendor/jsdoc/app/frame/Namespace.js +0 -10
  90. data/vendor/jsdoc/app/frame/Opt.js +0 -134
  91. data/vendor/jsdoc/app/frame/Reflection.js +0 -26
  92. data/vendor/jsdoc/app/frame/String.js +0 -93
  93. data/vendor/jsdoc/app/frame/Testrun.js +0 -129
  94. data/vendor/jsdoc/app/handlers/FOODOC.js +0 -26
  95. data/vendor/jsdoc/app/handlers/XMLDOC.js +0 -26
  96. data/vendor/jsdoc/app/handlers/XMLDOC/DomReader.js +0 -159
  97. data/vendor/jsdoc/app/handlers/XMLDOC/XMLDoc.js +0 -16
  98. data/vendor/jsdoc/app/handlers/XMLDOC/XMLParse.js +0 -292
  99. data/vendor/jsdoc/app/lib/JSDOC.js +0 -98
  100. data/vendor/jsdoc/app/lib/JSDOC/DocComment.js +0 -200
  101. data/vendor/jsdoc/app/lib/JSDOC/DocTag.js +0 -294
  102. data/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +0 -162
  103. data/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +0 -100
  104. data/vendor/jsdoc/app/lib/JSDOC/Lang.js +0 -144
  105. data/vendor/jsdoc/app/lib/JSDOC/Parser.js +0 -109
  106. data/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +0 -33
  107. data/vendor/jsdoc/app/lib/JSDOC/Symbol.js +0 -681
  108. data/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +0 -226
  109. data/vendor/jsdoc/app/lib/JSDOC/TextStream.js +0 -41
  110. data/vendor/jsdoc/app/lib/JSDOC/Token.js +0 -18
  111. data/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +0 -332
  112. data/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +0 -133
  113. data/vendor/jsdoc/app/lib/JSDOC/Util.js +0 -32
  114. data/vendor/jsdoc/app/lib/JSDOC/Walker.js +0 -453
  115. data/vendor/jsdoc/app/main.js +0 -74
  116. data/vendor/jsdoc/app/plugins/commentSrcJson.js +0 -19
  117. data/vendor/jsdoc/app/plugins/frameworkPrototype.js +0 -16
  118. data/vendor/jsdoc/app/plugins/functionCall.js +0 -10
  119. data/vendor/jsdoc/app/plugins/publishSrcHilite.js +0 -62
  120. data/vendor/jsdoc/app/plugins/sproutcoreTags.js +0 -26
  121. data/vendor/jsdoc/app/plugins/symbolLink.js +0 -9
  122. data/vendor/jsdoc/app/plugins/tagParamConfig.js +0 -31
  123. data/vendor/jsdoc/app/plugins/tagSynonyms.js +0 -43
  124. data/vendor/jsdoc/app/run.js +0 -346
  125. data/vendor/jsdoc/app/t/TestDoc.js +0 -144
  126. data/vendor/jsdoc/app/t/runner.js +0 -13
  127. data/vendor/jsdoc/app/test.js +0 -304
  128. data/vendor/jsdoc/app/test/addon.js +0 -24
  129. data/vendor/jsdoc/app/test/anon_inner.js +0 -14
  130. data/vendor/jsdoc/app/test/augments.js +0 -31
  131. data/vendor/jsdoc/app/test/augments2.js +0 -26
  132. data/vendor/jsdoc/app/test/borrows.js +0 -41
  133. data/vendor/jsdoc/app/test/borrows2.js +0 -23
  134. data/vendor/jsdoc/app/test/config.js +0 -22
  135. data/vendor/jsdoc/app/test/constructs.js +0 -18
  136. data/vendor/jsdoc/app/test/encoding.js +0 -10
  137. data/vendor/jsdoc/app/test/encoding_other.js +0 -12
  138. data/vendor/jsdoc/app/test/functions_anon.js +0 -39
  139. data/vendor/jsdoc/app/test/functions_nested.js +0 -33
  140. data/vendor/jsdoc/app/test/global.js +0 -13
  141. data/vendor/jsdoc/app/test/globals.js +0 -25
  142. data/vendor/jsdoc/app/test/ignore.js +0 -10
  143. data/vendor/jsdoc/app/test/inner.js +0 -16
  144. data/vendor/jsdoc/app/test/jsdoc_test.js +0 -477
  145. data/vendor/jsdoc/app/test/lend.js +0 -33
  146. data/vendor/jsdoc/app/test/memberof.js +0 -20
  147. data/vendor/jsdoc/app/test/memberof_constructor.js +0 -15
  148. data/vendor/jsdoc/app/test/name.js +0 -19
  149. data/vendor/jsdoc/app/test/namespace_nested.js +0 -23
  150. data/vendor/jsdoc/app/test/nocode.js +0 -13
  151. data/vendor/jsdoc/app/test/oblit_anon.js +0 -20
  152. data/vendor/jsdoc/app/test/overview.js +0 -20
  153. data/vendor/jsdoc/app/test/param_inline.js +0 -37
  154. data/vendor/jsdoc/app/test/params_optional.js +0 -8
  155. data/vendor/jsdoc/app/test/prototype.js +0 -17
  156. data/vendor/jsdoc/app/test/prototype_nested.js +0 -9
  157. data/vendor/jsdoc/app/test/prototype_oblit.js +0 -13
  158. data/vendor/jsdoc/app/test/prototype_oblit_constructor.js +0 -24
  159. data/vendor/jsdoc/app/test/public.js +0 -10
  160. data/vendor/jsdoc/app/test/shared.js +0 -42
  161. data/vendor/jsdoc/app/test/shared2.js +0 -2
  162. data/vendor/jsdoc/app/test/shortcuts.js +0 -22
  163. data/vendor/jsdoc/app/test/static_this.js +0 -13
  164. data/vendor/jsdoc/app/test/synonyms.js +0 -23
  165. data/vendor/jsdoc/app/test/tosource.js +0 -23
  166. data/vendor/jsdoc/app/test/variable_redefine.js +0 -14
  167. data/vendor/jsdoc/changes.txt +0 -47
  168. data/vendor/jsdoc/conf/sample.conf +0 -31
  169. data/vendor/jsdoc/java/build.xml +0 -36
  170. data/vendor/jsdoc/java/build_1.4.xml +0 -36
  171. data/vendor/jsdoc/java/classes/js.jar +0 -0
  172. data/vendor/jsdoc/java/src/JsDebugRun.java +0 -21
  173. data/vendor/jsdoc/java/src/JsRun.java +0 -21
  174. data/vendor/jsdoc/jsdebug.jar +0 -0
  175. data/vendor/jsdoc/jsrun.jar +0 -0
  176. data/vendor/jsdoc/t/TestDoc.js +0 -144
  177. data/vendor/jsdoc/t/runner.js +0 -13
  178. data/vendor/jsdoc/test.js +0 -304
  179. data/vendor/jsdoc/test/addon.js +0 -24
  180. data/vendor/jsdoc/test/anon_inner.js +0 -14
  181. data/vendor/jsdoc/test/augments.js +0 -31
  182. data/vendor/jsdoc/test/augments2.js +0 -26
  183. data/vendor/jsdoc/test/borrows.js +0 -41
  184. data/vendor/jsdoc/test/borrows2.js +0 -23
  185. data/vendor/jsdoc/test/config.js +0 -22
  186. data/vendor/jsdoc/test/constructs.js +0 -18
  187. data/vendor/jsdoc/test/encoding.js +0 -10
  188. data/vendor/jsdoc/test/encoding_other.js +0 -12
  189. data/vendor/jsdoc/test/functions_anon.js +0 -39
  190. data/vendor/jsdoc/test/functions_nested.js +0 -33
  191. data/vendor/jsdoc/test/global.js +0 -13
  192. data/vendor/jsdoc/test/globals.js +0 -25
  193. data/vendor/jsdoc/test/ignore.js +0 -10
  194. data/vendor/jsdoc/test/inner.js +0 -16
  195. data/vendor/jsdoc/test/jsdoc_test.js +0 -477
  196. data/vendor/jsdoc/test/lend.js +0 -33
  197. data/vendor/jsdoc/test/memberof.js +0 -20
  198. data/vendor/jsdoc/test/memberof_constructor.js +0 -15
  199. data/vendor/jsdoc/test/name.js +0 -19
  200. data/vendor/jsdoc/test/namespace_nested.js +0 -23
  201. data/vendor/jsdoc/test/nocode.js +0 -13
  202. data/vendor/jsdoc/test/oblit_anon.js +0 -20
  203. data/vendor/jsdoc/test/overview.js +0 -20
  204. data/vendor/jsdoc/test/param_inline.js +0 -37
  205. data/vendor/jsdoc/test/params_optional.js +0 -8
  206. data/vendor/jsdoc/test/prototype.js +0 -17
  207. data/vendor/jsdoc/test/prototype_nested.js +0 -9
  208. data/vendor/jsdoc/test/prototype_oblit.js +0 -13
  209. data/vendor/jsdoc/test/prototype_oblit_constructor.js +0 -24
  210. data/vendor/jsdoc/test/public.js +0 -10
  211. data/vendor/jsdoc/test/shared.js +0 -42
  212. data/vendor/jsdoc/test/shared2.js +0 -2
  213. data/vendor/jsdoc/test/shortcuts.js +0 -22
  214. data/vendor/jsdoc/test/static_this.js +0 -13
  215. data/vendor/jsdoc/test/synonyms.js +0 -23
  216. data/vendor/jsdoc/test/tosource.js +0 -23
  217. 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.1
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
- window.SC = window.SC || {} ;
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.1';
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
- guidKey: jQuery.expando || ("SproutCore" + ( SC.VERSION + Math.random() ).replace( /\D/g, "" )),
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
+
@@ -9,9 +9,9 @@ $theme.sc-list-item-view {
9
9
 
10
10
  .disclosure {
11
11
  position: absolute;
12
- left: -12px;
12
+ left: -6px;
13
13
  top: 50%;
14
- margin-top: -6px;
14
+ margin-top: -8px;
15
15
 
16
16
  width: 18px;
17
17
  height: 18px;
@@ -1,4 +1,4 @@
1
- /* TODO: when new SplitView lands, do this proper ($theme.split-divider) */
1
+ /* TODO: when new SplitView lands, do this proper (\$theme.split-divider) */
2
2
  $theme.split-divider {
3
3
  background: transparent;
4
4
  border: 0px none;
@@ -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[2]
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
- # Ruby 1.8 Compatibility
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
- script = script.gsub(/(\s(\s)+)/, ' ')
111
- script = script.gsub(/\s*;\s*/,';')
112
- script = script.gsub(/\s*:\s*/,':')
113
- script = script.gsub(/\s*\{\s*/,'{')
114
- script = script.gsub(/\s*\}\s*/,'}')
115
- script = script.gsub(/\s*,\s*/,',')
116
- script.gsub("\t",'');
117
- end
118
-
119
- # Replace color values with their shorter equivalent
120
- #
121
- # 1. Turn rgb(,,)-colors into #-values
122
- # 2. Shorten #AABBCC down to #ABC
123
- # 3. Replace names with their shorter hex-equivalent
124
- # * white -> #fff
125
- # * black -> #000
126
- # 4. Replace #-values with their shorter name
127
- # * #f00 -> red
128
- def shorten_colors(style)
129
- # rgb(50,101,152) to #326598
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 = style.gsub(/:[\s]*white[\s]*;/, ':#fff;')
150
- style = style.gsub(/:[\s]*white[\s]*\}/, ':#fff}')
151
- style = style.gsub(/:[\s]*black[\s]*;/, ':#000;')
152
- style = style.gsub(/:[\s]*black[\s]*\}/, ':#000}')
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 = style.gsub(/:[\s]*#([fF]00|[fF]{2}0000);/, ':red;')
155
- style = style.gsub(/:[\s]*#([fF]00|[fF]{2}0000)\}/, ':red}')
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 = script.gsub(/([\s:]+)(0)(px|em|%|in|cm|mm|pc|pt|ex)/) do |match|
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 = script.gsub(':0 0 0 0;', ':0;')
168
- script = script.gsub(':0 0 0 0}', ':0}')
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 = script.gsub('background-position:0;', 'background-position:0 0;');
175
- # Replace 0.6 to .6, but only when preceded by : or a white-space
176
- script = script.gsub(/[:\s]0+\.(\d+)/) do |match|
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 = script.gsub(/[;]+/, ';')
170
+ script.gsub!(/[;]+/, ';')
181
171
  # Replace ;} with }
182
- script = script.gsub(';}', '}')
172
+ script.gsub!(';}', '}')
183
173
  # Replace background-color: with background:
184
- script = script.gsub('background-color:', 'background:')
174
+ script.gsub!('background-color:', 'background:')
185
175
  # Replace font-weight:normal; with 400, bold with 700
186
- script = script.gsub(/font-weight[\s]*:[\s]*normal[\s]*;/,'font-weight:400;')
187
- script = script.gsub(/font-weight[\s]*:[\s]*normal[\s]*\}/,'font-weight:400}')
188
- script = script.gsub(/font[\s]*:[\s]*normal[\s;\}]*/) do |match|
189
- match.sub('normal', '400')
190
- end
191
- script = script.gsub(/font-weight[\s]*:[\s]*bold[\s]*;/,'font-weight:700;')
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
- else
88
- textilized = RedCloth.new(text, [ :hard_breaks ])
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] == "<p>" then textiled = textiled[3..-1] end
101
- if textiled[-4..-1] == "</p>" then textiled = textiled[0..-5] end
102
- return textiled
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
- return cycle.to_s
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
- return value
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
- return @_cycles[name]
245
+ @_cycles[name]
248
246
  end
249
247
 
250
248
  def set_cycle(name, cycle_object)