sproutcore 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. data/History.txt +4 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +269 -0
  4. data/README.txt +67 -0
  5. data/Rakefile +4 -0
  6. data/app_generators/sproutcore/USAGE +5 -0
  7. data/app_generators/sproutcore/sproutcore_generator.rb +66 -0
  8. data/app_generators/sproutcore/templates/README +77 -0
  9. data/app_generators/sproutcore/templates/environment.yml +4 -0
  10. data/bin/sc-build +145 -0
  11. data/bin/sc-gen +24 -0
  12. data/bin/sc-server +63 -0
  13. data/bin/sproutcore +21 -0
  14. data/clients/sc_docs/controllers/docs.js +118 -0
  15. data/clients/sc_docs/core.js +19 -0
  16. data/clients/sc_docs/english.lproj/body.css +159 -0
  17. data/clients/sc_docs/english.lproj/body.rhtml +33 -0
  18. data/clients/sc_docs/english.lproj/controls.css +0 -0
  19. data/clients/sc_docs/english.lproj/icons/small/next.png +0 -0
  20. data/clients/sc_docs/english.lproj/icons/small/reset.png +0 -0
  21. data/clients/sc_docs/english.lproj/images/gradients.png +0 -0
  22. data/clients/sc_docs/english.lproj/images/indicator.gif +0 -0
  23. data/clients/sc_docs/english.lproj/images/toolbar.png +0 -0
  24. data/clients/sc_docs/english.lproj/no_docs.rhtml +7 -0
  25. data/clients/sc_docs/english.lproj/strings.js +14 -0
  26. data/clients/sc_docs/english.lproj/warning.rhtml +6 -0
  27. data/clients/sc_docs/fixtures/doc.js +11 -0
  28. data/clients/sc_docs/main.js +21 -0
  29. data/clients/sc_docs/models/doc.js +9 -0
  30. data/clients/sc_docs/tests/controllers/docs.rhtml +21 -0
  31. data/clients/sc_docs/tests/models/doc.rhtml +21 -0
  32. data/clients/sc_docs/tests/views/doc_frame.rhtml +21 -0
  33. data/clients/sc_docs/tests/views/doc_label_view.rhtml +21 -0
  34. data/clients/sc_docs/views/doc_frame.js +33 -0
  35. data/clients/sc_docs/views/doc_label.js +20 -0
  36. data/clients/sc_test_runner/controllers/runner.js +175 -0
  37. data/clients/sc_test_runner/core.js +19 -0
  38. data/clients/sc_test_runner/english.lproj/body.css +151 -0
  39. data/clients/sc_test_runner/english.lproj/body.rhtml +35 -0
  40. data/clients/sc_test_runner/english.lproj/controls.css +0 -0
  41. data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
  42. data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
  43. data/clients/sc_test_runner/english.lproj/images/gradients.png +0 -0
  44. data/clients/sc_test_runner/english.lproj/images/indicator.gif +0 -0
  45. data/clients/sc_test_runner/english.lproj/images/toolbar.png +0 -0
  46. data/clients/sc_test_runner/english.lproj/no_tests.rhtml +6 -0
  47. data/clients/sc_test_runner/english.lproj/strings.js +14 -0
  48. data/clients/sc_test_runner/english.lproj/warning.rhtml +6 -0
  49. data/clients/sc_test_runner/fixtures/test.js +12 -0
  50. data/clients/sc_test_runner/main.js +26 -0
  51. data/clients/sc_test_runner/models/test.js +11 -0
  52. data/clients/sc_test_runner/views/runner_frame.js +72 -0
  53. data/clients/sc_test_runner/views/test_label.js +20 -0
  54. data/config/hoe.rb +70 -0
  55. data/config/requirements.rb +17 -0
  56. data/environment.yml +9 -0
  57. data/frameworks/prototype/prototype.js +4186 -0
  58. data/frameworks/sproutcore/Core.js +378 -0
  59. data/frameworks/sproutcore/README +3 -0
  60. data/frameworks/sproutcore/controllers/array.js +236 -0
  61. data/frameworks/sproutcore/controllers/collection.js +305 -0
  62. data/frameworks/sproutcore/controllers/controller.js +323 -0
  63. data/frameworks/sproutcore/controllers/object.js +372 -0
  64. data/frameworks/sproutcore/drag/drag.js +549 -0
  65. data/frameworks/sproutcore/drag/drag_data_source.js +32 -0
  66. data/frameworks/sproutcore/drag/drag_source.js +64 -0
  67. data/frameworks/sproutcore/drag/drop_target.js +153 -0
  68. data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
  69. data/frameworks/sproutcore/english.lproj/buttons.css +589 -0
  70. data/frameworks/sproutcore/english.lproj/buttons.png +0 -0
  71. data/frameworks/sproutcore/english.lproj/inline_text_editor.css +21 -0
  72. data/frameworks/sproutcore/english.lproj/menu.css +121 -0
  73. data/frameworks/sproutcore/english.lproj/panels/background-fat.jpg +0 -0
  74. data/frameworks/sproutcore/english.lproj/panels/background-thin.jpg +0 -0
  75. data/frameworks/sproutcore/english.lproj/panels/bottom-edge.png +0 -0
  76. data/frameworks/sproutcore/english.lproj/panels/bottom-left-corner.png +0 -0
  77. data/frameworks/sproutcore/english.lproj/panels/bottom-right-corner.png +0 -0
  78. data/frameworks/sproutcore/english.lproj/panels/left-edge.png +0 -0
  79. data/frameworks/sproutcore/english.lproj/panels/overlay.png +0 -0
  80. data/frameworks/sproutcore/english.lproj/panels/right-edge.png +0 -0
  81. data/frameworks/sproutcore/english.lproj/panels/top-edge.png +0 -0
  82. data/frameworks/sproutcore/english.lproj/panels/top-left-corner.png +0 -0
  83. data/frameworks/sproutcore/english.lproj/panels/top-right-corner.png +0 -0
  84. data/frameworks/sproutcore/english.lproj/panes.css +155 -0
  85. data/frameworks/sproutcore/english.lproj/picker.css +22 -0
  86. data/frameworks/sproutcore/english.lproj/strings.js +15 -0
  87. data/frameworks/sproutcore/english.lproj/tab.css +23 -0
  88. data/frameworks/sproutcore/english.lproj/tests.css +67 -0
  89. data/frameworks/sproutcore/english.lproj/theme.css +77 -0
  90. data/frameworks/sproutcore/foundation/animator.js +670 -0
  91. data/frameworks/sproutcore/foundation/application.js +199 -0
  92. data/frameworks/sproutcore/foundation/array.js +348 -0
  93. data/frameworks/sproutcore/foundation/benchmark.js +211 -0
  94. data/frameworks/sproutcore/foundation/binding.js +384 -0
  95. data/frameworks/sproutcore/foundation/date.js +357 -0
  96. data/frameworks/sproutcore/foundation/error.js +39 -0
  97. data/frameworks/sproutcore/foundation/input_manager.js +153 -0
  98. data/frameworks/sproutcore/foundation/json.js +296 -0
  99. data/frameworks/sproutcore/foundation/mock.js +42 -0
  100. data/frameworks/sproutcore/foundation/node_descriptor.js +56 -0
  101. data/frameworks/sproutcore/foundation/object.js +777 -0
  102. data/frameworks/sproutcore/foundation/observable.js +451 -0
  103. data/frameworks/sproutcore/foundation/page.js +63 -0
  104. data/frameworks/sproutcore/foundation/path_module.js +413 -0
  105. data/frameworks/sproutcore/foundation/responder.js +310 -0
  106. data/frameworks/sproutcore/foundation/routes.js +371 -0
  107. data/frameworks/sproutcore/foundation/run_loop.js +21 -0
  108. data/frameworks/sproutcore/foundation/server.js +491 -0
  109. data/frameworks/sproutcore/foundation/set.js +96 -0
  110. data/frameworks/sproutcore/foundation/string.js +149 -0
  111. data/frameworks/sproutcore/foundation/undo_manager.js +186 -0
  112. data/frameworks/sproutcore/foundation/unittest.js +622 -0
  113. data/frameworks/sproutcore/foundation/utils.js +61 -0
  114. data/frameworks/sproutcore/globals/panels.js +182 -0
  115. data/frameworks/sproutcore/globals/popups.js +60 -0
  116. data/frameworks/sproutcore/globals/window.js +381 -0
  117. data/frameworks/sproutcore/lib/index.rhtml +66 -0
  118. data/frameworks/sproutcore/models/collection.js +395 -0
  119. data/frameworks/sproutcore/models/record.js +622 -0
  120. data/frameworks/sproutcore/models/store.js +295 -0
  121. data/frameworks/sproutcore/panes/dialog.js +16 -0
  122. data/frameworks/sproutcore/panes/manager.js +164 -0
  123. data/frameworks/sproutcore/panes/menu.js +45 -0
  124. data/frameworks/sproutcore/panes/overlay.js +231 -0
  125. data/frameworks/sproutcore/panes/pane.js +90 -0
  126. data/frameworks/sproutcore/panes/panel.js +19 -0
  127. data/frameworks/sproutcore/panes/picker.js +45 -0
  128. data/frameworks/sproutcore/tests/controllers/array.rhtml +86 -0
  129. data/frameworks/sproutcore/tests/controllers/controller.rhtml +273 -0
  130. data/frameworks/sproutcore/tests/controllers/object.rhtml +327 -0
  131. data/frameworks/sproutcore/tests/foundation/application.rhtml +125 -0
  132. data/frameworks/sproutcore/tests/foundation/array.rhtml +221 -0
  133. data/frameworks/sproutcore/tests/foundation/object.rhtml +69 -0
  134. data/frameworks/sproutcore/tests/globals/window.rhtml +45 -0
  135. data/frameworks/sproutcore/tests/panes/pane.rhtml +88 -0
  136. data/frameworks/sproutcore/tests/views/collection.rhtml +137 -0
  137. data/frameworks/sproutcore/tests/views/popup_button.rhtml +115 -0
  138. data/frameworks/sproutcore/tests/views/text_field.rhtml +37 -0
  139. data/frameworks/sproutcore/validators/credit_card.js +92 -0
  140. data/frameworks/sproutcore/validators/date.js +36 -0
  141. data/frameworks/sproutcore/validators/email.js +29 -0
  142. data/frameworks/sproutcore/validators/not_empty.js +24 -0
  143. data/frameworks/sproutcore/validators/number.js +55 -0
  144. data/frameworks/sproutcore/validators/password.js +78 -0
  145. data/frameworks/sproutcore/validators/validator.js +304 -0
  146. data/frameworks/sproutcore/views/button.js +425 -0
  147. data/frameworks/sproutcore/views/checkbox_field.js +30 -0
  148. data/frameworks/sproutcore/views/collection.js +1521 -0
  149. data/frameworks/sproutcore/views/container.js +62 -0
  150. data/frameworks/sproutcore/views/error_explanation.js +45 -0
  151. data/frameworks/sproutcore/views/field.js +214 -0
  152. data/frameworks/sproutcore/views/filter_button.js +29 -0
  153. data/frameworks/sproutcore/views/form.js +591 -0
  154. data/frameworks/sproutcore/views/image.js +141 -0
  155. data/frameworks/sproutcore/views/inline_text_editor.js +96 -0
  156. data/frameworks/sproutcore/views/label.js +176 -0
  157. data/frameworks/sproutcore/views/menu_item.js +90 -0
  158. data/frameworks/sproutcore/views/pagination.js +54 -0
  159. data/frameworks/sproutcore/views/popup_button.js +86 -0
  160. data/frameworks/sproutcore/views/popup_menu.js +137 -0
  161. data/frameworks/sproutcore/views/progress.js +100 -0
  162. data/frameworks/sproutcore/views/radio_field.js +107 -0
  163. data/frameworks/sproutcore/views/radio_group.js +48 -0
  164. data/frameworks/sproutcore/views/segmented.js +80 -0
  165. data/frameworks/sproutcore/views/select_field.js +272 -0
  166. data/frameworks/sproutcore/views/spinner.js +11 -0
  167. data/frameworks/sproutcore/views/tab.js +126 -0
  168. data/frameworks/sproutcore/views/text_field.js +179 -0
  169. data/frameworks/sproutcore/views/textarea_field.js +14 -0
  170. data/frameworks/sproutcore/views/toolbar.js +29 -0
  171. data/frameworks/sproutcore/views/view.js +1389 -0
  172. data/frameworks/sproutcore/views/workspace.js +170 -0
  173. data/generators/client/README +3 -0
  174. data/generators/client/USAGE +12 -0
  175. data/generators/client/client_generator.rb +53 -0
  176. data/generators/client/templates/core.js +19 -0
  177. data/generators/client/templates/english.lproj/body.css +0 -0
  178. data/generators/client/templates/english.lproj/body.rhtml +3 -0
  179. data/generators/client/templates/english.lproj/controls.css +0 -0
  180. data/generators/client/templates/english.lproj/strings.js +14 -0
  181. data/generators/client/templates/main.js +37 -0
  182. data/generators/controller/USAGE +16 -0
  183. data/generators/controller/controller_generator.rb +51 -0
  184. data/generators/controller/templates/controller.js +21 -0
  185. data/generators/controller/templates/test.rhtml +21 -0
  186. data/generators/framework/README +7 -0
  187. data/generators/framework/USAGE +12 -0
  188. data/generators/framework/framework_generator.rb +53 -0
  189. data/generators/framework/templates/core.js +20 -0
  190. data/generators/framework/templates/english.lproj/body.css +0 -0
  191. data/generators/framework/templates/english.lproj/body.rhtml +3 -0
  192. data/generators/framework/templates/english.lproj/controls.css +0 -0
  193. data/generators/framework/templates/english.lproj/strings.js +14 -0
  194. data/generators/language/USAGE +16 -0
  195. data/generators/language/language_generator.rb +47 -0
  196. data/generators/language/templates/strings.js +10 -0
  197. data/generators/model/USAGE +24 -0
  198. data/generators/model/model_generator.rb +55 -0
  199. data/generators/model/templates/fixture.js +11 -0
  200. data/generators/model/templates/model.js +20 -0
  201. data/generators/model/templates/test.rhtml +21 -0
  202. data/generators/test/USAGE +16 -0
  203. data/generators/test/templates/test.rhtml +21 -0
  204. data/generators/test/test_generator.rb +47 -0
  205. data/generators/view/USAGE +16 -0
  206. data/generators/view/templates/test.rhtml +21 -0
  207. data/generators/view/templates/view.js +20 -0
  208. data/generators/view/view_generator.rb +51 -0
  209. data/jsdoc/README.txt +119 -0
  210. data/jsdoc/app/DocFile.js +137 -0
  211. data/jsdoc/app/DocTag.js +110 -0
  212. data/jsdoc/app/Doclet.js +63 -0
  213. data/jsdoc/app/Dumper.js +143 -0
  214. data/jsdoc/app/JsDoc.js +103 -0
  215. data/jsdoc/app/JsHilite.js +45 -0
  216. data/jsdoc/app/JsIO.js +163 -0
  217. data/jsdoc/app/JsParse.js +385 -0
  218. data/jsdoc/app/JsPlate.js +130 -0
  219. data/jsdoc/app/JsTestrun.js +129 -0
  220. data/jsdoc/app/JsToke.js +564 -0
  221. data/jsdoc/app/Symbol.js +298 -0
  222. data/jsdoc/app/Transformer.js +14 -0
  223. data/jsdoc/app/Util.js +97 -0
  224. data/jsdoc/app/js.jar +0 -0
  225. data/jsdoc/app/run.js +144 -0
  226. data/jsdoc/plugins/min.js +316 -0
  227. data/jsdoc/plugins/strip.js +20 -0
  228. data/jsdoc/templates/sproutcore/class.tmpl +438 -0
  229. data/jsdoc/templates/sproutcore/default.css +241 -0
  230. data/jsdoc/templates/sproutcore/index.html +13 -0
  231. data/jsdoc/templates/sproutcore/index.tmpl +21 -0
  232. data/jsdoc/templates/sproutcore/prototype.js +4186 -0
  233. data/jsdoc/templates/sproutcore/publish.js +236 -0
  234. data/jsdoc/templates/sproutcore/splash.html +7 -0
  235. data/lib/sproutcore/build_tools/html_builder.rb +88 -0
  236. data/lib/sproutcore/build_tools/resource_builder.rb +194 -0
  237. data/lib/sproutcore/build_tools.rb +44 -0
  238. data/lib/sproutcore/bundle.rb +517 -0
  239. data/lib/sproutcore/bundle_manifest.rb +397 -0
  240. data/lib/sproutcore/generator_helper.rb +170 -0
  241. data/lib/sproutcore/helpers/capture_helper.rb +42 -0
  242. data/lib/sproutcore/helpers/static_helper.rb +80 -0
  243. data/lib/sproutcore/helpers/tag_helper.rb +110 -0
  244. data/lib/sproutcore/helpers/text_helper.rb +336 -0
  245. data/lib/sproutcore/helpers.rb +3 -0
  246. data/lib/sproutcore/jsdoc.rb +40 -0
  247. data/lib/sproutcore/jsmin.rb +247 -0
  248. data/lib/sproutcore/library.rb +258 -0
  249. data/lib/sproutcore/merb/bundle_controller.rb +179 -0
  250. data/lib/sproutcore/merb/router.rb +43 -0
  251. data/lib/sproutcore/merb.rb +27 -0
  252. data/lib/sproutcore/version.rb +9 -0
  253. data/lib/sproutcore/view_helpers/button_views.rb +302 -0
  254. data/lib/sproutcore/view_helpers/core_views.rb +284 -0
  255. data/lib/sproutcore/view_helpers/form_views.rb +258 -0
  256. data/lib/sproutcore/view_helpers/menu_views.rb +94 -0
  257. data/lib/sproutcore/view_helpers.rb +628 -0
  258. data/lib/sproutcore.rb +30 -0
  259. data/script/destroy +14 -0
  260. data/script/generate +14 -0
  261. data/script/txt2html +74 -0
  262. data/setup.rb +1585 -0
  263. data/spec/spec.opts +1 -0
  264. data/spec/spec_helper.rb +7 -0
  265. data/spec/sproutcore_spec.rb +11 -0
  266. data/tasks/deployment.rake +34 -0
  267. data/tasks/environment.rake +7 -0
  268. data/tasks/rspec.rake +21 -0
  269. data/tasks/website.rake +17 -0
  270. metadata +365 -0
