sproutcore 1.0.1003 → 1.0.1008

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. data/Buildfile +15 -3
  2. data/Rakefile +3 -7
  3. data/VERSION.yml +2 -2
  4. data/buildtasks/manifest.rake +2 -0
  5. data/frameworks/sproutcore/Buildfile +2 -0
  6. data/frameworks/sproutcore/HISTORY +218 -203
  7. data/frameworks/sproutcore/README +47 -6
  8. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
  9. data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
  10. data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
  11. data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
  12. data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
  13. data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
  14. data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
  15. data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
  16. data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
  17. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
  18. data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
  19. data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
  20. data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
  21. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
  22. data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
  23. data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
  24. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
  25. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
  26. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
  27. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
  28. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
  29. data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
  30. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
  31. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
  32. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
  33. data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
  34. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
  35. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
  36. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
  37. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
  38. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
  39. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
  40. data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
  41. data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
  42. data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
  43. data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
  44. data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
  45. data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
  46. data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
  47. data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
  48. data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
  49. data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
  50. data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
  51. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
  52. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
  53. data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
  54. data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
  55. data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
  56. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
  57. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
  58. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
  59. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
  60. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
  61. data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
  62. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
  63. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
  64. data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
  65. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
  66. data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
  67. data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
  68. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
  69. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
  70. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
  71. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
  72. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
  73. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
  74. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
  75. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
  76. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
  77. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
  78. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
  79. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
  80. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
  81. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
  82. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
  83. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
  84. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
  85. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
  86. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
  87. data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
  88. data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
  89. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
  90. data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
  91. data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
  92. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
  93. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
  94. data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
  95. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
  96. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
  97. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
  98. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
  99. data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
  100. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
  101. data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
  102. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
  103. data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
  104. data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
  105. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
  106. data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
  107. data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
  108. data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
  109. data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
  110. data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
  111. data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
  112. data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
  113. data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
  114. data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
  115. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
  116. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
  117. data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
  118. data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
  119. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
  120. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
  121. data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
  122. data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
  123. data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
  124. data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
  125. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
  126. data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
  127. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
  128. data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
  129. data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
  130. data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
  131. data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
  132. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
  133. data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
  134. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
  135. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
  136. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
  137. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
  138. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
  139. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
  140. data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
  141. data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
  142. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
  143. data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
  144. data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
  145. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
  146. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
  147. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
  148. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
  149. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
  150. data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
  151. data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
  152. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
  153. data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
  154. data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
  155. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
  156. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
  157. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
  158. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
  159. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
  160. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
  161. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
  162. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
  163. data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
  164. data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
  165. data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
  166. data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
  167. data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
  168. data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
  169. data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
  170. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
  171. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
  172. data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
  173. data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
  174. data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
  175. data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
  176. data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
  177. data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
  178. data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
  179. data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
  180. data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
  181. data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
  182. data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
  183. data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
  184. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
  185. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
  186. data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
  187. data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
  188. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
  189. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
  190. data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
  191. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
  192. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
  193. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
  194. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
  195. data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
  196. data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
  197. data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
  198. data/frameworks/sproutcore/lib/index.rhtml +6 -20
  199. data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  200. data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
  201. data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
  202. data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
  203. data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
  204. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  205. data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
  206. data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
  207. data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
  208. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
  209. data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
  210. data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
  211. data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
  212. data/gen/data-source/Buildfile +18 -0
  213. data/gen/data-source/README +1 -0
  214. data/gen/data-source/USAGE +15 -0
  215. data/gen/data-source/templates/data_sources/@filename@.js +64 -0
  216. data/lib/sproutcore/builders/combine.rb +23 -0
  217. data/lib/sproutcore/builders/javascript.rb +27 -2
  218. data/lib/sproutcore/buildfile/task.rb +1 -1
  219. data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
  220. data/lib/sproutcore/helpers/static_helper.rb +79 -0
  221. data/lib/sproutcore/models/manifest.rb +2 -2
  222. data/lib/sproutcore/models/target.rb +1 -1
  223. data/lib/sproutcore/tools/build.rb +1 -1
  224. data/lib/sproutcore/tools/docs.rb +3 -3
  225. data/lib/sproutcore/tools/gen.rb +17 -15
  226. data/lib/sproutcore/tools/manifest.rb +9 -9
  227. data/lib/sproutcore/tools/server.rb +3 -3
  228. data/lib/sproutcore/tools.rb +259 -250
  229. data/lib/sproutcore.rb +9 -1
  230. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
  231. data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
  232. data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
  233. data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
  234. data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
  235. data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
  236. data/spec/lib/models/manifest/find_entry.rb +12 -0
  237. data/spec/lib/tools/gen_spec.rb +1 -0
  238. data/spec/lib/tools/tools_spec.rb +1 -0
  239. data/sproutcore-abbot.gemspec +36 -44
  240. metadata +43 -44
  241. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
  242. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
  243. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
  244. data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
  245. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
  246. data/lib/thor/CHANGELOG.rdoc +0 -52
  247. data/lib/thor/LICENSE +0 -20
  248. data/lib/thor/README.markdown +0 -76
  249. data/lib/thor/Rakefile +0 -6
  250. data/lib/thor/Thorfile +0 -45
  251. data/lib/thor/bin/rake2thor +0 -83
  252. data/lib/thor/bin/thor +0 -7
  253. data/lib/thor/lib/thor/error.rb +0 -3
  254. data/lib/thor/lib/thor/options.rb +0 -267
  255. data/lib/thor/lib/thor/ordered_hash.rb +0 -64
  256. data/lib/thor/lib/thor/runner.rb +0 -305
  257. data/lib/thor/lib/thor/task.rb +0 -83
  258. data/lib/thor/lib/thor/task_hash.rb +0 -22
  259. data/lib/thor/lib/thor/tasks/package.rb +0 -18
  260. data/lib/thor/lib/thor/tasks.rb +0 -77
  261. data/lib/thor/lib/thor/util.rb +0 -75
  262. data/lib/thor/lib/thor.rb +0 -170
  263. data/lib/thor/script/destroy +0 -14
  264. data/lib/thor/script/generate +0 -14
  265. data/lib/thor/spec/fixtures/task.thor +0 -10
  266. data/lib/thor/spec/options_spec.rb +0 -271
  267. data/lib/thor/spec/ordered_hash_spec.rb +0 -84
  268. data/lib/thor/spec/spec.opts +0 -1
  269. data/lib/thor/spec/spec_helper.rb +0 -30
  270. data/lib/thor/spec/task_spec.rb +0 -11
  271. data/lib/thor/spec/tasks_spec.rb +0 -28
  272. data/lib/thor/spec/thor_runner_spec.rb +0 -194
  273. data/lib/thor/spec/thor_spec.rb +0 -206
  274. data/lib/thor/spec/util_spec.rb +0 -99
  275. data/lib/thor/task.thor +0 -15
  276. data/lib/thor/thor.gemspec +0 -29
