sproutcore 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +269 -0
- data/README.txt +67 -0
- data/Rakefile +4 -0
- data/app_generators/sproutcore/USAGE +5 -0
- data/app_generators/sproutcore/sproutcore_generator.rb +66 -0
- data/app_generators/sproutcore/templates/README +77 -0
- data/app_generators/sproutcore/templates/environment.yml +4 -0
- data/bin/sc-build +145 -0
- data/bin/sc-gen +24 -0
- data/bin/sc-server +63 -0
- data/bin/sproutcore +21 -0
- data/clients/sc_docs/controllers/docs.js +118 -0
- data/clients/sc_docs/core.js +19 -0
- data/clients/sc_docs/english.lproj/body.css +159 -0
- data/clients/sc_docs/english.lproj/body.rhtml +33 -0
- data/clients/sc_docs/english.lproj/controls.css +0 -0
- data/clients/sc_docs/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_docs/english.lproj/icons/small/reset.png +0 -0
- data/clients/sc_docs/english.lproj/images/gradients.png +0 -0
- data/clients/sc_docs/english.lproj/images/indicator.gif +0 -0
- data/clients/sc_docs/english.lproj/images/toolbar.png +0 -0
- data/clients/sc_docs/english.lproj/no_docs.rhtml +7 -0
- data/clients/sc_docs/english.lproj/strings.js +14 -0
- data/clients/sc_docs/english.lproj/warning.rhtml +6 -0
- data/clients/sc_docs/fixtures/doc.js +11 -0
- data/clients/sc_docs/main.js +21 -0
- data/clients/sc_docs/models/doc.js +9 -0
- data/clients/sc_docs/tests/controllers/docs.rhtml +21 -0
- data/clients/sc_docs/tests/models/doc.rhtml +21 -0
- data/clients/sc_docs/tests/views/doc_frame.rhtml +21 -0
- data/clients/sc_docs/tests/views/doc_label_view.rhtml +21 -0
- data/clients/sc_docs/views/doc_frame.js +33 -0
- data/clients/sc_docs/views/doc_label.js +20 -0
- data/clients/sc_test_runner/controllers/runner.js +175 -0
- data/clients/sc_test_runner/core.js +19 -0
- data/clients/sc_test_runner/english.lproj/body.css +151 -0
- data/clients/sc_test_runner/english.lproj/body.rhtml +35 -0
- data/clients/sc_test_runner/english.lproj/controls.css +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
- data/clients/sc_test_runner/english.lproj/images/gradients.png +0 -0
- data/clients/sc_test_runner/english.lproj/images/indicator.gif +0 -0
- data/clients/sc_test_runner/english.lproj/images/toolbar.png +0 -0
- data/clients/sc_test_runner/english.lproj/no_tests.rhtml +6 -0
- data/clients/sc_test_runner/english.lproj/strings.js +14 -0
- data/clients/sc_test_runner/english.lproj/warning.rhtml +6 -0
- data/clients/sc_test_runner/fixtures/test.js +12 -0
- data/clients/sc_test_runner/main.js +26 -0
- data/clients/sc_test_runner/models/test.js +11 -0
- data/clients/sc_test_runner/views/runner_frame.js +72 -0
- data/clients/sc_test_runner/views/test_label.js +20 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +17 -0
- data/environment.yml +9 -0
- data/frameworks/prototype/prototype.js +4186 -0
- data/frameworks/sproutcore/Core.js +378 -0
- data/frameworks/sproutcore/README +3 -0
- data/frameworks/sproutcore/controllers/array.js +236 -0
- data/frameworks/sproutcore/controllers/collection.js +305 -0
- data/frameworks/sproutcore/controllers/controller.js +323 -0
- data/frameworks/sproutcore/controllers/object.js +372 -0
- data/frameworks/sproutcore/drag/drag.js +549 -0
- data/frameworks/sproutcore/drag/drag_data_source.js +32 -0
- data/frameworks/sproutcore/drag/drag_source.js +64 -0
- data/frameworks/sproutcore/drag/drop_target.js +153 -0
- data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
- data/frameworks/sproutcore/english.lproj/buttons.css +589 -0
- data/frameworks/sproutcore/english.lproj/buttons.png +0 -0
- data/frameworks/sproutcore/english.lproj/inline_text_editor.css +21 -0
- data/frameworks/sproutcore/english.lproj/menu.css +121 -0
- data/frameworks/sproutcore/english.lproj/panels/background-fat.jpg +0 -0
- data/frameworks/sproutcore/english.lproj/panels/background-thin.jpg +0 -0
- data/frameworks/sproutcore/english.lproj/panels/bottom-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/bottom-left-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/bottom-right-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/left-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/overlay.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/right-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/top-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/top-left-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/top-right-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panes.css +155 -0
- data/frameworks/sproutcore/english.lproj/picker.css +22 -0
- data/frameworks/sproutcore/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/english.lproj/tab.css +23 -0
- data/frameworks/sproutcore/english.lproj/tests.css +67 -0
- data/frameworks/sproutcore/english.lproj/theme.css +77 -0
- data/frameworks/sproutcore/foundation/animator.js +670 -0
- data/frameworks/sproutcore/foundation/application.js +199 -0
- data/frameworks/sproutcore/foundation/array.js +348 -0
- data/frameworks/sproutcore/foundation/benchmark.js +211 -0
- data/frameworks/sproutcore/foundation/binding.js +384 -0
- data/frameworks/sproutcore/foundation/date.js +357 -0
- data/frameworks/sproutcore/foundation/error.js +39 -0
- data/frameworks/sproutcore/foundation/input_manager.js +153 -0
- data/frameworks/sproutcore/foundation/json.js +296 -0
- data/frameworks/sproutcore/foundation/mock.js +42 -0
- data/frameworks/sproutcore/foundation/node_descriptor.js +56 -0
- data/frameworks/sproutcore/foundation/object.js +777 -0
- data/frameworks/sproutcore/foundation/observable.js +451 -0
- data/frameworks/sproutcore/foundation/page.js +63 -0
- data/frameworks/sproutcore/foundation/path_module.js +413 -0
- data/frameworks/sproutcore/foundation/responder.js +310 -0
- data/frameworks/sproutcore/foundation/routes.js +371 -0
- data/frameworks/sproutcore/foundation/run_loop.js +21 -0
- data/frameworks/sproutcore/foundation/server.js +491 -0
- data/frameworks/sproutcore/foundation/set.js +96 -0
- data/frameworks/sproutcore/foundation/string.js +149 -0
- data/frameworks/sproutcore/foundation/undo_manager.js +186 -0
- data/frameworks/sproutcore/foundation/unittest.js +622 -0
- data/frameworks/sproutcore/foundation/utils.js +61 -0
- data/frameworks/sproutcore/globals/panels.js +182 -0
- data/frameworks/sproutcore/globals/popups.js +60 -0
- data/frameworks/sproutcore/globals/window.js +381 -0
- data/frameworks/sproutcore/lib/index.rhtml +66 -0
- data/frameworks/sproutcore/models/collection.js +395 -0
- data/frameworks/sproutcore/models/record.js +622 -0
- data/frameworks/sproutcore/models/store.js +295 -0
- data/frameworks/sproutcore/panes/dialog.js +16 -0
- data/frameworks/sproutcore/panes/manager.js +164 -0
- data/frameworks/sproutcore/panes/menu.js +45 -0
- data/frameworks/sproutcore/panes/overlay.js +231 -0
- data/frameworks/sproutcore/panes/pane.js +90 -0
- data/frameworks/sproutcore/panes/panel.js +19 -0
- data/frameworks/sproutcore/panes/picker.js +45 -0
- data/frameworks/sproutcore/tests/controllers/array.rhtml +86 -0
- data/frameworks/sproutcore/tests/controllers/controller.rhtml +273 -0
- data/frameworks/sproutcore/tests/controllers/object.rhtml +327 -0
- data/frameworks/sproutcore/tests/foundation/application.rhtml +125 -0
- data/frameworks/sproutcore/tests/foundation/array.rhtml +221 -0
- data/frameworks/sproutcore/tests/foundation/object.rhtml +69 -0
- data/frameworks/sproutcore/tests/globals/window.rhtml +45 -0
- data/frameworks/sproutcore/tests/panes/pane.rhtml +88 -0
- data/frameworks/sproutcore/tests/views/collection.rhtml +137 -0
- data/frameworks/sproutcore/tests/views/popup_button.rhtml +115 -0
- data/frameworks/sproutcore/tests/views/text_field.rhtml +37 -0
- data/frameworks/sproutcore/validators/credit_card.js +92 -0
- data/frameworks/sproutcore/validators/date.js +36 -0
- data/frameworks/sproutcore/validators/email.js +29 -0
- data/frameworks/sproutcore/validators/not_empty.js +24 -0
- data/frameworks/sproutcore/validators/number.js +55 -0
- data/frameworks/sproutcore/validators/password.js +78 -0
- data/frameworks/sproutcore/validators/validator.js +304 -0
- data/frameworks/sproutcore/views/button.js +425 -0
- data/frameworks/sproutcore/views/checkbox_field.js +30 -0
- data/frameworks/sproutcore/views/collection.js +1521 -0
- data/frameworks/sproutcore/views/container.js +62 -0
- data/frameworks/sproutcore/views/error_explanation.js +45 -0
- data/frameworks/sproutcore/views/field.js +214 -0
- data/frameworks/sproutcore/views/filter_button.js +29 -0
- data/frameworks/sproutcore/views/form.js +591 -0
- data/frameworks/sproutcore/views/image.js +141 -0
- data/frameworks/sproutcore/views/inline_text_editor.js +96 -0
- data/frameworks/sproutcore/views/label.js +176 -0
- data/frameworks/sproutcore/views/menu_item.js +90 -0
- data/frameworks/sproutcore/views/pagination.js +54 -0
- data/frameworks/sproutcore/views/popup_button.js +86 -0
- data/frameworks/sproutcore/views/popup_menu.js +137 -0
- data/frameworks/sproutcore/views/progress.js +100 -0
- data/frameworks/sproutcore/views/radio_field.js +107 -0
- data/frameworks/sproutcore/views/radio_group.js +48 -0
- data/frameworks/sproutcore/views/segmented.js +80 -0
- data/frameworks/sproutcore/views/select_field.js +272 -0
- data/frameworks/sproutcore/views/spinner.js +11 -0
- data/frameworks/sproutcore/views/tab.js +126 -0
- data/frameworks/sproutcore/views/text_field.js +179 -0
- data/frameworks/sproutcore/views/textarea_field.js +14 -0
- data/frameworks/sproutcore/views/toolbar.js +29 -0
- data/frameworks/sproutcore/views/view.js +1389 -0
- data/frameworks/sproutcore/views/workspace.js +170 -0
- data/generators/client/README +3 -0
- data/generators/client/USAGE +12 -0
- data/generators/client/client_generator.rb +53 -0
- data/generators/client/templates/core.js +19 -0
- data/generators/client/templates/english.lproj/body.css +0 -0
- data/generators/client/templates/english.lproj/body.rhtml +3 -0
- data/generators/client/templates/english.lproj/controls.css +0 -0
- data/generators/client/templates/english.lproj/strings.js +14 -0
- data/generators/client/templates/main.js +37 -0
- data/generators/controller/USAGE +16 -0
- data/generators/controller/controller_generator.rb +51 -0
- data/generators/controller/templates/controller.js +21 -0
- data/generators/controller/templates/test.rhtml +21 -0
- data/generators/framework/README +7 -0
- data/generators/framework/USAGE +12 -0
- data/generators/framework/framework_generator.rb +53 -0
- data/generators/framework/templates/core.js +20 -0
- data/generators/framework/templates/english.lproj/body.css +0 -0
- data/generators/framework/templates/english.lproj/body.rhtml +3 -0
- data/generators/framework/templates/english.lproj/controls.css +0 -0
- data/generators/framework/templates/english.lproj/strings.js +14 -0
- data/generators/language/USAGE +16 -0
- data/generators/language/language_generator.rb +47 -0
- data/generators/language/templates/strings.js +10 -0
- data/generators/model/USAGE +24 -0
- data/generators/model/model_generator.rb +55 -0
- data/generators/model/templates/fixture.js +11 -0
- data/generators/model/templates/model.js +20 -0
- data/generators/model/templates/test.rhtml +21 -0
- data/generators/test/USAGE +16 -0
- data/generators/test/templates/test.rhtml +21 -0
- data/generators/test/test_generator.rb +47 -0
- data/generators/view/USAGE +16 -0
- data/generators/view/templates/test.rhtml +21 -0
- data/generators/view/templates/view.js +20 -0
- data/generators/view/view_generator.rb +51 -0
- data/jsdoc/README.txt +119 -0
- data/jsdoc/app/DocFile.js +137 -0
- data/jsdoc/app/DocTag.js +110 -0
- data/jsdoc/app/Doclet.js +63 -0
- data/jsdoc/app/Dumper.js +143 -0
- data/jsdoc/app/JsDoc.js +103 -0
- data/jsdoc/app/JsHilite.js +45 -0
- data/jsdoc/app/JsIO.js +163 -0
- data/jsdoc/app/JsParse.js +385 -0
- data/jsdoc/app/JsPlate.js +130 -0
- data/jsdoc/app/JsTestrun.js +129 -0
- data/jsdoc/app/JsToke.js +564 -0
- data/jsdoc/app/Symbol.js +298 -0
- data/jsdoc/app/Transformer.js +14 -0
- data/jsdoc/app/Util.js +97 -0
- data/jsdoc/app/js.jar +0 -0
- data/jsdoc/app/run.js +144 -0
- data/jsdoc/plugins/min.js +316 -0
- data/jsdoc/plugins/strip.js +20 -0
- data/jsdoc/templates/sproutcore/class.tmpl +438 -0
- data/jsdoc/templates/sproutcore/default.css +241 -0
- data/jsdoc/templates/sproutcore/index.html +13 -0
- data/jsdoc/templates/sproutcore/index.tmpl +21 -0
- data/jsdoc/templates/sproutcore/prototype.js +4186 -0
- data/jsdoc/templates/sproutcore/publish.js +236 -0
- data/jsdoc/templates/sproutcore/splash.html +7 -0
- data/lib/sproutcore/build_tools/html_builder.rb +88 -0
- data/lib/sproutcore/build_tools/resource_builder.rb +194 -0
- data/lib/sproutcore/build_tools.rb +44 -0
- data/lib/sproutcore/bundle.rb +517 -0
- data/lib/sproutcore/bundle_manifest.rb +397 -0
- data/lib/sproutcore/generator_helper.rb +170 -0
- data/lib/sproutcore/helpers/capture_helper.rb +42 -0
- data/lib/sproutcore/helpers/static_helper.rb +80 -0
- data/lib/sproutcore/helpers/tag_helper.rb +110 -0
- data/lib/sproutcore/helpers/text_helper.rb +336 -0
- data/lib/sproutcore/helpers.rb +3 -0
- data/lib/sproutcore/jsdoc.rb +40 -0
- data/lib/sproutcore/jsmin.rb +247 -0
- data/lib/sproutcore/library.rb +258 -0
- data/lib/sproutcore/merb/bundle_controller.rb +179 -0
- data/lib/sproutcore/merb/router.rb +43 -0
- data/lib/sproutcore/merb.rb +27 -0
- data/lib/sproutcore/version.rb +9 -0
- data/lib/sproutcore/view_helpers/button_views.rb +302 -0
- data/lib/sproutcore/view_helpers/core_views.rb +284 -0
- data/lib/sproutcore/view_helpers/form_views.rb +258 -0
- data/lib/sproutcore/view_helpers/menu_views.rb +94 -0
- data/lib/sproutcore/view_helpers.rb +628 -0
- data/lib/sproutcore.rb +30 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/sproutcore_spec.rb +11 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- metadata +365 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'sproutcore/generator_helper'
|
|
2
|
+
|
|
3
|
+
class ModelGenerator < 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('models','js')
|
|
22
|
+
build_client_directories(m, fp)
|
|
23
|
+
m.template 'model.js', fp
|
|
24
|
+
|
|
25
|
+
fp = client_file_path('fixtures','js')
|
|
26
|
+
build_client_directories(m, fp)
|
|
27
|
+
m.template 'fixture.js', fp
|
|
28
|
+
|
|
29
|
+
fp = client_file_path('tests/models', 'rhtml')
|
|
30
|
+
build_client_directories(m, fp)
|
|
31
|
+
m.template 'test.rhtml', fp
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
protected
|
|
36
|
+
def banner
|
|
37
|
+
<<-EOS
|
|
38
|
+
Creates a SproutCore model objects
|
|
39
|
+
|
|
40
|
+
USAGE: #{$0} #{spec.name} client_name/model_name [ClassName]
|
|
41
|
+
EOS
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def add_options!(opts)
|
|
45
|
+
opts.on("-l", '--loc="Location"', String, "Location of build. If not passed, search clients and frameworks dirs", "Default: none") { |options[:loc]| }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def extract_options
|
|
49
|
+
@client_location = options[:loc]
|
|
50
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
51
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
|
52
|
+
# raw instance variable value.
|
|
53
|
+
# @author = options[:author]
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ==========================================================================
|
|
2
|
+
// <%= client_class_name %> Fixtures
|
|
3
|
+
// ==========================================================================
|
|
4
|
+
|
|
5
|
+
require('core') ;
|
|
6
|
+
|
|
7
|
+
<%= client_namespace %>.FIXTURES = <%= client_namespace %>.FIXTURES.concat([
|
|
8
|
+
|
|
9
|
+
// TODO: Add your data fixtures here.
|
|
10
|
+
|
|
11
|
+
]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ==========================================================================
|
|
2
|
+
// <%= client_class_name %>
|
|
3
|
+
// ==========================================================================
|
|
4
|
+
|
|
5
|
+
require('core');
|
|
6
|
+
|
|
7
|
+
/** @class
|
|
8
|
+
|
|
9
|
+
(Document your class here)
|
|
10
|
+
|
|
11
|
+
@extends <%= base_class_name 'SC.Record' %>
|
|
12
|
+
@author AuthorName
|
|
13
|
+
@version 0.1
|
|
14
|
+
*/
|
|
15
|
+
<%= client_class_name %> = <%= base_class_name 'SC.Record' %>.extend(
|
|
16
|
+
/** @scope <%= client_class_name %>.prototype */ {
|
|
17
|
+
|
|
18
|
+
// TODO: Add your own code here.
|
|
19
|
+
|
|
20
|
+
}) ;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%% # ========================================================================
|
|
2
|
+
# <%= client_class_name %> Unit Test
|
|
3
|
+
# ========================================================================
|
|
4
|
+
%>
|
|
5
|
+
<%% content_for('final') do %>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
Test.context("<%= client_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,16 @@
|
|
|
1
|
+
test - Create a new unit test in your SproutCore client.
|
|
2
|
+
|
|
3
|
+
USAGE:
|
|
4
|
+
|
|
5
|
+
./script/generate test client_name/test_name [CLASS]
|
|
6
|
+
|
|
7
|
+
DISCUSSION:
|
|
8
|
+
|
|
9
|
+
This generator will create a new SproutCore unit test in your client. You should pass as the first parameter your client directory name/the test you want to create. For example:
|
|
10
|
+
|
|
11
|
+
./script/generate test todos/task
|
|
12
|
+
|
|
13
|
+
defines a new test called called "Task" in the file clients/todos/tests/task.rhtml.
|
|
14
|
+
|
|
15
|
+
The default test simply returns true. Add your own tests to do something useful.
|
|
16
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%% # ========================================================================
|
|
2
|
+
# <%= file_name.gsub('_', ' ').titleize %> Unit Test
|
|
3
|
+
# ========================================================================
|
|
4
|
+
%>
|
|
5
|
+
<%% content_for('final') do %>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
Test.context("<%= file_name.gsub('_', ' ').titleize %>",{
|
|
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,47 @@
|
|
|
1
|
+
require 'sproutcore/generator_helper'
|
|
2
|
+
|
|
3
|
+
class TestGenerator < 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('tests', 'rhtml')
|
|
22
|
+
build_client_directories(m, fp)
|
|
23
|
+
m.template 'test.rhtml', fp
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
protected
|
|
28
|
+
def banner
|
|
29
|
+
<<-EOS
|
|
30
|
+
Add a test to a SproutCore project
|
|
31
|
+
|
|
32
|
+
USAGE: #{$0} #{spec.name} client_name/test_name
|
|
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,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,21 @@
|
|
|
1
|
+
<%% # ========================================================================
|
|
2
|
+
# <%= view_class_name %> Unit Test
|
|
3
|
+
# ========================================================================
|
|
4
|
+
%>
|
|
5
|
+
<%% content_for('final') do %>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
Test.context("<%= view_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,20 @@
|
|
|
1
|
+
// ==========================================================================
|
|
2
|
+
// <%= view_class_name %>
|
|
3
|
+
// ==========================================================================
|
|
4
|
+
|
|
5
|
+
require('core');
|
|
6
|
+
|
|
7
|
+
/** @class
|
|
8
|
+
|
|
9
|
+
(Document Your View Here)
|
|
10
|
+
|
|
11
|
+
@extends <%= base_class_name 'SC.View' %>
|
|
12
|
+
@author AuthorName
|
|
13
|
+
@version 0.1
|
|
14
|
+
*/
|
|
15
|
+
<%= view_class_name %> = <%= base_class_name 'SC.View' %>.extend(
|
|
16
|
+
/** @scope <%= view_class_name %>.prototype */ {
|
|
17
|
+
|
|
18
|
+
// TODO: Add your own code here.
|
|
19
|
+
|
|
20
|
+
}) ;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'sproutcore/generator_helper'
|
|
2
|
+
|
|
3
|
+
class ViewGenerator < 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('views','js','view')
|
|
22
|
+
build_client_directories(m, fp)
|
|
23
|
+
m.template 'view.js', fp
|
|
24
|
+
|
|
25
|
+
fp = client_file_path('tests/views', '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 model objects
|
|
35
|
+
|
|
36
|
+
USAGE: #{$0} #{spec.name} client_name/model_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
|
data/jsdoc/README.txt
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
=====================================================================
|
|
2
|
+
|
|
3
|
+
DESCRIPTION:
|
|
4
|
+
|
|
5
|
+
JsDoc Toolkit is an automatic documentation generation tool for
|
|
6
|
+
JavaScript. It is written in JavaScript and is run from a command line
|
|
7
|
+
(or terminal) using Mozilla Rhino JavaScript engine. Using this tool
|
|
8
|
+
you can automatically turn JavaDoc-like comments in your JavaScript
|
|
9
|
+
source code into published output, such as HTML or XML.
|
|
10
|
+
|
|
11
|
+
For more information, to report a bug or to browse the technical
|
|
12
|
+
documentation for this tool please visit the official JsDoc Toolkit
|
|
13
|
+
project homepage: http://code.google.com/p/jsdoc-toolkit/
|
|
14
|
+
|
|
15
|
+
This project is based on the JSDoc.pm tool, created by Michael
|
|
16
|
+
Mathews, maintained by Gabriel Reid. More information on JsDoc can
|
|
17
|
+
be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/
|
|
18
|
+
|
|
19
|
+
Complete documentation on JsDoc Toolkit can be found on the project
|
|
20
|
+
wiki at http://code.google.com/p/jsdoc-toolkit/w/list
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
=====================================================================
|
|
24
|
+
|
|
25
|
+
USAGE:
|
|
26
|
+
|
|
27
|
+
Running JsDoc Toolkit on your desktop requires you to have Java
|
|
28
|
+
installed and the Mozilla Rhino JavaScript jar file (named "js.jar")
|
|
29
|
+
available. A copy of this jar file is included with the JsDoc Toolkit
|
|
30
|
+
distribution. To download Rhino yourself or to find out more go to
|
|
31
|
+
the official Rhino web page: http://www.mozilla.org/rhino/
|
|
32
|
+
|
|
33
|
+
Before running the JsDoc Toolkit app you must change your current
|
|
34
|
+
working directory to the jsdoc-toolkit folder. Then follow the
|
|
35
|
+
examples below, or as shown on the project wiki.
|
|
36
|
+
|
|
37
|
+
On a computer running Windows a valid command line to run JsDoc
|
|
38
|
+
Toolkit might look like this:
|
|
39
|
+
|
|
40
|
+
> java -jar app\js.jar app\run.js -a -t=templates\htm test\data\test.js
|
|
41
|
+
|
|
42
|
+
On Mac OS X or Linux the same command would look like this:
|
|
43
|
+
|
|
44
|
+
$ java -jar app/js.jar app/run.js -a -t=templates/htm test/data/test.js
|
|
45
|
+
|
|
46
|
+
The above assumes your current working directory contains the app, test
|
|
47
|
+
and templates subdirectories from the standard JsDoc Toolkit
|
|
48
|
+
distribution. If you have the js.jar file saved to a place in your
|
|
49
|
+
system's Java CLASSPATH, it can safely be omitted from the command.
|
|
50
|
+
|
|
51
|
+
To run JsDoc Toolkit from any directory, specify the path to the app
|
|
52
|
+
folder like so:
|
|
53
|
+
|
|
54
|
+
> java -Djsdoc.dir=%BASE_DIR% -jar %RHINO% %RUN% %OPTS% %SRC_FILES%
|
|
55
|
+
|
|
56
|
+
So assuming the JsDoc Toolkit "app" directory is in "lib\jsdoc-toolkit"
|
|
57
|
+
you would specify that like so:
|
|
58
|
+
|
|
59
|
+
> java -Djsdoc.dir=lib\jsdoc-toolkit <etc>
|
|
60
|
+
|
|
61
|
+
The output documentation files will be saved to a new directory named
|
|
62
|
+
"js_docs_out" (by default) in the current directory, or if you specify
|
|
63
|
+
a -d=somewhere_else option, to the somewhere_else directory.
|
|
64
|
+
|
|
65
|
+
For help (usage notes) enter this on the command line:
|
|
66
|
+
|
|
67
|
+
> java -jar app\js.jar app\run.js -h
|
|
68
|
+
|
|
69
|
+
To run the unit tests included with JsDoc Toolkit enter this on the
|
|
70
|
+
command line:
|
|
71
|
+
|
|
72
|
+
> java -jar app\js.jar test\run.js
|
|
73
|
+
|
|
74
|
+
To run any example in the included examples enter this on the
|
|
75
|
+
command line:
|
|
76
|
+
|
|
77
|
+
$ java -jar app/js.jar examples/run.js -a examples/data/whatever.js
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
=====================================================================
|
|
81
|
+
|
|
82
|
+
LICENSE:
|
|
83
|
+
|
|
84
|
+
Rhino (JavaScript in Java) is open source and licensed by Mozilla
|
|
85
|
+
under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of which
|
|
86
|
+
is available at http://www.mozilla.org/MPL/
|
|
87
|
+
|
|
88
|
+
You can obtain the source code for Rhino via the Mozilla web site at
|
|
89
|
+
http://www.mozilla.org/rhino/download.html
|
|
90
|
+
|
|
91
|
+
The Tango base icon theme is licensed under the Creative Commons
|
|
92
|
+
Attribution Share-Alike license. The palette is in the public domain.
|
|
93
|
+
For more details visit the Tango! Desktop Project page at
|
|
94
|
+
http://tango.freedesktop.org/Tango_Desktop_Project
|
|
95
|
+
|
|
96
|
+
JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine
|
|
97
|
+
without modification and without any claims whatsoever. The portions of
|
|
98
|
+
code specific to JsDoc Toolkit are open source and licensed under the
|
|
99
|
+
X11/MIT License.
|
|
100
|
+
|
|
101
|
+
Copyright (c) 2007 Michael Mathews <micmath@gmail.com>
|
|
102
|
+
|
|
103
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
104
|
+
a copy of this software and associated documentation files (the
|
|
105
|
+
"Software"), to deal in the Software without restriction, including
|
|
106
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
107
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
108
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
109
|
+
the following conditions: The above copyright notice and this
|
|
110
|
+
permission notice must be included in all copies or substantial
|
|
111
|
+
portions of the Software.
|
|
112
|
+
|
|
113
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
114
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
115
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
116
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
117
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
118
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
119
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileOverview
|
|
3
|
+
* @name DocFile
|
|
4
|
+
* @author Michael Mathews micmath@gmail.com
|
|
5
|
+
* @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-1.4.0b/app/DocFile.js $
|
|
6
|
+
* @revision $Id: DocFile.js 260 2007-10-03 22:18:38Z micmath $
|
|
7
|
+
* @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
|
|
8
|
+
* (See the accompanying README file for full details.)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @class Represents a collection of docFiles.
|
|
13
|
+
* @constructor
|
|
14
|
+
* @author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
|
|
15
|
+
*/
|
|
16
|
+
function DocFileGroup() {
|
|
17
|
+
this.files = [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {DocFile} docFile Add this docFile to this group.
|
|
22
|
+
*/
|
|
23
|
+
DocFileGroup.prototype.addDocFile = function(docFile) {
|
|
24
|
+
docFile.fileGroup = this;
|
|
25
|
+
docFile.fileGroup.circularReference = 1; // keeps dumper from getting dizzy
|
|
26
|
+
this.files.push(docFile);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Search the entire dofFileGroup for a certain symbol.
|
|
31
|
+
* @param {string} alias The full alias name of the symbol.
|
|
32
|
+
* @return {Symbol}
|
|
33
|
+
*/
|
|
34
|
+
DocFileGroup.prototype.getSymbol = function(alias) {
|
|
35
|
+
for (var f = 0; f < this.files.length; f++) {
|
|
36
|
+
var symbol = this.files[f].getSymbol(alias);
|
|
37
|
+
if (symbol) return symbol;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @class Represents a collection of doclets associated with a file.
|
|
43
|
+
* @constructor
|
|
44
|
+
* @author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
|
|
45
|
+
* @param {string} [path] The file path to the source file.
|
|
46
|
+
*/
|
|
47
|
+
function DocFile(path) {
|
|
48
|
+
this.path = path;
|
|
49
|
+
this.filename = Util.fileName(this.path);
|
|
50
|
+
this.overview = new Symbol(this.filename, [], "FILE", "/** @overview */");
|
|
51
|
+
this.symbols = [];
|
|
52
|
+
fileGroup = null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Add a group of doclets. Finds relationships between doclets within the group
|
|
57
|
+
* @param {Symbol[]} symbols
|
|
58
|
+
* @param {object} opt Passed in from the command line.
|
|
59
|
+
*/
|
|
60
|
+
DocFile.prototype.addSymbols = function(symbols, opt) {
|
|
61
|
+
for (var s = 0; s < symbols.length; s++) {
|
|
62
|
+
if (symbols[s].doc.getTag("ignore").length)
|
|
63
|
+
continue;
|
|
64
|
+
|
|
65
|
+
if (symbols[s].isPrivate && !opt.p)
|
|
66
|
+
continue;
|
|
67
|
+
|
|
68
|
+
symbols[s].file = this;
|
|
69
|
+
symbols[s].file.circularReference = 1; // keeps dumper from getting dizzy
|
|
70
|
+
|
|
71
|
+
var parents;
|
|
72
|
+
if ((parents = symbols[s].doc.getTag("memberof")) && parents.length) {
|
|
73
|
+
if (symbols[s].name.indexOf(parents[0]+".") == 0) {
|
|
74
|
+
symbols[s].name = symbols[s].name.replace(parents[0]+".", parents[0]+"/");
|
|
75
|
+
symbols[s].isStatic = true;
|
|
76
|
+
}
|
|
77
|
+
else if (symbols[s].name.indexOf(parents[0]+"/") != 0) {
|
|
78
|
+
symbols[s].name = parents[0]+"/"+symbols[s].name;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
symbols[s].doc._dropTag("memberof");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (symbols[s].desc == "undocumented") {
|
|
85
|
+
if (/(^_|[.\/]_)/.test(symbols[s].name) && !opt.A) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (!opt.a && !opt.A) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// is this a member of another object?
|
|
94
|
+
// TODO this relationship may span files, so should move into DocFileGroup?
|
|
95
|
+
var parts = null;
|
|
96
|
+
if (
|
|
97
|
+
symbols[s].name.indexOf("/") > -1
|
|
98
|
+
&& (parts = symbols[s].name.match(/^(.+)\/([^\/]+)$/))
|
|
99
|
+
) {
|
|
100
|
+
var parentName = parts[1].replace(/\//g, ".");
|
|
101
|
+
var childName = parts[2];
|
|
102
|
+
|
|
103
|
+
symbols[s].alias = symbols[s].name.replace(/\//g, ".");
|
|
104
|
+
symbols[s].name = childName;
|
|
105
|
+
symbols[s].memberof = parentName;
|
|
106
|
+
|
|
107
|
+
// is the parent defined?
|
|
108
|
+
var parent = this.getSymbol(parentName);
|
|
109
|
+
|
|
110
|
+
if (!parent) LOG.warn("Member '"+childName+"' documented but no documentation exists for parent object '"+parentName+"'.");
|
|
111
|
+
else {
|
|
112
|
+
if (symbols[s].is("OBJECT")) {
|
|
113
|
+
parent.properties.push(symbols[s]);
|
|
114
|
+
}
|
|
115
|
+
if (symbols[s].is("FUNCTION")) {
|
|
116
|
+
parent.methods.push(symbols[s]);
|
|
117
|
+
}
|
|
118
|
+
if (symbols[s].is("EVENT")) {
|
|
119
|
+
parent.events.push(symbols[s]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this.symbols.push(symbols[s]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {string} alias The full alias name of the symbol.
|
|
130
|
+
* @return {Symbol}
|
|
131
|
+
*/
|
|
132
|
+
DocFile.prototype.getSymbol = function(alias) {
|
|
133
|
+
for (var i = 0; i < this.symbols.length; i++) {
|
|
134
|
+
if (this.symbols[i].alias == alias) return this.symbols[i];
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
data/jsdoc/app/DocTag.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileOverview
|
|
3
|
+
* @name DocTag
|
|
4
|
+
* @author Michael Mathews micmath@gmail.com
|
|
5
|
+
* @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-1.4.0b/app/DocTag.js $
|
|
6
|
+
* @revision $Id: DocTag.js 334 2007-11-13 19:52:49Z micmath $
|
|
7
|
+
* @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
|
|
8
|
+
* (See the accompanying README file for full details.)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @class Represents a tag within a doclet.
|
|
13
|
+
* @author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
|
|
14
|
+
* @constructor
|
|
15
|
+
* @param {string} src line(s) of text following the @ character
|
|
16
|
+
*/
|
|
17
|
+
function DocTag(src) {
|
|
18
|
+
/**
|
|
19
|
+
* Like @title
|
|
20
|
+
* @type string
|
|
21
|
+
*/
|
|
22
|
+
this.title = "";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Like @title {type}
|
|
26
|
+
* @type string
|
|
27
|
+
*/
|
|
28
|
+
this.type = "";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Like @title {type}? name, though this is only recognized in tags with a title of "param" or "property."
|
|
32
|
+
* @type string
|
|
33
|
+
*/
|
|
34
|
+
this.name = "";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Like @title {type}? name? description goes here...
|
|
38
|
+
* @type string
|
|
39
|
+
*/
|
|
40
|
+
this.desc = "";
|
|
41
|
+
|
|
42
|
+
if (typeof(src) != "undefined") {
|
|
43
|
+
var parts = src.match(/^(\S+)(?:\s+\{\s*([\S\s]+?)\s*\})?\s*([\S\s]*\S)?/);
|
|
44
|
+
|
|
45
|
+
this.title = (parts[1].toLowerCase() || "");
|
|
46
|
+
this.type = (parts[2] || "");
|
|
47
|
+
|
|
48
|
+
if (this.type) this.type = this.type.replace(/\s*(,|\|\|?)\s*/g, ", ");
|
|
49
|
+
this.desc = (parts[3] || "");
|
|
50
|
+
|
|
51
|
+
// should be @type foo but we'll accept @type {foo} too
|
|
52
|
+
if (this.title == "type") {
|
|
53
|
+
if (this.type) this.desc = this.type;
|
|
54
|
+
|
|
55
|
+
// should be @type foo, bar, baz but we'll accept @type foo|bar||baz too
|
|
56
|
+
if (this.desc) {
|
|
57
|
+
this.desc = this.desc.replace(/\s*(,|\|\|?)\s*/g, ", ");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var syn;
|
|
62
|
+
if ((syn = DocTag.synonyms["="+this.title])) this.title = syn;
|
|
63
|
+
|
|
64
|
+
if (this.desc) {
|
|
65
|
+
if (this.title == "param") { // long tags like {type} [name] desc
|
|
66
|
+
var m = this.desc.match(/^\s*(\[?)([a-zA-Z0-9.$_]+)(\]?)(?:\s+\{\s*([\S\s]+?)\s*\})?(?:\s+([\S\s]*\S))?/);
|
|
67
|
+
if (m) {
|
|
68
|
+
this.isOptional = (!!m[1] && !!m[3]); // bracketed name means optional
|
|
69
|
+
this.name = (m[2] || "");
|
|
70
|
+
this.type = (m[4] || this.type);
|
|
71
|
+
this.desc = (m[5] || "");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (this.title == "property") {
|
|
75
|
+
m = this.desc.match(/^\s*([a-zA-Z0-9.$_]+)(?:\s+([\S\s]*\S))?/);
|
|
76
|
+
if (m) {
|
|
77
|
+
this.name = (m[1] || "");
|
|
78
|
+
this.desc = (m[2] || "");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (this.title == "config") {
|
|
82
|
+
m = this.desc.match(/^\s*(\[?)([a-zA-Z0-9.$_]+)(\]?)(?:\s+([\S\s]*\S))?/);
|
|
83
|
+
if (m) {
|
|
84
|
+
this.isOptional = (!!m[1] && !!m[3]); // bracketed name means optional
|
|
85
|
+
this.name = (m[2] || "");
|
|
86
|
+
this.desc = (m[4] || "");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Used to make various JsDoc tags compatible with JsDoc Toolkit.
|
|
95
|
+
* @memberOf DocTag
|
|
96
|
+
*/
|
|
97
|
+
DocTag.synonyms = {
|
|
98
|
+
"=member": "memberof",
|
|
99
|
+
"=description": "desc",
|
|
100
|
+
"=exception": "throws",
|
|
101
|
+
"=argument": "param",
|
|
102
|
+
"=returns": "return",
|
|
103
|
+
"=classdescription": "class",
|
|
104
|
+
"=fileoverview": "overview",
|
|
105
|
+
"=extends": "augments"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
DocTag.prototype.toString = function() {
|
|
109
|
+
return this.desc;
|
|
110
|
+
}
|