josephholsten-jasmine 1.1.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/.gitignore +11 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +5 -0
  4. data/HOW_TO_TEST.markdown +9 -0
  5. data/MIT.LICENSE +20 -0
  6. data/README.markdown +71 -0
  7. data/RELEASE.markdown +22 -0
  8. data/Rakefile +76 -0
  9. data/bin/jasmine +6 -0
  10. data/generators/jasmine/jasmine_generator.rb +32 -0
  11. data/generators/jasmine/templates/INSTALL +9 -0
  12. data/generators/jasmine/templates/jasmine-example/SpecRunner.html +27 -0
  13. data/generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js +58 -0
  14. data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +9 -0
  15. data/generators/jasmine/templates/jasmine-example/src/Player.js +22 -0
  16. data/generators/jasmine/templates/jasmine-example/src/Song.js +7 -0
  17. data/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -0
  18. data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +81 -0
  19. data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +73 -0
  20. data/generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb +23 -0
  21. data/generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb +32 -0
  22. data/jasmine/Gemfile +6 -0
  23. data/jasmine/Gemfile.lock +33 -0
  24. data/jasmine/HowToRelease.markdown +29 -0
  25. data/jasmine/MIT.LICENSE +20 -0
  26. data/jasmine/README.markdown +50 -0
  27. data/jasmine/Rakefile +166 -0
  28. data/jasmine/cruise_config.rb +21 -0
  29. data/jasmine/example/SpecRunner.html +27 -0
  30. data/jasmine/example/spec/PlayerSpec.js +58 -0
  31. data/jasmine/example/spec/SpecHelper.js +9 -0
  32. data/jasmine/example/src/Player.js +22 -0
  33. data/jasmine/example/src/Song.js +7 -0
  34. data/jasmine/images/jasmine_favicon.png +0 -0
  35. data/jasmine/jsdoc-template/allclasses.tmpl +17 -0
  36. data/jasmine/jsdoc-template/allfiles.tmpl +56 -0
  37. data/jasmine/jsdoc-template/class.tmpl +646 -0
  38. data/jasmine/jsdoc-template/index.tmpl +39 -0
  39. data/jasmine/jsdoc-template/publish.js +184 -0
  40. data/jasmine/jsdoc-template/static/default.css +162 -0
  41. data/jasmine/jsdoc-template/static/header.html +2 -0
  42. data/jasmine/jsdoc-template/static/index.html +19 -0
  43. data/jasmine/jsdoc-template/symbol.tmpl +35 -0
  44. data/jasmine/jshint/jshint.js +5919 -0
  45. data/jasmine/jshint/run.js +98 -0
  46. data/jasmine/lib/jasmine-html.js +190 -0
  47. data/jasmine/lib/jasmine.css +166 -0
  48. data/jasmine/lib/jasmine.js +2445 -0
  49. data/jasmine/lib/json2.js +478 -0
  50. data/jasmine/spec/node_suite.js +233 -0
  51. data/jasmine/spec/runner.html +82 -0
  52. data/jasmine/spec/suites/BaseSpec.js +27 -0
  53. data/jasmine/spec/suites/CustomMatchersSpec.js +97 -0
  54. data/jasmine/spec/suites/EnvSpec.js +158 -0
  55. data/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  56. data/jasmine/spec/suites/JsApiReporterSpec.js +103 -0
  57. data/jasmine/spec/suites/MatchersSpec.js +795 -0
  58. data/jasmine/spec/suites/MockClockSpec.js +38 -0
  59. data/jasmine/spec/suites/MultiReporterSpec.js +45 -0
  60. data/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  61. data/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  62. data/jasmine/spec/suites/QueueSpec.js +23 -0
  63. data/jasmine/spec/suites/ReporterSpec.js +56 -0
  64. data/jasmine/spec/suites/RunnerSpec.js +267 -0
  65. data/jasmine/spec/suites/SpecRunningSpec.js +1253 -0
  66. data/jasmine/spec/suites/SpecSpec.js +124 -0
  67. data/jasmine/spec/suites/SpySpec.js +201 -0
  68. data/jasmine/spec/suites/SuiteSpec.js +120 -0
  69. data/jasmine/spec/suites/TrivialConsoleReporterSpec.js +431 -0
  70. data/jasmine/spec/suites/TrivialReporterSpec.js +238 -0
  71. data/jasmine/spec/suites/UtilSpec.js +39 -0
  72. data/jasmine/spec/suites/WaitsForBlockSpec.js +118 -0
  73. data/jasmine/src/Block.js +22 -0
  74. data/jasmine/src/Env.js +264 -0
  75. data/jasmine/src/JsApiReporter.js +102 -0
  76. data/jasmine/src/Matchers.js +354 -0
  77. data/jasmine/src/MultiReporter.js +35 -0
  78. data/jasmine/src/NestedResults.js +80 -0
  79. data/jasmine/src/PrettyPrinter.js +123 -0
  80. data/jasmine/src/Queue.js +99 -0
  81. data/jasmine/src/Reporter.js +31 -0
  82. data/jasmine/src/Runner.js +77 -0
  83. data/jasmine/src/Spec.js +242 -0
  84. data/jasmine/src/Suite.js +82 -0
  85. data/jasmine/src/WaitsBlock.js +15 -0
  86. data/jasmine/src/WaitsForBlock.js +54 -0
  87. data/jasmine/src/base.js +608 -0
  88. data/jasmine/src/console/TrivialConsoleReporter.js +144 -0
  89. data/jasmine/src/html/TrivialReporter.js +190 -0
  90. data/jasmine/src/html/jasmine.css +166 -0
  91. data/jasmine/src/mock-timeout.js +183 -0
  92. data/jasmine/src/util.js +67 -0
  93. data/jasmine/src/version.json +5 -0
  94. data/jasmine.gemspec +52 -0
  95. data/lib/generators/jasmine/examples/USAGE +11 -0
  96. data/lib/generators/jasmine/examples/examples_generator.rb +19 -0
  97. data/lib/generators/jasmine/examples/templates/public/javascripts/jasmine_examples/Player.js +22 -0
  98. data/lib/generators/jasmine/examples/templates/public/javascripts/jasmine_examples/Song.js +7 -0
  99. data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/SpecHelper.js +9 -0
  100. data/lib/generators/jasmine/examples/templates/spec/javascripts/jasmine_examples/PlayerSpec.js +58 -0
  101. data/lib/generators/jasmine/install/USAGE +11 -0
  102. data/lib/generators/jasmine/install/install_generator.rb +18 -0
  103. data/lib/generators/jasmine/install/templates/spec/javascripts/helpers/.gitkeep +0 -0
  104. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +81 -0
  105. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine_config.rb +23 -0
  106. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine_runner.rb +20 -0
  107. data/lib/generators/jasmine/jasmine_generator.rb +32 -0
  108. data/lib/generators/jasmine/templates/INSTALL +9 -0
  109. data/lib/generators/jasmine/templates/lib/tasks/jasmine.rake +2 -0
  110. data/lib/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +81 -0
  111. data/lib/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +73 -0
  112. data/lib/generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb +23 -0
  113. data/lib/generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb +32 -0
  114. data/lib/jasmine/base.rb +66 -0
  115. data/lib/jasmine/command_line_tool.rb +72 -0
  116. data/lib/jasmine/config.rb +190 -0
  117. data/lib/jasmine/railtie.rb +20 -0
  118. data/lib/jasmine/run.html.erb +44 -0
  119. data/lib/jasmine/selenium_driver.rb +49 -0
  120. data/lib/jasmine/server.rb +106 -0
  121. data/lib/jasmine/spec_builder.rb +162 -0
  122. data/lib/jasmine/tasks/jasmine.rake +44 -0
  123. data/lib/jasmine/version.rb +3 -0
  124. data/lib/jasmine.rb +14 -0
  125. data/spec/config_spec.rb +308 -0
  126. data/spec/fixture/jasmine.erb.yml +4 -0
  127. data/spec/jasmine_command_line_tool_spec.rb +29 -0
  128. data/spec/jasmine_pojs_spec.rb +51 -0
  129. data/spec/jasmine_rails2_spec.rb +93 -0
  130. data/spec/jasmine_rails3_spec.rb +71 -0
  131. data/spec/jasmine_self_test_config.rb +15 -0
  132. data/spec/jasmine_self_test_spec.rb +24 -0
  133. data/spec/server_spec.rb +80 -0
  134. data/spec/spec_helper.rb +65 -0
  135. metadata +386 -0