@@ -70,7 +70,8 @@ SC.Responder = SC.Object.extend( /** SC.Responder.prototype */ {
70
70
  @returns {SC.Responder} receiver
71
71
  */
72
72
  becomeFirstResponder: function() {
73
- var pane = this.get('pane') || this.get('responderContext');
73
+ var pane = this.get('pane') || this.get('responderContext') ||
74
+ this.pane();
74
75
  if (pane && this.get('acceptsFirstResponder')) {
75
76
  if (pane.get('firstResponder') !== this) pane.makeFirstResponder(this);
76
77
  }
@@ -0,0 +1,457 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
4
+ // Portions ©2008-2009 Apple Inc. All rights reserved.
5
+ // License: Licened under MIT license (see license.js)
6
+ // ==========================================================================
7
+ /*global ActiveXObject */
8
+
9
+ /**
10
+ A response represents a single response from a server request. An instance
11
+ of this class is returned whenever you call SC.Request.send().
12
+
13
+ TODO: Add more info
14
+
15
+ @extend SC.Object
16
+ @since SproutCore 1.0
17
+ */
18
+ SC.Response = SC.Object.extend(
19
+ /** @scope SC.Response.prototype */ {
20
+
21
+ /**
22
+ Becomes true if there was a failure. Makes this into an error object.
23
+
24
+ @property {Boolean}
25
+ */
26
+ isError: NO,
27
+
28
+ /**
29
+ Always the current response
30
+
31
+ @property {SC.Response}
32
+ */
33
+ errorValue: function() {
34
+ return this;
35
+ }.property().cacheable(),
36
+
37
+ /**
38
+ The error object generated when this becomes an error
39
+
40
+ @property {SC.Error}
41
+ */
42
+ errorObject: null,
43
+
44
+ /**
45
+ Request used to generate this response. This is a copy of the original
46
+ request object as you may have modified the original request object since
47
+ then.
48
+
49
+ To retrieve the original request object use originalRequest.
50
+
51
+ @property {SC.Request}
52
+ */
53
+ request: null,
54
+
55
+ /**
56
+ The request object that originated this request series. Mostly this is
57
+ useful if you are looking for a reference to the original request. To
58
+ inspect actual properties you should use request instead.
59
+
60
+ @property {SC.Request}
61
+ */
62
+ originalRequest: function() {
63
+ var ret = this.get('request');
64
+ while (ret.get('source')) ret = ret.get('source');
65
+ return ret ;
66
+ }.property('request').cacheable(),
67
+
68
+ /**
69
+ Type of request. Must be an HTTP method. Based on the request
70
+
71
+ @property {String}
72
+ */
73
+ type: function() {
74
+ return this.getPath('request.type');
75
+ }.property('request').cacheable(),
76
+
77
+ /**
78
+ URL of request.
79
+
80
+ @property {String}
81
+ */
82
+ address: function() {
83
+ return this.getPath('request.address');
84
+ }.property('request').cacheable(),
85
+
86
+ /**
87
+ If set then will attempt to automatically parse response as JSON
88
+ regardless of headers.
89
+
90
+ @property {Boolean}
91
+ */
92
+ isJSON: function() {
93
+ return this.getPath('request.isJSON') || NO;
94
+ }.property('request').cacheable(),
95
+
96
+ /**
97
+ If set, then will attempt to automatically parse response as XML
98
+ regarldess of headers.
99
+
100
+ @property {Boolean}
101
+ */
102
+ isXML: function() {
103
+ return this.getPath('request.isXML') || NO ;
104
+ }.property('request').cacheable(),
105
+
106
+ /**
107
+ Returns the hash of listeners set on the request.
108
+
109
+ @property {Hash}
110
+ */
111
+ listeners: function() {
112
+ return this.getPath('request.listeners');
113
+ }.property('request').cacheable(),
114
+
115
+ /**
116
+ The response status code.
117
+ */
118
+ status: -100, // READY
119
+
120
+ /**
121
+ Headers from the response. Computed on-demand
122
+
123
+ @property {Hash}
124
+ */
125
+ headers: null,
126
+
127
+ /**
128
+ The raw body retrieved from the transport. This may be further parsed
129
+ by the body property, which is probably what you want.
130
+
131
+ @property {String}
132
+ */
133
+ encodedBody: null,
134
+
135
+ /**
136
+ Response body. If isJSON was set, will be parsed automatically.
137
+
138
+ @property {Hash|String}
139
+ */
140
+ body: function() {
141
+ // TODO: support XML
142
+ var ret = this.get('encodedBody');
143
+ if (ret && this.get('isJSON')) ret = SC.json.decode(ret);
144
+ return ret;
145
+ }.property('encodedBody').cacheable(),
146
+
147
+ /**
148
+ @private
149
+ @deprecated
150
+
151
+ Alias for body. Provides compatibility with older code.
152
+
153
+ @property {Hash|String}
154
+ */
155
+ response: function() {
156
+ return this.get('body');
157
+ }.property('body').cacheable(),
158
+
159
+ /**
160
+ Set to YES if response is cancelled
161
+ */
162
+ isCancelled: NO,
163
+
164
+ // ..........................................................
165
+ // METHODS
166
+ //
167
+
168
+ /**
169
+ Called by the request manager when its time to actually run. This will
170
+ invoke any callbacks on the source request then invoke transport() to
171
+ begin the actual request.
172
+ */
173
+ fire: function() {
174
+
175
+ var req = this.get('request'),
176
+ source = req ? req.get('source') : null;
177
+
178
+
179
+ // first give the source a chance to fixup the request and response
180
+ // then freeze req so no more changes can happen.
181
+ if (source && source.willSend) source.willSend(req, this);
182
+ req.freeze();
183
+
184
+ // if the source did not cancel the request, then invoke the transport
185
+ // to actually trigger the request. This might receive a response
186
+ // immediately if it is synchronous.
187
+ if (!this.get('isCancelled')) this.invokeTransport();
188
+
189
+ // if the transport did not cancel the request for some reason, let the
190
+ // source know that the request was sent
191
+ if (!this.get('isCancelled') && source && source.didSend) {
192
+ source.didSend(req, this);
193
+ }
194
+ },
195
+
196
+ invokeTransport: function() {
197
+ this.receive(function(proceed) { this.set('status', 200); }, this);
198
+ },
199
+
200
+ /**
201
+ Invoked by the transport when it receives a response. The passed
202
+ callback will be invoked to actually process the response. If cancelled
203
+ we will pass NO. You sould cleanup instead.
204
+
205
+ Invokes callbacks on the source request also.
206
+
207
+ @param {Function} callback the function to receive
208
+ @param {Object} context context to execute the callback in
209
+ @returns {SC.Response} receiver
210
+ */
211
+ receive: function(callback, context) {
212
+ var req = this.get('request');
213
+ var source = req ? req.get('source') : null;
214
+
215
+ // invoke the source, giving a chance to fixup the reponse or (more
216
+ // likely) cancel the request.
217
+ if (source && source.willReceive) source.willReceive(req, this);
218
+
219
+ // invoke the callback. note if the response was cancelled or not
220
+ callback.call(context, !this.get('isCancelled'));
221
+
222
+ // if we weren't cancelled, then give the source first crack at handling
223
+ // the response. if the source doesn't want listeners to be notified,
224
+ // it will cancel the response.
225
+ if (!this.get('isCancelled') && source && source.didReceive) {
226
+ source.didReceive(req, this);
227
+ }
228
+
229
+ // notify listeners if we weren't cancelled.
230
+ if (!this.get('isCancelled')) this.notify();
231
+
232
+ // no matter what, remove from inflight queue
233
+ SC.Request.manager.transportDidClose(this) ;
234
+ return this;
235
+ },
236
+
237
+ /**
238
+ Default method just closes the connection. It will also mark the request
239
+ as cancelled, which will not call any listeners.
240
+ */
241
+ cancel: function() {
242
+ if (!this.get('isCancelled')) {
243
+ this.set('isCancelled', YES);
244
+ this.cancelTransport();
245
+ SC.Request.manager.transportDidClose(this) ;
246
+ }
247
+ },
248
+
249
+ /**
250
+ Override with concrete implementation to actually cancel the transport.
251
+ */
252
+ cancelTransport: function() {},
253
+
254
+ _notifyListener: function(listeners, status) {
255
+ var info = listeners[status], params, target, action;
256
+ if (!info) return NO ;
257
+
258
+ params = (info.params || []).copy();
259
+ params.unshift(this);
260
+
261
+ target = info.target;
262
+ action = info.action;
263
+ if (SC.typeOf(action) === SC.T_STRING) action = target[action];
264
+
265
+ return action.apply(target, params);
266
+ },
267
+
268
+ /**
269
+ Notifies any saved target/action. Call whenever you cancel, or end.
270
+
271
+ @returns {SC.Response} receiver
272
+ */
273
+ notify: function() {
274
+ var listeners = this.get('listeners'),
275
+ status = this.get('status'),
276
+ baseStat = Math.floor(status / 100) * 100,
277
+ handled = NO ;
278
+
279
+ if (!listeners) return this ; // nothing to do
280
+
281
+ SC.RunLoop.begin();
282
+ handled = this._notifyListener(listeners, status);
283
+ if (!handled) handled = this._notifyListener(listeners, baseStat);
284
+ if (!handled) handled = this._notifyListener(listeners, 0);
285
+ SC.RunLoop.end();
286
+
287
+ return this ;
288
+ },
289
+
290
+ toString: function() {
291
+ var ret = sc_super();
292
+ return "%@<%@ %@, status=%@".fmt(ret, this.get('type'), this.get('address'), this.get('status'));
293
+ }
294
+
295
+ });
296
+
297
+ /**
298
+ Concrete implementation of SC.Response that implements support for using
299
+ XHR requests.
300
+
301
+ @extends SC.Response
302
+ @since SproutCore 1.0
303
+ */
304
+ SC.XHRResponse = SC.Response.extend({
305
+
306
+ /**
307
+ Implement transport-specific support for fetching all headers
308
+ */
309
+ headers: function() {
310
+ var xhr = this.get('rawRequest'),
311
+ str = xhr ? xhr.getAllResponseHeaders() : null,
312
+ ret = {};
313
+
314
+ if (!str) return ret;
315
+
316
+ str.split("\n").forEach(function(header) {
317
+ var idx = header.indexOf(':'),
318
+ key, value;
319
+ if (idx>=0) {
320
+ key = header.slice(0,idx);
321
+ value = header.slice(idx+1).trim();
322
+ ret[key] = value ;
323
+ }
324
+ }, this);
325
+
326
+ return ret ;
327
+ }.property('status').cacheable(),
328
+
329
+ // returns a header value if found...
330
+ header: function(key) {
331
+ var xhr = this.get('rawRequest');
332
+ return xhr ? xhr.getResponseHeader(key) : null;
333
+ },
334
+
335
+ /**
336
+ Implement transport-specific support for fetching tasks
337
+ */
338
+ encodedBody: function() {
339
+ var xhr = this.get('rawRequest'), ret ;
340
+ if (!xhr) ret = null;
341
+ else if (this.get('isXML')) ret = xhr.responseXML;
342
+ else ret = xhr.responseText;
343
+ return ret ;
344
+ }.property('status').cacheable(),
345
+
346
+
347
+ cancelTransport: function() {
348
+ var rawRequest = this.get('rawRequest');
349
+ if (rawRequest) rawRequest.abort();
350
+ this.set('rawRequest', null);
351
+ },
352
+
353
+ invokeTransport: function() {
354
+
355
+ var rawRequest, transport, handleReadyStateChange, async, headers;
356
+
357
+ // Get an XHR object
358
+ function tryThese() {
359
+ for (var i=0; i < arguments.length; i++) {
360
+ try {
361
+ var item = arguments[i]() ;
362
+ return item ;
363
+ } catch (e) {}
364
+ }
365
+ return NO;
366
+ }
367
+
368
+ rawRequest = tryThese(
369
+ function() { return new XMLHttpRequest(); },
370
+ function() { return new ActiveXObject('Msxml2.XMLHTTP'); },
371
+ function() { return new ActiveXObject('Microsoft.XMLHTTP'); }
372
+ );
373
+
374
+ // save it
375
+ this.set('rawRequest', rawRequest);
376
+
377
+ // configure async callback - differs per browser...
378
+ async = !!this.getPath('request.isAsynchronous') ;
379
+ if (async) {
380
+ if (!SC.browser.msie) {
381
+ SC.Event.add(rawRequest, 'readystatechange', this,
382
+ this.finishRequest, rawRequest) ;
383
+ } else {
384
+ transport=this;
385
+ handleReadyStateChange = function() {
386
+ if (!transport) return null ;
387
+ var ret = transport.finishRequest();
388
+ transport = null ; // cleanup memory
389
+ return ret ;
390
+ };
391
+ rawRequest.onreadystatechange = handleReadyStateChange;
392
+ }
393
+ }
394
+
395
+ // initiate request.
396
+ rawRequest.open(this.get('type'), this.get('address'), async ) ;
397
+
398
+ // headers need to be set *after* the open call.
399
+ headers = this.getPath('request.headers') ;
400
+ for (var headerKey in headers) {
401
+ rawRequest.setRequestHeader(headerKey, headers[headerKey]) ;
402
+ }
403
+
404
+ // now send the actual request body - for sync requests browser will
405
+ // block here
406
+ rawRequest.send(this.getPath('request.encodedBody')) ;
407
+ if (!async) this.finishRequest() ; // not async
408
+
409
+ return rawRequest ;
410
+ },
411
+
412
+ /** @private
413
+
414
+ Called by the XHR when it responds with some final results.
415
+
416
+ @param {XMLHttpRequest} rawRequest the actual request
417
+ @returns {SC.XHRRequestTransport} receiver
418
+ */
419
+ finishRequest: function(evt) {
420
+ var rawRequest = this.get('rawRequest'),
421
+ readyState = rawRequest.readyState,
422
+ error, status, msg;
423
+
424
+ if (readyState === 4) {
425
+ this.receive(function(proceed) {
426
+
427
+ if (!proceed) return ; // skip receiving...
428
+
429
+ // collect the status and decide if we're in an error state or not
430
+ status = -1 ;
431
+ try {
432
+ status = rawRequest.status || 0;
433
+ } catch (e) {}
434
+
435
+ // if there was an error - setup error and save it
436
+ if ((status < 200) || (status >= 300)) {
437
+ msg = rawRequest.statusText;
438
+ error = SC.$error(msg || "HTTP Request failed", "Request", status) ;
439
+ error.set("errorValue", this) ;
440
+ this.set('isError', YES);
441
+ this.set('errorObject', error);
442
+ }
443
+
444
+ // set the status - this will trigger changes on relatedp properties
445
+ this.set('status', status);
446
+
447
+ }, this);
448
+ }
449
+
450
+ if (readyState === 4) {
451
+ // avoid memory leak in MSIE: clean up
452
+ rawRequest.onreadystatechange = function() {} ;
453
+ }
454
+ }
455
+
456
+
457
+ });
@@ -117,36 +117,87 @@ SC.RootResponder = SC.Object.extend({
117
117
  mainPane.
118
118
  */
119
119
  keyPane: null,
120
+
121
+ /** @property
122
+ A stack of the previous key panes.
123
+
124
+ *IMPORTANT: Property is not observable*
125
+ */
126
+ previousKeyPanes: [],
120
127
 
121
128
  /**
122
129
  Makes the passed pane the new key pane. If you pass nil or if the pane
123
- does not accept key focus, then key focus will transfer to the mainPane.
124
- This will notify both the old pane and the new root View that key focus
125
- has changed.
130
+ does not accept key focus, then key focus will transfer to the previous
131
+ key pane (if it is still attached), and so on down the stack. This will
132
+ notify both the old pane and the new root View that key focus has changed.
126
133
 
127
134
  @param {SC.Pane} pane
128
135
  @returns {SC.RootResponder} receiver
129
136
  */
130
137
  makeKeyPane: function(pane) {
131
- if (pane && !pane.get('acceptsKeyPane')) return this ;
138
+ // Was a pane specified?
139
+ var newKeyPane, previousKeyPane, previousKeyPanes ;
132
140
 
133
- // if null was passed, try to make mainPane key instead.
134
- if (!pane) {
135
- pane = this.get('mainPane') ;
136
- if (pane && !pane.get('acceptsKeyPane')) pane = null ;
141
+ if (pane) {
142
+ // Does the specified pane accept being the key pane? If not, there's
143
+ // nothing to do.
144
+ if (!pane.get('acceptsKeyPane')) {
145
+ return this ;
146
+ }
147
+ else {
148
+ // It does accept key pane status? Then push the current keyPane to
149
+ // the top of the stack and make the specified pane the new keyPane.
150
+ // First, though, do a sanity-check to make sure it's not already the
151
+ // key pane, in which case we have nothing to do.
152
+ var previousKeyPane = this.get('keyPane') ;
153
+ if (previousKeyPane === pane) {
154
+ return this ;
155
+ }
156
+ else {
157
+ if (previousKeyPane) {
158
+ previousKeyPanes = this.get('previousKeyPanes') ;
159
+ previousKeyPanes.push(previousKeyPane) ;
160
+ }
161
+
162
+ newKeyPane = pane ;
163
+ }
164
+ }
137
165
  }
166
+ else {
167
+ // No pane was specified? Then pop the previous key pane off the top of
168
+ // the stack and make it the new key pane, assuming that it's still
169
+ // attached and accepts key pane (its value for acceptsKeyPane might
170
+ // have changed in the meantime). Otherwise, we'll keep going up the
171
+ // stack.
172
+ previousKeyPane = this.get('keyPane') ;
173
+ previousKeyPanes = this.get('previousKeyPanes') ;
174
+
175
+ var newKeyPane = null ;
176
+ while (previousKeyPanes.length > 0) {
177
+ var candidate = previousKeyPanes.pop();
178
+ if (candidate.get('isPaneAttached') && candidate.get('acceptsKeyPane')) {
179
+ newKeyPane = candidate ;
180
+ break ;
181
+ }
182
+ }
183
+ }
184
+
138
185
 
139
- var current = this.get('keyPane') ;
140
- if (current === pane) return this ; // nothing to do
186
+ // If we found an appropriate candidate, make it the new key pane.
187
+ // Otherwise, make the main pane the key pane (if it accepts it).
188
+ if (!newKeyPane) {
189
+ var mainPane = this.get('mainPane') ;
190
+ if (mainPane.get('acceptsKeyPane')) newKeyPane = mainPane ;
191
+ }
141
192
 
142
193
  // now notify old and new key views of change after edit
143
- if (current) current.willLoseKeyPaneTo(pane) ;
144
- if (pane) pane.willBecomeKeyPaneFrom(current) ;
194
+ if (previousKeyPane) previousKeyPane.willLoseKeyPaneTo(newKeyPane) ;
195
+ if (newKeyPane) newKeyPane.willBecomeKeyPaneFrom(previousKeyPane) ;
145
196
 
146
- this.set('keyPane', pane) ;
197
+ this.set('keyPane', newKeyPane) ;
147
198
 
148
- if (pane) pane.didBecomeKeyPaneFrom(current) ;
149
- if (current) current.didLoseKeyPaneTo(pane) ;
199
+ if (newKeyPane) newKeyPane.didBecomeKeyPaneFrom(previousKeyPane) ;
200
+ if (previousKeyPane) previousKeyPane.didLoseKeyPaneTo(newKeyPane) ;
150
201
 
151
202
  return this ;
152
203
  },
@@ -381,7 +381,7 @@ SC.routes = SC.Object.create(
381
381
  var loc = this.get('location') ;
382
382
  var cloc = decodeURI(location.hash) ;
383
383
  cloc = (cloc && cloc.length > 0) ? cloc.slice(1,cloc.length) : '' ;
384
- if (cloc != loc) {
384
+ if (cloc !== loc) {
385
385
  SC.RunLoop.begin();
386
386
  this.set('location',(cloc) ? cloc : '') ;
387
387
  SC.RunLoop.end();
@@ -475,12 +475,12 @@ SC.routes = SC.Object.create(
475
475
  } else {
476
476
  var part = parts.shift(),
477
477
  ret = null,
478
- routes, nextRoute, loc ;
478
+ routes, nextRoute, loc , routesLen;
479
479
 
480
480
  // try to match to static
481
481
  routes = this._static[part] ;
482
482
  if (routes) {
483
- for(loc=0;(loc < routes.length) && (ret===null);loc++) {
483
+ for(loc=0, routesLen = routes.length;(loc < routesLen) && (ret===null);loc++) {
484
484
  var clone = parts.slice() ;
485
485
  ret = routes[loc].functionForRoute(clone, params) ;
486
486
  }
@@ -491,7 +491,7 @@ SC.routes = SC.Object.create(
491
491
  for(var key in this._dynamic) {
492
492
  routes = this._dynamic[key] ;
493
493
  if (routes) {
494
- for(loc=0;(loc<routes.length) && (ret === null);loc++) {
494
+ for(loc=0, routesLen = routes.length; (loc<routesLen) && (ret === null);loc++) {
495
495
  clone = parts.slice() ;
496
496
  ret = routes[loc].functionForRoute(clone,params) ;
497
497
 
@@ -448,13 +448,14 @@ SC.Timer = SC.Object.extend(
448
448
  */
449
449
  removeFromTimerQueue: function(timerQueueRoot) {
450
450
  var prev = this._timerQueuePrevious, next = this._timerQueueNext ;
451
- if (!prev && !next) return timerQueueRoot ; // not in a queue...
452
-
451
+
452
+ if (!prev && !next && timerQueueRoot !== this) return timerQueueRoot ; // not in a queue...
453
+
453
454
  // else, patch up to remove...
454
455
  if (prev) prev._timerQueueNext = next ;
455
456
  if (next) next._timerQueuePrevious = prev ;
456
457
  this._timerQueuePrevious = this._timerQueueNext = null ;
457
- return (timerQueueRoot == this) ? next : timerQueueRoot ;
458
+ return (timerQueueRoot === this) ? next : timerQueueRoot ;
458
459
  },
459
460
 
460
461
  /** @private - schedules the timer in the queue based on the runtime. */
@@ -541,7 +542,8 @@ SC.Timer.timerFromPool = function(props) {
541
542
  automatically when a timer is invalidated if isPooled is YES.
542
543
  */
543
544
  SC.Timer.returnTimerToPool = function(timer) {
544
- if (this._timerPool) this._timerPool = [];
545
+ if (!this._timerPool) this._timerPool = [];
546
+
545
547
  this._timerPool.push(timer);
546
548
  return this ;
547
549
  };