jasnode 0.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.gitignore +1 -0
  2. data/.gitmodules +3 -0
  3. data/MIT.LICENSE +20 -0
  4. data/README.md +28 -0
  5. data/Rakefile +34 -0
  6. data/VERSION.yml +5 -0
  7. data/bin/jasnode +52 -0
  8. data/features/jasnode.feature +24 -0
  9. data/features/step_definitions/jasnode-steps.rb +39 -0
  10. data/jasmine/MIT.LICENSE +20 -0
  11. data/jasmine/README.markdown +502 -0
  12. data/jasmine/Rakefile +158 -0
  13. data/jasmine/cruise_config.rb +21 -0
  14. data/jasmine/doc/files.html +460 -0
  15. data/jasmine/doc/index.html +322 -0
  16. data/jasmine/doc/symbols/_global_.html +918 -0
  17. data/jasmine/doc/symbols/jasmine.Block.html +417 -0
  18. data/jasmine/doc/symbols/jasmine.Clock.html +678 -0
  19. data/jasmine/doc/symbols/jasmine.Env.html +1169 -0
  20. data/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
  21. data/jasmine/doc/symbols/jasmine.Matchers.html +1474 -0
  22. data/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
  23. data/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
  24. data/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
  25. data/jasmine/doc/symbols/jasmine.Runner.html +710 -0
  26. data/jasmine/doc/symbols/jasmine.Spec.html +1253 -0
  27. data/jasmine/doc/symbols/jasmine.Spy.html +855 -0
  28. data/jasmine/doc/symbols/jasmine.Suite.html +705 -0
  29. data/jasmine/doc/symbols/jasmine.html +1345 -0
  30. data/jasmine/doc/symbols/jasmine.util.html +535 -0
  31. data/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
  32. data/jasmine/doc/symbols/src/src_Block.js.html +29 -0
  33. data/jasmine/doc/symbols/src/src_Env.js.html +248 -0
  34. data/jasmine/doc/symbols/src/src_JsApiReporter.js.html +111 -0
  35. data/jasmine/doc/symbols/src/src_Matchers.js.html +344 -0
  36. data/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
  37. data/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
  38. data/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
  39. data/jasmine/doc/symbols/src/src_Queue.js.html +102 -0
  40. data/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
  41. data/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
  42. data/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
  43. data/jasmine/doc/symbols/src/src_Spec.js.html +214 -0
  44. data/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
  45. data/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
  46. data/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
  47. data/jasmine/doc/symbols/src/src_base.js.html +585 -0
  48. data/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
  49. data/jasmine/doc/symbols/src/src_util.js.html +75 -0
  50. data/jasmine/examples/html/example_runner.html +27 -0
  51. data/jasmine/examples/html/spec/example_suite.js +11 -0
  52. data/jasmine/examples/ruby/Rakefile +33 -0
  53. data/jasmine/examples/ruby/spec/example/example_spec.js +11 -0
  54. data/jasmine/examples/ruby/spec/jasmine_helper.rb +41 -0
  55. data/jasmine/examples/ruby/spec/jasmine_spec.rb +31 -0
  56. data/jasmine/examples/ruby/spec/saucelabs.yml +24 -0
  57. data/jasmine/geminstaller.yml +25 -0
  58. data/jasmine/images/fail-16.png +0 -0
  59. data/jasmine/images/fail.png +0 -0
  60. data/jasmine/images/go-16.png +0 -0
  61. data/jasmine/images/go.png +0 -0
  62. data/jasmine/images/pending-16.png +0 -0
  63. data/jasmine/images/pending.png +0 -0
  64. data/jasmine/images/question-bk.png +0 -0
  65. data/jasmine/images/questionbk-16.png +0 -0
  66. data/jasmine/images/spinner.gif +0 -0
  67. data/jasmine/lib/TrivialReporter.js +117 -0
  68. data/jasmine/lib/consolex.js +28 -0
  69. data/jasmine/lib/jasmine-0.10.2.js +2318 -0
  70. data/jasmine/lib/jasmine.css +86 -0
  71. data/jasmine/lib/json2.js +478 -0
  72. data/jasmine/spec/jasmine_helper.rb +44 -0
  73. data/jasmine/spec/jasmine_spec.rb +31 -0
  74. data/jasmine/spec/runner.html +79 -0
  75. data/jasmine/spec/saucelabs.yml +24 -0
  76. data/jasmine/spec/suites/CustomMatchersSpec.js +112 -0
  77. data/jasmine/spec/suites/EnvSpec.js +141 -0
  78. data/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  79. data/jasmine/spec/suites/JsApiReporterSpec.js +82 -0
  80. data/jasmine/spec/suites/MatchersSpec.js +709 -0
  81. data/jasmine/spec/suites/MockClockSpec.js +34 -0
  82. data/jasmine/spec/suites/MultiReporterSpec.js +30 -0
  83. data/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  84. data/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  85. data/jasmine/spec/suites/QueueSpec.js +23 -0
  86. data/jasmine/spec/suites/ReporterSpec.js +60 -0
  87. data/jasmine/spec/suites/RunnerSpec.js +252 -0
  88. data/jasmine/spec/suites/SpecRunningSpec.js +1086 -0
  89. data/jasmine/spec/suites/SpecSpec.js +110 -0
  90. data/jasmine/spec/suites/SpySpec.js +201 -0
  91. data/jasmine/spec/suites/SuiteSpec.js +101 -0
  92. data/jasmine/spec/suites/TrivialReporterSpec.js +140 -0
  93. data/jasmine/spec/suites/UtilSpec.js +40 -0
  94. data/jasmine/src/Block.js +22 -0
  95. data/jasmine/src/Env.js +240 -0
  96. data/jasmine/src/JsApiReporter.js +103 -0
  97. data/jasmine/src/Matchers.js +336 -0
  98. data/jasmine/src/MultiReporter.js +28 -0
  99. data/jasmine/src/NestedResults.js +80 -0
  100. data/jasmine/src/PrettyPrinter.js +122 -0
  101. data/jasmine/src/Queue.js +94 -0
  102. data/jasmine/src/Reporter.js +27 -0
  103. data/jasmine/src/Reporters.js +43 -0
  104. data/jasmine/src/Runner.js +68 -0
  105. data/jasmine/src/Spec.js +206 -0
  106. data/jasmine/src/Suite.js +70 -0
  107. data/jasmine/src/WaitsBlock.js +13 -0
  108. data/jasmine/src/WaitsForBlock.js +38 -0
  109. data/jasmine/src/base.js +578 -0
  110. data/jasmine/src/mock-timeout.js +177 -0
  111. data/jasmine/src/util.js +67 -0
  112. data/jasmine/src/version.json +5 -0
  113. data/jasnode.gemspec +171 -0
  114. data/lib/jasnode/core.rb +180 -0
  115. data/lib/jasnode.js +135 -0
  116. data/lib/jasnode.rb +4 -0
  117. data/pkg/jasnode-0.1.0.0.gem +0 -0
  118. data/spec/jasnode/jasnode_spec.rb +40 -0
  119. data/spec/rspec_suite.rb +8 -0
  120. data/spec/spec_helper.rb +6 -0
  121. data/templates/Rakefile +9 -0
  122. data/templates/bin/hello_world +5 -0
  123. data/templates/lib/server.js +25 -0
  124. data/templates/spec/README.md +3 -0
  125. data/templates/spec/runner.js +16 -0
  126. data/templates/spec/server/server_spec.js +45 -0
  127. data/templates/spec/server/spec_server.js +45 -0
  128. data/templates/spec/spec.js +45 -0
  129. metadata +184 -0