@@ -0,0 +1,184 @@
1
+ /** Called automatically by JsDoc Toolkit. */
2
+ function publish(symbolSet) {
3
+ publish.conf = { // trailing slash expected for dirs
4
+ ext: ".html",
5
+ outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
6
+ templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/",
7
+ symbolsDir: "symbols/",
8
+ srcDir: "symbols/src/"
9
+ };
10
+
11
+ // is source output is suppressed, just display the links to the source file
12
+ if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
13
+ Link.prototype._makeSrcLink = function(srcFilePath) {
14
+ return "<"+srcFilePath+">";
15
+ }
16
+ }
17
+
18
+ // create the folders and subfolders to hold the output
19
+ IO.mkPath((publish.conf.outDir+"symbols/src").split("/"));
20
+
21
+ // used to allow Link to check the details of things being linked to
22
+ Link.symbolSet = symbolSet;
23
+
24
+ // create the required templates
25
+ try {
26
+ var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl");
27
+ var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl");
28
+ }
29
+ catch(e) {
30
+ print("Couldn't create the required templates: "+e);
31
+ quit();
32
+ }
33
+
34
+ // some ustility filters
35
+ function hasNoParent($) {return ($.memberOf == "")}
36
+ function isaFile($) {return ($.is("FILE"))}
37
+ function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)}
38
+
39
+ // get an array version of the symbolset, useful for filtering
40
+ var symbols = symbolSet.toArray();
41
+
42
+ // create the hilited source code files
43
+ var files = JSDOC.opt.srcFiles;
44
+ for (var i = 0, l = files.length; i < l; i++) {
45
+ var file = files[i];
46
+ var srcDir = publish.conf.outDir + "symbols/src/";
47
+ makeSrcFile(file, srcDir);
48
+ }
49
+
50
+ // get a list of all the classes in the symbolset
51
+ var classes = symbols.filter(isaClass).sort(makeSortby("alias"));
52
+
53
+ // create a class index, displayed in the left-hand column of every class page
54
+ Link.base = "../";
55
+ publish.classesIndex = classesTemplate.process(classes); // kept in memory
56
+
57
+ // create each of the class pages
58
+ for (var i = 0, l = classes.length; i < l; i++) {
59
+ var symbol = classes[i];
60
+
61
+ symbol.events = symbol.getEvents(); // 1 order matters
62
+ symbol.methods = symbol.getMethods(); // 2
63
+
64
+ var output = "";
65
+ output = classTemplate.process(symbol);
66
+
67
+ IO.saveFile(publish.conf.outDir+"symbols/", symbol.alias+publish.conf.ext, output);
68
+ }
69
+
70
+ // regenerate the index with different relative links, used in the index pages
71
+ Link.base = "";
72
+ publish.classesIndex = classesTemplate.process(classes);
73
+
74
+ // create the class index page
75
+ try {
76
+ var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl");
77
+ }
78
+ catch(e) { print(e.message); quit(); }
79
+
80
+ var classesIndex = classesindexTemplate.process(classes);
81
+ IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex);
82
+ classesindexTemplate = classesIndex = classes = null;
83
+
84
+ // create the file index page
85
+ try {
86
+ var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl");
87
+ }
88
+ catch(e) { print(e.message); quit(); }
89
+
90
+ var documentedFiles = symbols.filter(isaFile); // files that have file-level docs
91
+ var allFiles = []; // not all files have file-level docs, but we need to list every one
92
+
93
+ for (var i = 0; i < files.length; i++) {
94
+ allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */")));
95
+ }
96
+
97
+ for (var i = 0; i < documentedFiles.length; i++) {
98
+ var offset = files.indexOf(documentedFiles[i].alias);
99
+ allFiles[offset] = documentedFiles[i];
100
+ }
101
+
102
+ allFiles = allFiles.sort(makeSortby("name"));
103
+
104
+ // output the file index page
105
+ var filesIndex = fileindexTemplate.process(allFiles);
106
+ IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex);
107
+ fileindexTemplate = filesIndex = files = null;
108
+ }
109
+
110
+
111
+ /** Just the first sentence (up to a full stop). Should not break on dotted variable names. */
112
+ function summarize(desc) {
113
+ if (typeof desc != "undefined")
114
+ return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc;
115
+ }
116
+
117
+ /** Make a symbol sorter by some attribute. */
118
+ function makeSortby(attribute) {
119
+ return function(a, b) {
120
+ if (a[attribute] != undefined && b[attribute] != undefined) {
121
+ a = a[attribute].toLowerCase();
122
+ b = b[attribute].toLowerCase();
123
+ if (a < b) return -1;
124
+ if (a > b) return 1;
125
+ return 0;
126
+ }
127
+ }
128
+ }
129
+
130
+ /** Pull in the contents of an external file at the given path. */
131
+ function include(path) {
132
+ var path = publish.conf.templatesDir+path;
133
+ return IO.readFile(path);
134
+ }
135
+
136
+ /** Turn a raw source file into a code-hilited page in the docs. */
137
+ function makeSrcFile(path, srcDir, name) {
138
+ if (JSDOC.opt.s) return;
139
+
140
+ if (!name) {
141
+ name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_");
142
+ name = name.replace(/\:/g, "_");
143
+ }
144
+
145
+ var src = {path: path, name:name, charset: IO.encoding, hilited: ""};
146
+
147
+ if (defined(JSDOC.PluginManager)) {
148
+ JSDOC.PluginManager.run("onPublishSrc", src);
149
+ }
150
+
151
+ if (src.hilited) {
152
+ IO.saveFile(srcDir, name+publish.conf.ext, src.hilited);
153
+ }
154
+ }
155
+
156
+ /** Build output for displaying function parameters. */
157
+ function makeSignature(params) {
158
+ if (!params) return "()";
159
+ var signature = "("
160
+ +
161
+ params.filter(
162
+ function($) {
163
+ return $.name.indexOf(".") == -1; // don't show config params in signature
164
+ }
165
+ ).map(
166
+ function($) {
167
+ return $.name;
168
+ }
169
+ ).join(", ")
170
+ +
171
+ ")";
172
+ return signature;
173
+ }
174
+
175
+ /** Find symbol {@link ...} strings in text and turn into html links */
176
+ function resolveLinks(str, from) {
177
+ str = str.replace(/\{@link ([^} ]+) ?\}/gi,
178
+ function(match, symbolName) {
179
+ return new Link().toSymbol(symbolName);
180
+ }
181
+ );
182
+
183
+ return str;
184
+ }
@@ -0,0 +1,162 @@
1
+ /* default.css */
2
+ body
3
+ {
4
+ font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
5
+ width: 800px;
6
+ }
7
+
8
+ .header
9
+ {
10
+ clear: both;
11
+ background-color: #ccc;
12
+ padding: 8px;
13
+ }
14
+
15
+ h1
16
+ {
17
+ font-size: 150%;
18
+ font-weight: bold;
19
+ padding: 0;
20
+ margin: 1em 0 0 .3em;
21
+ }
22
+
23
+ hr
24
+ {
25
+ border: none 0;
26
+ border-top: 1px solid #7F8FB1;
27
+ height: 1px;
28
+ }
29
+
30
+ pre.code
31
+ {
32
+ display: block;
33
+ padding: 8px;
34
+ border: 1px dashed #ccc;
35
+ }
36
+
37
+ #index
38
+ {
39
+ margin-top: 24px;
40
+ float: left;
41
+ width: 160px;
42
+ position: absolute;
43
+ left: 8px;
44
+ background-color: #F3F3F3;
45
+ padding: 8px;
46
+ }
47
+
48
+ #content
49
+ {
50
+ margin-left: 190px;
51
+ width: 600px;
52
+ }
53
+
54
+ .classList
55
+ {
56
+ list-style-type: none;
57
+ padding: 0;
58
+ margin: 0 0 0 8px;
59
+ font-family: arial, sans-serif;
60
+ font-size: 1em;
61
+ overflow: auto;
62
+ }
63
+
64
+ .classList li
65
+ {
66
+ padding: 0;
67
+ margin: 0 0 8px 0;
68
+ }
69
+
70
+ .summaryTable { width: 100%; }
71
+
72
+ h1.classTitle
73
+ {
74
+ font-size:170%;
75
+ line-height:130%;
76
+ }
77
+
78
+ h2 { font-size: 110%; }
79
+ caption, div.sectionTitle
80
+ {
81
+ background-color: #7F8FB1;
82
+ color: #fff;
83
+ font-size:130%;
84
+ text-align: left;
85
+ padding: 2px 6px 2px 6px;
86
+ border: 1px #7F8FB1 solid;
87
+ }
88
+
89
+ div.sectionTitle { margin-bottom: 8px; }
90
+ .summaryTable thead { display: none; }
91
+
92
+ .summaryTable td
93
+ {
94
+ vertical-align: top;
95
+ padding: 4px;
96
+ border-bottom: 1px #7F8FB1 solid;
97
+ border-right: 1px #7F8FB1 solid;
98
+ }
99
+
100
+ /*col#summaryAttributes {}*/
101
+ .summaryTable td.attributes
102
+ {
103
+ border-left: 1px #7F8FB1 solid;
104
+ width: 140px;
105
+ text-align: right;
106
+ }
107
+
108
+ td.attributes, .fixedFont
109
+ {
110
+ line-height: 15px;
111
+ color: #002EBE;
112
+ font-family: "Courier New",Courier,monospace;
113
+ font-size: 13px;
114
+ }
115
+
116
+ .summaryTable td.nameDescription
117
+ {
118
+ text-align: left;
119
+ font-size: 13px;
120
+ line-height: 15px;
121
+ }
122
+
123
+ .summaryTable td.nameDescription, .description
124
+ {
125
+ line-height: 15px;
126
+ padding: 4px;
127
+ padding-left: 4px;
128
+ }
129
+
130
+ .summaryTable { margin-bottom: 8px; }
131
+
132
+ ul.inheritsList
133
+ {
134
+ list-style: square;
135
+ margin-left: 20px;
136
+ padding-left: 0;
137
+ }
138
+
139
+ .detailList {
140
+ margin-left: 20px;
141
+ line-height: 15px;
142
+ }
143
+ .detailList dt { margin-left: 20px; }
144
+
145
+ .detailList .heading
146
+ {
147
+ font-weight: bold;
148
+ padding-bottom: 6px;
149
+ margin-left: 0;
150
+ }
151
+
152
+ .light, td.attributes, .light a:link, .light a:visited
153
+ {
154
+ color: #777;
155
+ font-style: italic;
156
+ }
157
+
158
+ .fineprint
159
+ {
160
+ text-align: right;
161
+ font-size: 10px;
162
+ }
@@ -0,0 +1,2 @@
1
+ <div id="header">
2
+ </div>
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <title>Generated Javascript Documentation</title>
7
+ </head>
8
+ <frameset cols="20%,80%">
9
+ <frame src="allclasses-frame.html" name="packageFrame" />
10
+ <frame src="splash.html" name="classFrame" />
11
+ <noframes>
12
+ <body>
13
+ <p>
14
+ This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
15
+ </p>
16
+ </body>
17
+ </noframes>
18
+ </frameset>
19
+ </html>
@@ -0,0 +1,35 @@
1
+ <symbol alias="{+data.alias+}">
2
+ <name>{+data.name+}</name>
3
+ <memberOf>{+data.memberOf+}</memberOf>
4
+ <isStatic>{+data.isStatic+}</isStatic>
5
+ <isa>{+data.isa+}</isa>
6
+ <desc>{+data.desc+}</desc>
7
+ <classDesc>{+data.classDesc+}</classDesc>
8
+
9
+ <methods><for each="method" in="data.methods">
10
+ <method>
11
+ <name>{+method.name+}</name>
12
+ <memberOf>{+method.memberOf+}</memberOf>
13
+ <isStatic>{+method.isStatic+}</isStatic>
14
+ <desc>{+method.desc+}</desc>
15
+ <params><for each="param" in="method.params">
16
+ <param>
17
+ <type>{+param.type+}</type>
18
+ <name>{+param.name+}</name>
19
+ <desc>{+param.desc+}</desc>
20
+ <defaultValue>{+param.defaultValue+}</defaultValue>
21
+ </param></for>
22
+ </params>
23
+ </method></for>
24
+ </methods>
25
+
26
+ <properties><for each="property" in="data.properties">
27
+ <property>
28
+ <name>{+property.name+}</name>
29
+ <memberOf>{+property.memberOf+}</memberOf>
30
+ <isStatic>{+property.isStatic+}</isStatic>
31
+ <desc>{+property.desc+}</desc>
32
+ <type>{+property.type+}</type>
33
+ </property></for>
34
+ </properties>
35
+ </symbol>