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,170 @@
1
+ // ========================================================================
2
+ // SproutCore
3
+ // copyright 2006-2007 Sprout Systems, Inc.
4
+ // ========================================================================
5
+
6
+ require('views/tab') ;
7
+ require('foundation/routes') ;
8
+ require('views/button') ;
9
+
10
+ // A WorkspaceView is a type of tab view that looks for certain elements
11
+ // inside the content object and then places those into similarly named
12
+ // elements inside the receiver view. (You can extend this with more
13
+ // element areas by overriding the areas property.)
14
+ SC.WorkspaceView = SC.TabView.extend({
15
+
16
+ // override this if you need with the areas you want it to look for. You
17
+ // must have elements with the class '.detail.NAME' inside the receiver
18
+ // view to match.
19
+ areas: ['head','master','detail','dialog','tail'],
20
+
21
+ // override this with the names of your standard workspaces. Any names
22
+ // found here will be converted into code that looks like this:
23
+ //
24
+ // fooTab: NAMESPACE.fooWorkspace.outletFor('#foo-workspace'),
25
+ // fooButton: SC.ButtonView.outletFor('#foo')
26
+ //
27
+ workspaces: [],
28
+ namespace: null,
29
+
30
+ // used internally to configure the workspace view when you create it.
31
+ // be sure to add any tabs/buttons you want.
32
+ elements: function() {
33
+ var view = this ;
34
+ var ret = [] ;
35
+ this.areas.each(function(area) {
36
+ var el = view.$C(area) ;
37
+ if (el) {
38
+ view[area + 'Element'] = SC.ContainerView.viewFor(el);
39
+ ret.push(el) ;
40
+ }
41
+ }) ;
42
+ return ret ;
43
+ },
44
+
45
+ replaceContent: function(newContent) {
46
+ var view = this ;
47
+ this.areas.each(function(area) {
48
+ var key = area + 'Element' ;
49
+ var newElement = newContent.get(key) ;
50
+ var viewArea = view[key] ;
51
+
52
+ // remove existing children
53
+ if (viewArea) {
54
+ viewArea.set('content',newElement) ;
55
+ } else {
56
+ console.log('WARNING: could not find view area: ' + key) ;
57
+ }
58
+ }) ;
59
+
60
+ // if there was a prior content object, notify it that nowShowing has
61
+ // changed.
62
+ if (this._nowShowingContent) {
63
+ this._nowShowingContent.set('nowShowing',null) ;
64
+ }
65
+ newContent.set('nowShowing',this.get('nowShowing')) ;
66
+ this._nowShowingContent = newContent ;
67
+ },
68
+
69
+ init: function() {
70
+ // before calling super, setup the automatically named workspaces.
71
+ if (this.namespace && this.workspaces && this.workspaces.length > 0) {
72
+ var view = this ; var ns = this.namespace ;
73
+ this.workspaces.each(function(key) {
74
+ key = key.toLowerCase() ;
75
+ var tab = window[ns][key.capitalize() + 'Workspace'] ;
76
+ if (tab && !(view[key + 'Tab'])) {
77
+ tab = tab.viewFor(key + '-workspace') ;
78
+ view[key + 'Tab'] = tab ;
79
+ }
80
+
81
+ var button = $(key) ;
82
+ if (button) view[key + 'Button'] = SC._WorkspaceButton.viewFor(key,{
83
+ workspace: view, workspaceId: key
84
+ }) ;
85
+ }) ;
86
+ }
87
+
88
+ // go ahead with the rest of this.
89
+ arguments.callee.base.call(this) ;
90
+
91
+ this.elements = this.elements() ;
92
+
93
+ // register workspace route.
94
+ SC.Routes.addRoute(':workspace',this._showWorkspace.bind(this)) ;
95
+ },
96
+
97
+ _showWorkspace: function(params) {
98
+ if (this._tabs[params.workspace]) {
99
+ this.beginPropertyChanges() ;
100
+ this.set('nowShowing',params.workspace) ;
101
+ this.set('options',params) ;
102
+ this.endPropertyChanges() ;
103
+ } else console.log('workspace not found: ' + params.workspace) ;
104
+ }
105
+
106
+ }) ;
107
+
108
+ SC._WorkspaceButton = SC.ButtonView.extend({
109
+ workspace: null, workspaceId: null,
110
+ action: function() { SC.Routes.set('location',this.workspaceId); },
111
+ isSelectedObserver: function() {
112
+ var parent = this.parentNode ;
113
+ if (parent) Element.setClassName($(parent),'sel',this.get('isSelected'));
114
+ }.observes('isSelected')
115
+ }),
116
+
117
+ // Elements that you want to have swapped in and out can be subclassed from
118
+ // this. Or, you can create your own object. Any elements you want swapped
119
+ // in and out need to be configured as a property named 'somethingElement'.
120
+ SC.WorkspaceTab = SC.View.extend({
121
+
122
+ // ...................................
123
+ // PROPERTIES
124
+ // Override these with your own settings.
125
+
126
+ // modify to include the areas you want loaded in this element.
127
+ areas: ['head','master','detail','dialog','tail'],
128
+
129
+ // the type of view you want your found elements converted into. If you
130
+ // set this to null, the elements will not be converted.
131
+ viewType: SC.View,
132
+
133
+ // Set this to something non-null to show the title in the window.
134
+ title: null,
135
+
136
+ // this should be the portion of the location the user needs to put after
137
+ // the hash to get this workspace to show again in this configuration.
138
+ location: null,
139
+
140
+ // this property will be set by the UI when the user types into the search
141
+ // field. You can observe this property to update your content accordingly.
142
+ filterString: null,
143
+
144
+ // if this workspace is visible, then this property will be set to the
145
+ // id used to show this workspace. It will be set back to null when
146
+ // the workspace is hidden.
147
+ nowShowing: null,
148
+
149
+ // ...................................
150
+ // PRIVATE
151
+ //
152
+ elements: function() {
153
+ var view = this ;
154
+ var ret = [] ;
155
+ this.areas.each(function(area) {
156
+ var el = view.$C(area,1) ;
157
+ if (el) {
158
+ if (this.viewType) el = this.viewType.viewFor(el) ;
159
+ view[area + 'Element'] = el ; ret.push(el) ;
160
+ }
161
+ }) ;
162
+ return ret ;
163
+ },
164
+
165
+ init: function() {
166
+ arguments.callee.base.apply(this,arguments) ;
167
+ this.elements = this.elements() ;
168
+ }
169
+
170
+ }) ;
@@ -0,0 +1,3 @@
1
+ Your new SproutCore client application has been created. To access your application, just start sc_sever and visit your client name in the web browser.
2
+
3
+ If you want to change the deployment settings for the application, add a section for your client in your environment.yaml.
@@ -0,0 +1,12 @@
1
+ client - Generates a new SproutCore client
2
+
3
+ USAGE:
4
+
5
+ ./script/generate sc_client client_name
6
+
7
+ DISCUSSION:
8
+
9
+ This generator will create a new SproutCore-based JavaScript application. After the generator completes, you will be able to begin work immediately.
10
+
11
+ The code created by this generator will appear in a /clients directory. To add models, views, and controllers, you can use the additional generators sc_model, sc_controller, sc_object_controller, sc_collection_controller, and sc_view.
12
+
@@ -0,0 +1,53 @@
1
+ require 'sproutcore/generator_helper'
2
+
3
+ class ClientGenerator < RubiGen::Base
4
+
5
+ include SproutCore::GeneratorHelper
6
+
7
+ default_options :author => nil
8
+
9
+ attr_reader :name
10
+
11
+ def initialize(runtime_args, runtime_options = {})
12
+ super
13
+ usage if args.empty?
14
+ @name = args.shift
15
+ extract_options
16
+ assign_names!(@name)
17
+ end
18
+
19
+ def manifest
20
+ record do |m|
21
+ m.directory 'clients'
22
+ apply_template(m,"clients/#{@name}")
23
+ m.readme '../README'
24
+ end
25
+ end
26
+
27
+ protected
28
+ def banner
29
+ <<-EOS
30
+ Creates a ...
31
+
32
+ USAGE: #{$0} #{spec.name} name
33
+ EOS
34
+ end
35
+
36
+ def add_options!(opts)
37
+ # opts.separator ''
38
+ # opts.separator 'Options:'
39
+ # For each option below, place the default
40
+ # at the top of the file next to "default_options"
41
+ # opts.on("-a", "--author=\"Your Name\"", String,
42
+ # "Some comment about this option",
43
+ # "Default: none") { |options[:author]| }
44
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
45
+ end
46
+
47
+ def extract_options
48
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
49
+ # Templates can access these value via the attr_reader-generated methods, but not the
50
+ # raw instance variable value.
51
+ # @author = options[:author]
52
+ end
53
+ end
@@ -0,0 +1,19 @@
1
+ // ==========================================================================
2
+ // <%= class_name %>
3
+ // ==========================================================================
4
+
5
+ <%= class_name %> = 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: ['<%= class_name %>'] }),
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,3 @@
1
+ <% content_for('body') do %>
2
+ <h1>Welcome to SproutCore</h1>
3
+ <% end %>
@@ -0,0 +1,14 @@
1
+ // ==========================================================================
2
+ // <%= class_name %> 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,37 @@
1
+ // ==========================================================================
2
+ // <%= class_name %>
3
+ // ==========================================================================
4
+
5
+ // This is the function that will start your app running. The default
6
+ // implementation will load any fixtures you have created then instantiate
7
+ // your controllers and awake the elements on your page.
8
+ //
9
+ // As you develop your application you will probably want to override this.
10
+ // See comments for some pointers on what to do next.
11
+ //
12
+ function main() {
13
+
14
+ // Step 1: Load Your Model Data
15
+ // The default code here will load the fixtures you have defined.
16
+ // Comment out the preload line and add something to refresh from the server
17
+ // when you are ready to pull data from your server.
18
+ <%= class_name %>.server.preload(<%= class_name %>.FIXTURES) ;
19
+
20
+ // TODO: refresh() any collections you have created to get their records.
21
+ // ex: <%= class_name %>.contacts.refresh() ;
22
+
23
+ // Step 2: Instantiate Your Views
24
+ // The default code just activates all the views you have on the page. If
25
+ // your app gets any level of complexity, you should just get the views you
26
+ // need to show the app in the first place, to speed things up.
27
+ SC.page.awake() ;
28
+
29
+ // Step 3. Set the content property on your primary controller.
30
+ // This will make your app come alive!
31
+
32
+ // TODO: Set the content property on your primary controller
33
+ // ex: <%= class_name %>.contactsController.set('content',<%= class_name %>.contacts);
34
+
35
+ } ;
36
+
37
+
@@ -0,0 +1,16 @@
1
+ sc_controller - Create a new controller object in your SproutCore client.
2
+
3
+ USAGE:
4
+
5
+ ./script/generate controller client_name/controller_name [CLASS]
6
+
7
+ DISCUSSION:
8
+
9
+ This generator will create a new SproutCore object in your client for us as a controller. You should pass as the first parameter your client directory name/the controller you want to create. For example:
10
+
11
+ ./script/generate controller todos/task
12
+
13
+ defines a new object called Todos.taskController in the file clients/todos/controllers/task.js.
14
+
15
+ This generator creates objects that inherit from SC.Object. You can override this by passing a classname as the second parameter. You can also use the specialize sc_object_controller and sc_collection_controller generators to create those specific types of controllers.
16
+
@@ -0,0 +1,51 @@
1
+ require 'sproutcore/generator_helper'
2
+
3
+ class ControllerGenerator < RubiGen::Base
4
+
5
+ include SproutCore::GeneratorHelper
6
+
7
+ default_options :author => nil
8
+
9
+ attr_reader :name, :client_location
10
+
11
+ def initialize(runtime_args, runtime_options = {})
12
+ super
13
+ usage if args.empty?
14
+ @name = args.shift
15
+ extract_options
16
+ assign_names!(@name)
17
+ end
18
+
19
+ def manifest
20
+ record do |m|
21
+ fp = client_file_path('controllers','js','controller')
22
+ build_client_directories(m, fp)
23
+ m.template 'controller.js', fp
24
+
25
+ fp = client_file_path('tests/controllers', 'rhtml')
26
+ build_client_directories(m, fp)
27
+ m.template 'test.rhtml', fp
28
+ end
29
+ end
30
+
31
+ protected
32
+ def banner
33
+ <<-EOS
34
+ Creates a SproutCore controller objects
35
+
36
+ USAGE: #{$0} #{spec.name} client_name/controller_name [ClassName]
37
+ EOS
38
+ end
39
+
40
+ def add_options!(opts)
41
+ opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| }
42
+ end
43
+
44
+ def extract_options
45
+ @client_location = options[:loc]
46
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
47
+ # Templates can access these value via the attr_reader-generated methods, but not the
48
+ # raw instance variable value.
49
+ # @author = options[:author]
50
+ end
51
+ end
@@ -0,0 +1,21 @@
1
+ // ==========================================================================
2
+ // <%= controller_class_name %>
3
+ // ==========================================================================
4
+
5
+ require('core');
6
+
7
+ /** @class
8
+
9
+ (Document Your View Here)
10
+
11
+ @extends <%= base_class_name 'SC.Object' %>
12
+ @author AuthorName
13
+ @version 0.1
14
+ @static
15
+ */
16
+ <%= controller_instance_name %> = <%= base_class_name 'SC.Object' %>.create(
17
+ /** @scope <%= controller_instance_name %> */ {
18
+
19
+ // TODO: Add your own code here.
20
+
21
+ }) ;
@@ -0,0 +1,21 @@
1
+ <%% # ========================================================================
2
+ # <%= controller_class_name %> Unit Test
3
+ # ========================================================================
4
+ %>
5
+ <%% content_for('final') do %>
6
+
7
+ <script>
8
+
9
+ Test.context("<%= controller_class_name %>",{
10
+
11
+ "TODO: Add your own tests here": function() {
12
+ true.shouldEqual(true) ;
13
+ }
14
+
15
+ }) ;
16
+
17
+ appMain = main; main = null ; // Cancel main() so app does not start
18
+
19
+ </script>
20
+
21
+ <%% end %>
@@ -0,0 +1,7 @@
1
+ Your new framework has been created. To include it in your clients, be sure to edit your environments.yml file, adding someting like this:
2
+
3
+ all:
4
+ requires: [<%= name %>]
5
+
6
+ Then restart your sc_server and you should be ready to go.
7
+
@@ -0,0 +1,12 @@
1
+ framework - Generates a new SproutCore framework
2
+
3
+ USAGE:
4
+
5
+ ./script/generate framework framework_name
6
+
7
+ DISCUSSION:
8
+
9
+ This generator will create a new SproutCore-based JavaScript framework for use by other SproutCore clients. After the generator completes, you will need to add it as a requirement to your configuration.yml.
10
+
11
+ The code created by this generator will appear in a /frameworks directory. To add models, views, and controllers, you can use the additional generators model, controller, object_controller, collection_controller, and view.
12
+
@@ -0,0 +1,53 @@
1
+ require 'sproutcore/generator_helper'
2
+
3
+ class FrameworkGenerator < RubiGen::Base
4
+
5
+ include SproutCore::GeneratorHelper
6
+
7
+ default_options :author => nil
8
+
9
+ attr_reader :name
10
+
11
+ def initialize(runtime_args, runtime_options = {})
12
+ super
13
+ usage if args.empty?
14
+ @name = args.shift
15
+ extract_options
16
+ assign_names!(@name)
17
+ end
18
+
19
+ def manifest
20
+ record do |m|
21
+ m.directory 'frameworks'
22
+ apply_template(m,"frameworks/#{@name}")
23
+ m.readme '../README'
24
+ end
25
+ end
26
+
27
+ protected
28
+ def banner
29
+ <<-EOS
30
+ Creates a SproutCore framework
31
+
32
+ USAGE: #{$0} #{spec.name} framework_name
33
+ EOS
34
+ end
35
+
36
+ def add_options!(opts)
37
+ # opts.separator ''
38
+ # opts.separator 'Options:'
39
+ # For each option below, place the default
40
+ # at the top of the file next to "default_options"
41
+ # opts.on("-a", "--author=\"Your Name\"", String,
42
+ # "Some comment about this option",
43
+ # "Default: none") { |options[:author]| }
44
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
45
+ end
46
+
47
+ def extract_options
48
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
49
+ # Templates can access these value via the attr_reader-generated methods, but not the
50
+ # raw instance variable value.
51
+ # @author = options[:author]
52
+ end
53
+ end
@@ -0,0 +1,20 @@
1
+ // ==========================================================================
2
+ // <%= class_name %> Framework
3
+ // ==========================================================================
4
+
5
+ <%= class_name %> = SC.Object.create({
6
+
7
+ // When you are in development mode, this array will be populated with
8
+ // any fixtures you create for testing and loaded automatically in your
9
+ // main method. When in production, this will be an empty array.
10
+ //
11
+ // You will use this most often when running unit tests in dev mode.
12
+ //
13
+ FIXTURES: [],
14
+
15
+ // Add any global constants or other properties used by the entire
16
+ // framework:
17
+ // CONSTANT_NAME: 'some-value'
18
+
19
+
20
+ }) ;
@@ -0,0 +1,3 @@
1
+ <% content_for('body') do %>
2
+ <h1>Welcome to SproutCore</h1>
3
+ <% end %>
@@ -0,0 +1,14 @@
1
+ // ==========================================================================
2
+ // <%= class_name %> 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,16 @@
1
+ sc_view - Create a new view class in your SproutCore client.
2
+
3
+ USAGE:
4
+
5
+ ./script/generate view client_name/view_name [CLASS]
6
+
7
+ DISCUSSION:
8
+
9
+ This generator will create a new SproutCore view class in your client. You should pass as the first parameter your client directory name/the view you want to create. For example:
10
+
11
+ ./script/generate view todos/task
12
+
13
+ defines a new class called Todos.TaskView in the file clients/todos/views/task.js.
14
+
15
+ This generator creates view that inherit from SC.View but you can override this by passing the name of the view class you want as the second argument.
16
+
@@ -0,0 +1,47 @@
1
+ require 'sproutcore/generator_helper'
2
+
3
+ class LanguageGenerator < RubiGen::Base
4
+
5
+ include SproutCore::GeneratorHelper
6
+
7
+ default_options :author => nil
8
+
9
+ attr_reader :name, :client_location
10
+
11
+ def initialize(runtime_args, runtime_options = {})
12
+ super
13
+ usage if args.empty?
14
+ @name = args.shift
15
+ extract_options
16
+ assign_names!(@name)
17
+ end
18
+
19
+ def manifest
20
+ record do |m|
21
+ fp = client_file_path("#{file_path}.lproj",'js', nil, "#{file_path}/strings")
22
+ build_client_directories(m, fp)
23
+ m.template 'strings.js', fp
24
+ end
25
+ end
26
+
27
+ protected
28
+ def banner
29
+ <<-EOS
30
+ Adds a language to a SproutCore project
31
+
32
+ USAGE: #{$0} #{spec.name} client_name/language_name [ClassName]
33
+ EOS
34
+ end
35
+
36
+ def add_options!(opts)
37
+ opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| }
38
+ end
39
+
40
+ def extract_options
41
+ @client_location = options[:loc]
42
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
43
+ # Templates can access these value via the attr_reader-generated methods, but not the
44
+ # raw instance variable value.
45
+ # @author = options[:author]
46
+ end
47
+ end
@@ -0,0 +1,10 @@
1
+ // ==========================================================================
2
+ // <%= client_namespace %> <%= file_name.capitalize %> Strings
3
+ // ==========================================================================
4
+
5
+ // HINT: For your key names, use the english string with an underscore in
6
+ // front.
7
+ Object.extend(String.<%= file_name.capitalize %>,{
8
+ // "_String Key": "Localized String"
9
+ }) ;
10
+
@@ -0,0 +1,24 @@
1
+ model - Create a new model class in your SproutCore client.
2
+
3
+ USAGE:
4
+
5
+ ./script/generate model client_name/model_name [MODEL_CLASS]
6
+
7
+ DISCUSSION:
8
+
9
+ This generator will create a new SproutCore model file in your client or framework. You should pass as the first parameter your client or framework directory name/the model you want to create. For example:
10
+
11
+ ./script/generate model todos/task
12
+
13
+ defines a new class called Todos.Task in the file clients/todos/models/task.js.
14
+
15
+ Likewise:
16
+
17
+ ./script/generate model frameworks/shared/task
18
+
19
+ defines a new class called Shared.Task in the file frameworks/shared/models/task.js
20
+
21
+ This generator creates classes that inherit from SC.Record but you can override this by passing the name of the view class you want as the second argument.
22
+
23
+ In addition to creating a model class, this will also create a stub for you to add Fixture data. This is a convenient way to preload your application with data while you develop the client but have not yet connected to your server.
24
+