@@ -0,0 +1,175 @@
1
+ // ==========================================================================
2
+ // TestRunner.runnerController
3
+ // ==========================================================================
4
+
5
+ require('core');
6
+
7
+ TestRunner.runnerController = SC.Object.create({
8
+
9
+ // This is used in the client warning dialog.
10
+ windowLocation: window.location.href,
11
+
12
+ // This is the current client name.
13
+ clientName: '',
14
+
15
+ // This is displayed as the main UI label.
16
+ displayClientName: function() {
17
+ return "%@ Tests".fmt((this.get('clientName') || '').humanize().capitalize()) ;
18
+ }.property('clientName'),
19
+
20
+ arrangedObjects: [],
21
+ selection: [],
22
+
23
+ selectedTest: function() {
24
+ var sel = this.get('selection') ;
25
+ return (sel && sel.length > 0) ? sel[0] : null ;
26
+ }.property('selection'),
27
+
28
+ testState: null,
29
+
30
+ testStateLabel: function() {
31
+ switch(this.get('testState')) {
32
+ case TestRunner.TEST_LOADING:
33
+ return 'Loading Test...' ;
34
+
35
+ case TestRunner.TEST_RUNNING:
36
+ return 'Test Running...' ;
37
+
38
+ case TestRunner.TEST_PASSED:
39
+ return 'Passed!' ;
40
+
41
+ case TestRunner.TEST_FAILED:
42
+ return 'Failed.' ;
43
+
44
+ default:
45
+ return '' ;
46
+ }
47
+ }.property('testState'),
48
+
49
+ isRunning: NO,
50
+ isContinuousIntegrationEnabled: NO,
51
+
52
+ runTestLabel: function() {
53
+ return (this.get('isRunning')) ? "Stop Tests" : "Run Tests" ;
54
+ }.property('isRunning'),
55
+
56
+ toggleRunTests: function() {
57
+ this.toggleProperty('isRunning') ;
58
+ },
59
+
60
+ reloadTests: function() {
61
+
62
+ // Use Ajax to ask the server for the latest set of tests for the
63
+ // current client.
64
+ var ids = [this.get('clientName')] ;
65
+ TestRunner.server.request('sc_test_runner', 'list', ids, {
66
+ onSuccess: this._reloadSuccess.bind(this),
67
+ onFailure: this._reloadFailure.bind(this)
68
+ }) ;
69
+ },
70
+
71
+ _reloadSuccess: function(status, transport) {
72
+ var json = transport.responseText ;
73
+ var records = eval(json) ;
74
+ if ($type(records) != T_ARRAY) {
75
+ return this._reloadFailure(status, transport) ;
76
+ }
77
+
78
+ // update the list of tests from the server. The return value will be
79
+ // the records included in the list. This is what will become our new
80
+ // list.
81
+ var recs = SC.Store.updateRecords(records, this, TestRunner.Test, true);
82
+
83
+ // show warning panel if the records are empty. Also reload tests
84
+ // periodically so that when the user resolves the problem, we can start
85
+ // working away immediately.
86
+ if (recs.length == 0) {
87
+ SC.page.get('noTestsPanel').set('isVisible',true) ;
88
+ setTimeout(this.reloadTests.bind(this),2000) ;
89
+ } else {
90
+ SC.page.get('noTestsPanel').set('isVisible',false) ;
91
+ }
92
+
93
+ // sort the records by name and set as the new arrangedObjects.
94
+ recs = recs.sort(function(a,b) {
95
+ a = a.get('name') || '';
96
+ b = b.get('name') || '';
97
+ return a.localeCompare(b) ;
98
+ }) ;
99
+
100
+ var hadArrangedObjects = this.get('arrangedObjects').length > 0 ;
101
+ this.set('arrangedObjects', recs) ;
102
+
103
+ // if the current selection is not in the list, clear the selection.
104
+ var test = this.get('selectedTest') ;
105
+ if (test && !(recs.include(test))) this.set('selection', []) ;
106
+
107
+ // if continuous integration is turned on and we are running, restart
108
+ // the tests immediately. or if we did not have arranged objects.
109
+ if (!hadArrangedObjects || (this.get('isRunning') && (this.get('isContinuousIntegrationEnabled')))) {
110
+ if (recs.length >0) this.set('selection',[recs.first()]) ;
111
+ }
112
+ },
113
+
114
+ _reloadFailure: function(status, transport) {
115
+ console.log('TEST RELOAD FAILED!') ;
116
+ },
117
+
118
+ // whenever isRunning changes to YES, select the first test.
119
+ isRunningObserver: function() {
120
+ if (this.didChangeFor('isRunningObserver', 'isRunning')) {
121
+ if (this.get('isRunning')) {
122
+ var tests = this.get('arrangedObjects') ;
123
+ var firstTest = (tests && tests.length > 0) ? [tests[0]] : [] ;
124
+ this.set('selection', []) ; // clear selection.
125
+ setTimeout(function() {
126
+ this.set('selection', firstTest) ;
127
+ }.bind(this),1) ;
128
+ }
129
+ }
130
+ }.observes('isRunning'),
131
+
132
+ // whenever the testState changes, then go on to the next test, if
133
+ // running.
134
+ testStateObserver: function() {
135
+ if (!this.didChangeFor('testStateObserver', 'testState')) return ;
136
+ if (!this.get('isRunning')) return ;
137
+
138
+ var testState = this.get('testState') ;
139
+
140
+ // If test passed, go onto the next test.
141
+ if (testState == TestRunner.TEST_PASSED) {
142
+ var tests = this.get('arrangedObjects') || [];
143
+ var test = this.get('selectedTest') || tests.first();
144
+
145
+ // find the idx of the next item.
146
+ var idx = tests.indexOf(test) ;
147
+ if (idx < 0) idx = 0 ;
148
+ idx++ ;
149
+
150
+ // if the idx is at the end of the set of tests, go back to the
151
+ // beginning only if continuous integration is enabled.
152
+ if (idx >= tests.length) {
153
+ if (this.get('isContinuousIntegrationEnabled')) {
154
+ this.reloadTests() ;
155
+ } else {
156
+ this.set('isRunning', false) ;
157
+ }
158
+ return ;
159
+ }
160
+
161
+ // now load the next test.
162
+ test = tests[idx] ;
163
+ if (!test) test = tests[0] ;
164
+ this.set('selection', (test) ? [test] : []) ;
165
+
166
+ // if the test failed, then stop running the tests and throw an alert
167
+ // if continuous integration is on.
168
+ } else if (testState == TestRunner.TEST_FAILED) {
169
+ this.set('isRunning', false) ;
170
+ if (this.get('isContinuousIntegrationEnabled') == YES) {
171
+ alert('Unit Test Failed!') ;
172
+ }
173
+ }
174
+ }.observes('testState')
175
+ }) ;
@@ -0,0 +1,19 @@
1
+ // ==========================================================================
2
+ // TestRunner
3
+ // ==========================================================================
4
+
5
+ TestRunner = SC.Object.create({
6
+
7
+ // This will create the server for your application. Add any namespaces
8
+ // your model objects are defined in to the prefix array.
9
+ server: SC.Server.create({ prefix: ['TestRunner'] }),
10
+
11
+ // When you are in development mode, this array will be populated with
12
+ // any fixtures you create for testing and loaded automatically in your
13
+ // main method. When in production, this will be an empty array.
14
+ FIXTURES: [],
15
+
16
+ // Any keys in this array will be instantiated automatically from main.
17
+ controllers: [],
18
+
19
+ }) ;
@@ -0,0 +1,151 @@
1
+
2
+
3
+ /* @group Workspace */
4
+
5
+ #workspace {
6
+ background-color: #8db69a;
7
+ position: absolute ;
8
+ top: 0;
9
+ left: 0;
10
+ right: 0;
11
+ bottom: 0;
12
+ }
13
+
14
+ #workspace .container {
15
+ position: absolute ;
16
+ top: 49px;
17
+ left: 171px;
18
+ right: 0px;
19
+ bottom: 26px;
20
+ background-color: white ;
21
+ overflow: auto;
22
+ }
23
+
24
+ #workspace .container iframe {
25
+ border: none ;
26
+ width: 100%;
27
+ height: 100%;
28
+ outline: hidden ;
29
+ }
30
+
31
+ #workspace .footer {
32
+ position: absolute ;
33
+ bottom: 0px;
34
+ left: 0px;
35
+ height: 26px;
36
+ right: 0px;
37
+ background: static_url('images/gradients') repeat-x left -72px;
38
+ border-top: 1px solid #62806d;
39
+ text-align: center ;
40
+ font-weight: bold ;
41
+ }
42
+
43
+ #workspace .footer div {
44
+ margin-top: 5px;
45
+ }
46
+
47
+
48
+ /* @end */
49
+
50
+ /* @group Toolbar */
51
+
52
+ #workspace .toolbar {
53
+ position: absolute ;
54
+ top: 0;
55
+ left: 0px;
56
+ right: 0px;
57
+ height: 48px;
58
+ border-bottom: 1px solid #62806d;
59
+ background: static_url('images/gradients') repeat-x center top;
60
+ }
61
+
62
+ #workspace .toolbar .buttons {
63
+ text-align: right ;
64
+ position: absolute ;
65
+ top: 13px ;
66
+ right: 10px ;
67
+ }
68
+
69
+ #workspace .toolbar h1 {
70
+ border: none ;
71
+ padding: 0;
72
+ margin : 0;
73
+ position: absolute ;
74
+ left: 8px;
75
+ top: 4px;
76
+ font-size: 28px;
77
+ font-weight: normal ;
78
+ }
79
+
80
+ /* @end */
81
+
82
+ /* @group Sidebar */
83
+
84
+ #workspace .sidebar {
85
+ position: absolute ;
86
+ top: 49px;
87
+ left: 0px;
88
+ width: 170px;
89
+ bottom: 26px;
90
+ background-color: #e0efed;
91
+ border-right: 1px #62806d solid;
92
+ overflow: auto ;
93
+ }
94
+
95
+ .sidebar {
96
+ list-style-type: none ;
97
+ padding: 0;
98
+ margin: 0;
99
+ }
100
+
101
+ .sidebar a {
102
+ display: block ;
103
+ text-decoration: none ;
104
+ color: black ;
105
+ border: 1px solid #e0efed;
106
+ padding-bottom: 4px;
107
+ padding-top: 7px ;
108
+ padding-left: 8px ;
109
+ border-left-style: none;
110
+ border-right-style: none;
111
+ -moz-user-select: none;
112
+ -khtml-user-select: none;
113
+ user-select: none;
114
+ }
115
+
116
+ .sidebar a.sel {
117
+ border: 1px solid #1e504a;
118
+ color: white ;
119
+ font-weight: bold;
120
+ padding-top: 6px;
121
+ background: static_url('images/gradients') repeat-x center -144px;
122
+ border-top-color: #188b7d;
123
+ border-right-style: none;
124
+ border-left-style: none;
125
+ }
126
+
127
+ .sidebar a.sel:active {
128
+ border: 1px solid #1e504a;
129
+ color: white ;
130
+ font-weight: bold;
131
+ padding-top: 6px;
132
+ background: static_url('images/gradients') repeat-x center -144px;
133
+ border-top-color: #188b7d;
134
+ border-right-style: none;
135
+ border-left-style: none;
136
+ }
137
+
138
+ .sidebar a:active {
139
+ background-color: #cedfdf;
140
+ border: 1px solid #cedfdf;
141
+ border-right-style: none;
142
+ border-left-style: none;
143
+ }
144
+
145
+ .sidebar hr {
146
+ border: none ;
147
+ border-top: #ccc solid 1px;
148
+ margin: 4px 8px;
149
+ }
150
+
151
+ /* @end */
@@ -0,0 +1,35 @@
1
+ <% content_for('body') do %>
2
+
3
+ <% view :workspace do %>
4
+
5
+ <% # PRIMARY TOOLBAR -%>
6
+ <div class="toolbar">
7
+ <%= label_view :outlet => true, :tag => 'h1', :bind => {
8
+ :content => 'TestRunner.runnerController.displayClientName'
9
+ } %>
10
+ <div class="buttons">
11
+ <%= checkbox_view :outlet => true, :label => "Continuous Integration", :bind => { :value => 'TestRunner.runnerController.isContinuousIntegrationEnabled' } %>
12
+ <%= button_view :outlet => true, :label => "Run Tests", :image => static_url('icons/small/reset'), :bind => {
13
+ :label_text => 'TestRunner.runnerController.runTestLabel' }, :action => 'TestRunner.runnerController.toggleRunTests' %>
14
+ </div>
15
+ </div>
16
+
17
+ <%= collection_view :outlet => :sidebar, :class => :sidebar, :bind => {
18
+ :content => 'TestRunner.runnerController.arrangedObjects',
19
+ :selection => 'TestRunner.runnerController.selection'
20
+ }, :example_view => 'TestRunner.TestLabelView' %>
21
+
22
+ <div class="container">
23
+ <%= view :outlet => :runner_frame, :tag => :iframe, :view => 'TestRunner.RunnerFrameView', :bind => {
24
+ :test => 'TestRunner.runnerController.selectedTest',
25
+ :state => 'TestRunner.runnerController.testState' } %>
26
+ </div>
27
+
28
+ <% # FOOTER -%>
29
+ <div class="footer">
30
+ <%= label_view :outlet => :runner_status, :bind => { :content => 'TestRunner.runnerController.testStateLabel' } %>
31
+ </div>
32
+
33
+ <% end %>
34
+
35
+ <% end %>
File without changes
@@ -0,0 +1,6 @@
1
+ <% view :no_tests_panel, :panel => true, :width => 400 do %>
2
+ <h1>Client Has No Tests</h1>
3
+ <p style="font-size: 15px;">This client does not currently have any unit tests. To add a unit test, open a terminal to the root directly and type:</p>
4
+ <p style="font-size: 15px; text-align:center;"><code>./script/generate sc_test <%= label_view :outlet => true, :tag => 'span', :bind => { :content => 'TestRunner.runnerController.clientName' } %>/<b>test_name</b></code></p>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,14 @@
1
+ // ==========================================================================
2
+ // TestRunner English Strings
3
+ // ==========================================================================
4
+
5
+ // Place strings you want to localize here. In your app, use the key and
6
+ // localize it using "key string".loc(). HINT: For your key names, use the
7
+ // english string with an underscore in front. This way you can still see
8
+ // how your UI will look and you'll notice right away when something needs a
9
+ // localized string added to this file!
10
+ //
11
+ Object.extend(String.English,{
12
+ // "_String Key": "Localized String"
13
+ }) ;
14
+
@@ -0,0 +1,6 @@
1
+ <% view :warning_panel, :panel => true, :width => 400 do %>
2
+ <h1>Client Name Required</h1>
3
+ <p style="font-size: 15px;">To test a client, add the client name at the end of the URL preceded by a hash (#). For example, to run unit tests for the "contacts" client enter:</p>
4
+ <p style="font-size: 15px; text-align: center;"><%= label_view :outlet => true, :tag => 'span', :bind => { :content => 'TestRunner.runnerController.windowLocation' } %><b>#contacts</b></p>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,12 @@
1
+ // ==========================================================================
2
+ // TestRunner.Test Fixtures
3
+ // ==========================================================================
4
+
5
+ require('core') ;
6
+
7
+ TestRunner.FIXTURES = TestRunner.FIXTURES.concat([
8
+
9
+ { guid: 1, type: 'Test', name: 'Test Model', url: '/test_model' },
10
+ { guid: 2, type: 'Test', name: 'Test View', url: '/test_view' }
11
+
12
+ ]);
@@ -0,0 +1,26 @@
1
+ // ==========================================================================
2
+ // TestRunner
3
+ // ==========================================================================
4
+
5
+ function main() {
6
+ //TestRunner.server.preload(TestRunner.FIXTURES) ;
7
+ SC.page.awake() ;
8
+ //TestRunner.runnerController.reloadTests() ;
9
+ } ;
10
+
11
+ TestRunner.hidePanels = function() {
12
+ SC.page.get('warningPanel').set('isVisible', false) ;
13
+ SC.page.get('noTestsPanel').set('isVisible',false) ;
14
+ } ;
15
+
16
+ SC.Routes.addRoute('', function() {
17
+ TestRunner.hidePanels() ;
18
+ SC.page.get('warningPanel').set('isVisible', true) ;
19
+ }) ;
20
+
21
+ SC.Routes.addRoute(':client', function(params) {
22
+ TestRunner.hidePanels() ;
23
+ TestRunner.runnerController.set('selection',[]) ;
24
+ TestRunner.runnerController.set('clientName', params.client) ;
25
+ TestRunner.runnerController.reloadTests() ;
26
+ }) ;
@@ -0,0 +1,11 @@
1
+ // ==========================================================================
2
+ // TestRunner.Test
3
+ // ==========================================================================
4
+
5
+ require('core');
6
+
7
+ TestRunner.Test = SC.Record.extend({
8
+
9
+ // TODO: Add your own code here.
10
+
11
+ }) ;
@@ -0,0 +1,72 @@
1
+ // ==========================================================================
2
+ // TestRunner.RunnerFrameView
3
+ // ==========================================================================
4
+
5
+ require('core');
6
+
7
+ TestRunner.TEST_NONE = 'none' ;
8
+ TestRunner.TEST_LOADING = 'loading' ;
9
+ TestRunner.TEST_RUNNING = 'running' ;
10
+ TestRunner.TEST_PASSED = 'passed' ;
11
+ TestRunner.TEST_FAILED = 'failed' ;
12
+
13
+ TestRunner.RunnerFrameView = SC.View.extend({
14
+
15
+ // This is set to the test you want to run.
16
+ test: null,
17
+
18
+ // This will automatically change to reflect the current load state.
19
+ state: TestRunner.TEST_NONE,
20
+
21
+ // when the test changes, set the URL of the iframe
22
+ testObserver: function() {
23
+ var test = this.get('test') ;
24
+ var url = (test) ? test.get('url') : '' ;
25
+
26
+ // make sure we clear out the old document settings if needed.
27
+ var doc = (this.rootElement.contentWindow) ? this.rootElement.contentWindow.document : this.rootElement.document ;
28
+ if (doc) doc.testExpired = YES ;
29
+
30
+ // if the document URL is already loaded, then reload it...
31
+ if (url == this.rootElement.src) {
32
+ if (doc && doc.location) doc.location.reload() ;
33
+
34
+ // otherwise set to the new URL.
35
+ } else {
36
+ this.rootElement.src = url ;
37
+ }
38
+
39
+ this.set('state', TestRunner.TEST_LOADING) ;
40
+ this.checkState() ;
41
+ }.observes('test'),
42
+
43
+ // this can be called periodically to update the current test state,
44
+ // possibly rescheduling itself.
45
+ checkState: function() {
46
+ var doc = (this.rootElement.contentWindow) ? this.rootElement.contentWindow.document : this.rootElement.document ;
47
+
48
+ var queuedTests = (doc) ? doc.queuedTests : null ;
49
+ var testStatus = (doc) ? doc.testStatus : null ;
50
+ var status = TestRunner.TEST_NONE ;
51
+ var reschedule = true ;
52
+
53
+ if (!doc || (queuedTests == null) || doc.testExpired) {
54
+ status = (this.get('test')) ? TestRunner.TEST_LOADING : TestRunner.TEST_NONE;
55
+
56
+ // tests have finished running.
57
+ } else if (queuedTests == 0) {
58
+ status = (testStatus != 'SUCCESS') ? TestRunner.TEST_FAILED : TestRunner.TEST_PASSED ;
59
+ reschedule = false ;
60
+
61
+ // test still need to run?
62
+ } else {
63
+ status = ((testStatus != 'FAILED') && (testStatus != 'ERROR')) ? TestRunner.TEST_RUNNING : TestRunner.TEST_FAILED ;
64
+ if (status == TestRunner.TEST_FAILED) reschedule = false ;
65
+ }
66
+
67
+ if (this.get('state') != status) this.set('state', status) ;
68
+ if (reschedule) setTimeout(this.checkState.bind(this),100) ;
69
+
70
+ }
71
+
72
+ }) ;
@@ -0,0 +1,20 @@
1
+ // ==========================================================================
2
+ // TestRunner.TestLabelView
3
+ // ==========================================================================
4
+
5
+ require('core');
6
+
7
+ TestRunner.TestLabelView = SC.ButtonView.extend({
8
+
9
+ emptyElement: '<a href="javascript:;"><span></span></a>',
10
+
11
+ contentObserver: function() {
12
+ var c = this.get('content') ;
13
+ this.set('labelText', (c) ? c.get('name') : '(NONE)') ;
14
+ }.observes('content'),
15
+
16
+ labelSelector: 'span',
17
+
18
+ mouseDown: function() { return false; }
19
+
20
+ }) ;
data/config/hoe.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'sproutcore/version'
2
+
3
+ AUTHOR = 'Charles Jolley' # can also be an array of Authors
4
+ EMAIL = "charles@sproutit.com"
5
+ DESCRIPTION = "SproutCore - JavaScript Application Framework + Build Tools"
6
+ GEM_NAME = 'sproutcore' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'sproutcore' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+
11
+ @config_file = "~/.rubyforge/user-config.yml"
12
+ @config = nil
13
+ RUBYFORGE_USERNAME = "okito"
14
+ def rubyforge_username
15
+ unless @config
16
+ begin
17
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
18
+ rescue
19
+ puts <<-EOS
20
+ ERROR: No rubyforge config file found: #{@config_file}
21
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
23
+ EOS
24
+ exit
25
+ end
26
+ end
27
+ RUBYFORGE_USERNAME.replace @config["username"]
28
+ end
29
+
30
+
31
+ REV = nil
32
+ # UNCOMMENT IF REQUIRED:
33
+ #REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
34
+ VERS = SproutCore::VERSION::STRING + (REV ? ".#{REV}" : "")
35
+ RDOC_OPTS = ['--quiet', '--title', 'sproutcore documentation',
36
+ "--opname", "index.html",
37
+ "--line-numbers",
38
+ "--main", "README",
39
+ "--inline-source"]
40
+
41
+ class Hoe
42
+ def extra_deps
43
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
+ @extra_deps
45
+ end
46
+ end
47
+
48
+ # Generate all the Rake tasks
49
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
+ hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
+ p.developer(AUTHOR, EMAIL)
52
+ p.description = DESCRIPTION
53
+ p.summary = DESCRIPTION
54
+ p.url = HOMEPATH
55
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
56
+ p.test_globs = ["spec/**/*_spec.rb"]
57
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
58
+
59
+ # == Optional
60
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
61
+ p.extra_deps = [['activesupport', '>= 2.0.2'], ['merb-core', '>= 0.9.1'], ['erubis'], ['rubigen'], ]
62
+
63
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
+
65
+ end
66
+
67
+ CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
68
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
69
+ hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
70
+ hoe.rsync_args = '-av --delete --ignore-errors'
@@ -0,0 +1,17 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen actionpack activesupport].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
+
17
+ require 'sproutcore'
data/environment.yml ADDED
@@ -0,0 +1,9 @@
1
+ all:
2
+ required: [sproutcore, prototype]
3
+
4
+ sproutcore:
5
+ required: [prototype]
6
+
7
+ prototype:
8
+ required: []
9
+