@@ -0,0 +1,177 @@
1
+ // Mock setTimeout, clearTimeout
2
+ // Contributed by Pivotal Computer Systems, www.pivotalsf.com
3
+
4
+ jasmine.FakeTimer = function() {
5
+ this.reset();
6
+
7
+ var self = this;
8
+ self.setTimeout = function(funcToCall, millis) {
9
+ self.timeoutsMade++;
10
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
11
+ return self.timeoutsMade;
12
+ };
13
+
14
+ self.setInterval = function(funcToCall, millis) {
15
+ self.timeoutsMade++;
16
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
17
+ return self.timeoutsMade;
18
+ };
19
+
20
+ self.clearTimeout = function(timeoutKey) {
21
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
22
+ };
23
+
24
+ self.clearInterval = function(timeoutKey) {
25
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
26
+ };
27
+
28
+ };
29
+
30
+ jasmine.FakeTimer.prototype.reset = function() {
31
+ this.timeoutsMade = 0;
32
+ this.scheduledFunctions = {};
33
+ this.nowMillis = 0;
34
+ };
35
+
36
+ jasmine.FakeTimer.prototype.tick = function(millis) {
37
+ var oldMillis = this.nowMillis;
38
+ var newMillis = oldMillis + millis;
39
+ this.runFunctionsWithinRange(oldMillis, newMillis);
40
+ this.nowMillis = newMillis;
41
+ };
42
+
43
+ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
44
+ var scheduledFunc;
45
+ var funcsToRun = [];
46
+ for (var timeoutKey in this.scheduledFunctions) {
47
+ scheduledFunc = this.scheduledFunctions[timeoutKey];
48
+ if (scheduledFunc != jasmine.undefined &&
49
+ scheduledFunc.runAtMillis >= oldMillis &&
50
+ scheduledFunc.runAtMillis <= nowMillis) {
51
+ funcsToRun.push(scheduledFunc);
52
+ this.scheduledFunctions[timeoutKey] = jasmine.undefined;
53
+ }
54
+ }
55
+
56
+ if (funcsToRun.length > 0) {
57
+ funcsToRun.sort(function(a, b) {
58
+ return a.runAtMillis - b.runAtMillis;
59
+ });
60
+ for (var i = 0; i < funcsToRun.length; ++i) {
61
+ try {
62
+ var funcToRun = funcsToRun[i];
63
+ this.nowMillis = funcToRun.runAtMillis;
64
+ funcToRun.funcToCall();
65
+ if (funcToRun.recurring) {
66
+ this.scheduleFunction(funcToRun.timeoutKey,
67
+ funcToRun.funcToCall,
68
+ funcToRun.millis,
69
+ true);
70
+ }
71
+ } catch(e) {
72
+ }
73
+ }
74
+ this.runFunctionsWithinRange(oldMillis, nowMillis);
75
+ }
76
+ };
77
+
78
+ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
79
+ this.scheduledFunctions[timeoutKey] = {
80
+ runAtMillis: this.nowMillis + millis,
81
+ funcToCall: funcToCall,
82
+ recurring: recurring,
83
+ timeoutKey: timeoutKey,
84
+ millis: millis
85
+ };
86
+ };
87
+
88
+ /**
89
+ * @namespace
90
+ */
91
+ jasmine.Clock = {
92
+ defaultFakeTimer: new jasmine.FakeTimer(),
93
+
94
+ reset: function() {
95
+ jasmine.Clock.assertInstalled();
96
+ jasmine.Clock.defaultFakeTimer.reset();
97
+ },
98
+
99
+ tick: function(millis) {
100
+ jasmine.Clock.assertInstalled();
101
+ jasmine.Clock.defaultFakeTimer.tick(millis);
102
+ },
103
+
104
+ runFunctionsWithinRange: function(oldMillis, nowMillis) {
105
+ jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
106
+ },
107
+
108
+ scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
109
+ jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
110
+ },
111
+
112
+ useMock: function() {
113
+ var spec = jasmine.getEnv().currentSpec;
114
+ spec.after(jasmine.Clock.uninstallMock);
115
+
116
+ jasmine.Clock.installMock();
117
+ },
118
+
119
+ installMock: function() {
120
+ jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
121
+ },
122
+
123
+ uninstallMock: function() {
124
+ jasmine.Clock.assertInstalled();
125
+ jasmine.Clock.installed = jasmine.Clock.real;
126
+ },
127
+
128
+ real: {
129
+ setTimeout: window.setTimeout,
130
+ clearTimeout: window.clearTimeout,
131
+ setInterval: window.setInterval,
132
+ clearInterval: window.clearInterval
133
+ },
134
+
135
+ assertInstalled: function() {
136
+ if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
137
+ throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
138
+ }
139
+ },
140
+
141
+ installed: null
142
+ };
143
+ jasmine.Clock.installed = jasmine.Clock.real;
144
+
145
+ //else for IE support
146
+ window.setTimeout = function(funcToCall, millis) {
147
+ if (jasmine.Clock.installed.setTimeout.apply) {
148
+ return jasmine.Clock.installed.setTimeout.apply(this, arguments);
149
+ } else {
150
+ return jasmine.Clock.installed.setTimeout(funcToCall, millis);
151
+ }
152
+ };
153
+
154
+ window.setInterval = function(funcToCall, millis) {
155
+ if (jasmine.Clock.installed.setInterval.apply) {
156
+ return jasmine.Clock.installed.setInterval.apply(this, arguments);
157
+ } else {
158
+ return jasmine.Clock.installed.setInterval(funcToCall, millis);
159
+ }
160
+ };
161
+
162
+ window.clearTimeout = function(timeoutKey) {
163
+ if (jasmine.Clock.installed.clearTimeout.apply) {
164
+ return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
165
+ } else {
166
+ return jasmine.Clock.installed.clearTimeout(timeoutKey);
167
+ }
168
+ };
169
+
170
+ window.clearInterval = function(timeoutKey) {
171
+ if (jasmine.Clock.installed.clearTimeout.apply) {
172
+ return jasmine.Clock.installed.clearInterval.apply(this, arguments);
173
+ } else {
174
+ return jasmine.Clock.installed.clearInterval(timeoutKey);
175
+ }
176
+ };
177
+
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @namespace
3
+ */
4
+ jasmine.util = {};
5
+
6
+ /**
7
+ * Declare that a child class inherit it's prototype from the parent class.
8
+ *
9
+ * @private
10
+ * @param {Function} childClass
11
+ * @param {Function} parentClass
12
+ */
13
+ jasmine.util.inherit = function(childClass, parentClass) {
14
+ /**
15
+ * @private
16
+ */
17
+ var subclass = function() {
18
+ };
19
+ subclass.prototype = parentClass.prototype;
20
+ childClass.prototype = new subclass;
21
+ };
22
+
23
+ jasmine.util.formatException = function(e) {
24
+ var lineNumber;
25
+ if (e.line) {
26
+ lineNumber = e.line;
27
+ }
28
+ else if (e.lineNumber) {
29
+ lineNumber = e.lineNumber;
30
+ }
31
+
32
+ var file;
33
+
34
+ if (e.sourceURL) {
35
+ file = e.sourceURL;
36
+ }
37
+ else if (e.fileName) {
38
+ file = e.fileName;
39
+ }
40
+
41
+ var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
42
+
43
+ if (file && lineNumber) {
44
+ message += ' in ' + file + ' (line ' + lineNumber + ')';
45
+ }
46
+
47
+ return message;
48
+ };
49
+
50
+ jasmine.util.htmlEscape = function(str) {
51
+ if (!str) return str;
52
+ return str.replace(/&/g, '&amp;')
53
+ .replace(/</g, '&lt;')
54
+ .replace(/>/g, '&gt;');
55
+ };
56
+
57
+ jasmine.util.argsToArray = function(args) {
58
+ var arrayOfArgs = [];
59
+ for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
60
+ return arrayOfArgs;
61
+ };
62
+
63
+ jasmine.util.extend = function(destination, source) {
64
+ for (var property in source) destination[property] = source[property];
65
+ return destination;
66
+ };
67
+
@@ -0,0 +1,5 @@
1
+ {
2
+ "major": 0,
3
+ "minor": 10,
4
+ "build": 2
5
+ }
data/jasnode.gemspec ADDED
@@ -0,0 +1,171 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{jasnode}
8
+ s.version = "0.2.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Cory Ondrejka"]
12
+ s.date = %q{2010-03-30}
13
+ s.default_executable = %q{jasnode}
14
+ s.description = %q{Easy Jasmine BDD with Node.js}
15
+ s.email = %q{cory.ondrejka+jasnode@gmail.com}
16
+ s.executables = ["jasnode"]
17
+ s.extra_rdoc_files = [
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ ".gitmodules",
23
+ "MIT.LICENSE",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION.yml",
27
+ "bin/jasnode",
28
+ "features/jasnode.feature",
29
+ "features/step_definitions/jasnode-steps.rb",
30
+ "jasmine/MIT.LICENSE",
31
+ "jasmine/README.markdown",
32
+ "jasmine/Rakefile",
33
+ "jasmine/cruise_config.rb",
34
+ "jasmine/doc/files.html",
35
+ "jasmine/doc/index.html",
36
+ "jasmine/doc/symbols/_global_.html",
37
+ "jasmine/doc/symbols/jasmine.Block.html",
38
+ "jasmine/doc/symbols/jasmine.Clock.html",
39
+ "jasmine/doc/symbols/jasmine.Env.html",
40
+ "jasmine/doc/symbols/jasmine.JsApiReporter.html",
41
+ "jasmine/doc/symbols/jasmine.Matchers.html",
42
+ "jasmine/doc/symbols/jasmine.MultiReporter.html",
43
+ "jasmine/doc/symbols/jasmine.NestedResults.html",
44
+ "jasmine/doc/symbols/jasmine.Reporter.html",
45
+ "jasmine/doc/symbols/jasmine.Runner.html",
46
+ "jasmine/doc/symbols/jasmine.Spec.html",
47
+ "jasmine/doc/symbols/jasmine.Spy.html",
48
+ "jasmine/doc/symbols/jasmine.Suite.html",
49
+ "jasmine/doc/symbols/jasmine.html",
50
+ "jasmine/doc/symbols/jasmine.util.html",
51
+ "jasmine/doc/symbols/src/lib_TrivialReporter.js.html",
52
+ "jasmine/doc/symbols/src/src_Block.js.html",
53
+ "jasmine/doc/symbols/src/src_Env.js.html",
54
+ "jasmine/doc/symbols/src/src_JsApiReporter.js.html",
55
+ "jasmine/doc/symbols/src/src_Matchers.js.html",
56
+ "jasmine/doc/symbols/src/src_MultiReporter.js.html",
57
+ "jasmine/doc/symbols/src/src_NestedResults.js.html",
58
+ "jasmine/doc/symbols/src/src_PrettyPrinter.js.html",
59
+ "jasmine/doc/symbols/src/src_Queue.js.html",
60
+ "jasmine/doc/symbols/src/src_Reporter.js.html",
61
+ "jasmine/doc/symbols/src/src_Reporters.js.html",
62
+ "jasmine/doc/symbols/src/src_Runner.js.html",
63
+ "jasmine/doc/symbols/src/src_Spec.js.html",
64
+ "jasmine/doc/symbols/src/src_Suite.js.html",
65
+ "jasmine/doc/symbols/src/src_WaitsBlock.js.html",
66
+ "jasmine/doc/symbols/src/src_WaitsForBlock.js.html",
67
+ "jasmine/doc/symbols/src/src_base.js.html",
68
+ "jasmine/doc/symbols/src/src_mock-timeout.js.html",
69
+ "jasmine/doc/symbols/src/src_util.js.html",
70
+ "jasmine/examples/html/example_runner.html",
71
+ "jasmine/examples/html/spec/example_suite.js",
72
+ "jasmine/examples/ruby/Rakefile",
73
+ "jasmine/examples/ruby/spec/example/example_spec.js",
74
+ "jasmine/examples/ruby/spec/jasmine_helper.rb",
75
+ "jasmine/examples/ruby/spec/jasmine_spec.rb",
76
+ "jasmine/examples/ruby/spec/saucelabs.yml",
77
+ "jasmine/geminstaller.yml",
78
+ "jasmine/images/fail-16.png",
79
+ "jasmine/images/fail.png",
80
+ "jasmine/images/go-16.png",
81
+ "jasmine/images/go.png",
82
+ "jasmine/images/pending-16.png",
83
+ "jasmine/images/pending.png",
84
+ "jasmine/images/question-bk.png",
85
+ "jasmine/images/questionbk-16.png",
86
+ "jasmine/images/spinner.gif",
87
+ "jasmine/lib/TrivialReporter.js",
88
+ "jasmine/lib/consolex.js",
89
+ "jasmine/lib/jasmine-0.10.2.js",
90
+ "jasmine/lib/jasmine.css",
91
+ "jasmine/lib/json2.js",
92
+ "jasmine/spec/jasmine_helper.rb",
93
+ "jasmine/spec/jasmine_spec.rb",
94
+ "jasmine/spec/runner.html",
95
+ "jasmine/spec/saucelabs.yml",
96
+ "jasmine/spec/suites/CustomMatchersSpec.js",
97
+ "jasmine/spec/suites/EnvSpec.js",
98
+ "jasmine/spec/suites/ExceptionsSpec.js",
99
+ "jasmine/spec/suites/JsApiReporterSpec.js",
100
+ "jasmine/spec/suites/MatchersSpec.js",
101
+ "jasmine/spec/suites/MockClockSpec.js",
102
+ "jasmine/spec/suites/MultiReporterSpec.js",
103
+ "jasmine/spec/suites/NestedResultsSpec.js",
104
+ "jasmine/spec/suites/PrettyPrintSpec.js",
105
+ "jasmine/spec/suites/QueueSpec.js",
106
+ "jasmine/spec/suites/ReporterSpec.js",
107
+ "jasmine/spec/suites/RunnerSpec.js",
108
+ "jasmine/spec/suites/SpecRunningSpec.js",
109
+ "jasmine/spec/suites/SpecSpec.js",
110
+ "jasmine/spec/suites/SpySpec.js",
111
+ "jasmine/spec/suites/SuiteSpec.js",
112
+ "jasmine/spec/suites/TrivialReporterSpec.js",
113
+ "jasmine/spec/suites/UtilSpec.js",
114
+ "jasmine/src/Block.js",
115
+ "jasmine/src/Env.js",
116
+ "jasmine/src/JsApiReporter.js",
117
+ "jasmine/src/Matchers.js",
118
+ "jasmine/src/MultiReporter.js",
119
+ "jasmine/src/NestedResults.js",
120
+ "jasmine/src/PrettyPrinter.js",
121
+ "jasmine/src/Queue.js",
122
+ "jasmine/src/Reporter.js",
123
+ "jasmine/src/Reporters.js",
124
+ "jasmine/src/Runner.js",
125
+ "jasmine/src/Spec.js",
126
+ "jasmine/src/Suite.js",
127
+ "jasmine/src/WaitsBlock.js",
128
+ "jasmine/src/WaitsForBlock.js",
129
+ "jasmine/src/base.js",
130
+ "jasmine/src/mock-timeout.js",
131
+ "jasmine/src/util.js",
132
+ "jasmine/src/version.json",
133
+ "jasnode.gemspec",
134
+ "lib/jasnode.js",
135
+ "lib/jasnode.rb",
136
+ "lib/jasnode/core.rb",
137
+ "pkg/jasnode-0.1.0.0.gem",
138
+ "spec/jasnode/jasnode_spec.rb",
139
+ "spec/rspec_suite.rb",
140
+ "spec/spec_helper.rb",
141
+ "templates/Rakefile",
142
+ "templates/bin/hello_world",
143
+ "templates/lib/server.js",
144
+ "templates/spec/README.md",
145
+ "templates/spec/runner.js",
146
+ "templates/spec/server/server_spec.js",
147
+ "templates/spec/server/spec_server.js",
148
+ "templates/spec/spec.js"
149
+ ]
150
+ s.homepage = %q{http://angrybits.github.com/jasnode}
151
+ s.rdoc_options = ["--charset=UTF-8"]
152
+ s.require_paths = ["lib"]
153
+ s.rubygems_version = %q{1.3.5}
154
+ s.summary = %q{Jasmine Ruby Runner}
155
+ s.test_files = [
156
+ "spec/jasnode/jasnode_spec.rb",
157
+ "spec/rspec_suite.rb",
158
+ "spec/spec_helper.rb"
159
+ ]
160
+
161
+ if s.respond_to? :specification_version then
162
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
163
+ s.specification_version = 3
164
+
165
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
166
+ else
167
+ end
168
+ else
169
+ end
170
+ end
171
+
@@ -0,0 +1,180 @@
1
+ # Copyright (c) 2010 Cory Ondrejka. All rights reserved.
2
+ # See MIT.LICENSE for licensing details.
3
+
4
+ module Jasnode
5
+ class Spec
6
+ def self.find_specs(root_dir)
7
+ dir = File.join(root_dir, "**", "*_spec.js")
8
+ files = Dir[dir]
9
+ dir = File.join(root_dir, "**", "spec.js")
10
+ files += Dir[dir]
11
+ dir = File.join(root_dir, "**", "spec_*.js")
12
+ files += Dir[dir]
13
+ files.uniq
14
+ end
15
+
16
+ def self.find_jasmine
17
+ dir = File.join(File.dirname(__FILE__),"..","..","jasmine","**","jasmine-*.js")
18
+ Dir[dir]
19
+ end
20
+
21
+ def self.build_jasmine_test_file(jasmine, specs, verbose)
22
+ spec_list = ""
23
+ specs.each do |spec|
24
+ spec_list += " process.compile(fs.readFileSync('#{spec}'), '#{spec}');\n"
25
+ end
26
+ <<-eos
27
+ // This file is autogenerated by jasnode
28
+ // It was inspired by node-jasmine (c) 2010 Adam Abrons and Misko Hevery http://getangular.com
29
+ // Copyright (c) 2010 Cory Ondrejka. All rights reserved.
30
+ // See MIT.LICENSE for licensing details.
31
+
32
+ var fs = require('fs');
33
+ var sys = require('sys');
34
+
35
+ var filename = '#{jasmine}';
36
+ var src = fs.readFileSync(filename);
37
+
38
+ // give jasmine values to bind
39
+ global.window = {
40
+ setTimeout: setTimeout,
41
+ clearTimeout: clearTimeout,
42
+ setInterval: setInterval,
43
+ clearInterval: clearInterval
44
+ };
45
+
46
+ var jasmine = process.compile(src + '\\njasmine;', filename);
47
+
48
+ delete global.window;
49
+
50
+ jasmine.run_specs = function() {
51
+ var log = [];
52
+ var columnCounter = 0;
53
+ var verbose = #{verbose};
54
+
55
+ // process in specs collected by jasnode
56
+ #{spec_list}
57
+
58
+ // override jasmine reporter base class
59
+ var jasmineEnv = jasmine.getEnv();
60
+ jasmineEnv.reporter = {
61
+ log: function(str){
62
+ },
63
+
64
+ reportRunnerStarting: function(runner) {
65
+ date = new Date();
66
+ sys.puts('Starting spec run at ' + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
67
+ start = date.getTime();
68
+ },
69
+
70
+ reportSuiteResults: function(suite) {
71
+ var spec_results = suite.results();
72
+ var path = [];
73
+ while(suite) {
74
+ path.unshift(suite.description);
75
+ suite = suite.parentSuite;
76
+ }
77
+ var description = path.join(' -> ');
78
+
79
+ spec_results.items_.forEach(function(spec){
80
+ if (spec.failedCount > 0 && spec.description) {
81
+ log.push(description + '\\n');
82
+ log.push(' it ' + spec.description + '\\n');
83
+ spec.items_.forEach(function(result){
84
+ log.push(' ' + result.trace.stack + '\\n');
85
+ });
86
+ }
87
+ });
88
+ },
89
+
90
+ reportSpecResults: function(spec) {
91
+ sys.print(spec.results().failedCount ? "F" : ".");
92
+ if (columnCounter++ < 50) return;
93
+ columnCounter = 0;
94
+ sys.print('\\n');
95
+ },
96
+
97
+ reportRunnerResults: function(runner) {
98
+ elapsed = (Number(new Date) - start) / 1000;
99
+ sys.puts('\\n');
100
+ if (verbose)
101
+ log.forEach(function(log){ sys.puts(log); });
102
+
103
+ sys.puts('\\n');
104
+ sys.puts('Finished in ' + elapsed + ' seconds');
105
+ sys.puts(jasmine.results(runner));
106
+ process.exit(runner.results().failedCount);
107
+ }
108
+ };
109
+ jasmineEnv.execute();
110
+ };
111
+
112
+ // print out the results
113
+ jasmine.results = function(runner){
114
+ var results = runner.results();
115
+ var suites = runner.suites();
116
+ var msg = '';
117
+ msg += "\\033[1m" + results.totalCount + ' example' + ((results.totalCount === 1) ? '' : 's') + '\\033[22m, ';
118
+ if (0 == results.failedCount)
119
+ msg += "\\033[32m" + results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\\033[39m\\n';
120
+ else
121
+ msg += "\\033[31m" + results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\\033[39m\\n';
122
+ return msg;
123
+ };
124
+
125
+ // create a busy wait to allow for async testing
126
+ jasmine.async_spec_wait = function() {
127
+ var wait = jasmine.async_spec_wait;
128
+ wait.start = new Date().getTime();
129
+ wait.done = false;
130
+ (function inner_wait(){
131
+ waits(10);
132
+ runs(function() {
133
+ if (wait.start + wait.timeout < new Date().getTime()) {
134
+ expect('timeout waiting for spec').toBeNull();
135
+ } else if (wait.done) {
136
+ wait.done = false;
137
+ } else {
138
+ inner_wait();
139
+ }
140
+ });
141
+ })();
142
+ };
143
+
144
+ // timeout after 10 seconds of waiting
145
+ jasmine.async_spec_wait.timeout = 10 * 1000;
146
+
147
+ jasmine.async_spec_done = function() {
148
+ jasmine.async_spec_wait.done = true;
149
+ };
150
+
151
+ // make sure all the jasmine methods are available
152
+ for ( var key in jasmine) {
153
+ exports[key] = jasmine[key];
154
+ }
155
+ eos
156
+ end
157
+
158
+ def self.spec(verbose, logfile)
159
+ File.open(File.join("lib", "jasnode.js"), "w") {|f| f.write(Jasnode::Spec.build_jasmine_test_file(Jasnode::Spec.find_jasmine, Jasnode::Spec.find_specs(Dir.pwd), true)) }
160
+ Dir.chdir("spec")
161
+ output = ""
162
+ if logfile
163
+ output = %x[node runner.js > #{logfile}]
164
+ else
165
+ putput = puts %x[node runner.js]
166
+ end
167
+ Dir.chdir("..")
168
+ output
169
+ end
170
+ end
171
+
172
+ class Init
173
+ def self.template(projectname)
174
+ require "ftools"
175
+ template_base = File.join(File.dirname(__FILE__), '..', '..', 'templates')
176
+ File.makedirs("#{projectname}")
177
+ FileUtils.cp_r("#{template_base}/.", "#{projectname}")
178
+ end
179
+ end
180
+ end