js-test-driver-rails 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +5 -0
  2. data/.gitmodules +6 -0
  3. data/Gemfile +2 -5
  4. data/Gemfile.lock +8 -9
  5. data/Rakefile +3 -28
  6. data/js-test-driver-rails.gemspec +25 -0
  7. data/lib/js_test_driver/version.rb +3 -0
  8. metadata +17 -183
  9. data/VERSION +0 -1
  10. data/vendor/jasmine-jstd-adapter/MIT.LICENSE +0 -22
  11. data/vendor/jasmine-jstd-adapter/README.md +0 -25
  12. data/vendor/jasmine-jstd-adapter/jsTestDriver.conf +0 -6
  13. data/vendor/jasmine-jstd-adapter/jsTestDriverIit.conf +0 -6
  14. data/vendor/jasmine-jstd-adapter/lib/jasmine/jasmine-0.11.1.js +0 -2343
  15. data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
  16. data/vendor/jasmine-jstd-adapter/server.sh +0 -1
  17. data/vendor/jasmine-jstd-adapter/src-test/iit/iitSpec.js +0 -46
  18. data/vendor/jasmine-jstd-adapter/src-test/tests.js +0 -89
  19. data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +0 -186
  20. data/vendor/jasmine-jstd-adapter/test-iit.sh +0 -1
  21. data/vendor/jasmine-jstd-adapter/test-regular.sh +0 -2
  22. data/vendor/jasmine-jstd-adapter/test.sh +0 -2
  23. data/vendor/jasmine/Gemfile +0 -6
  24. data/vendor/jasmine/MIT.LICENSE +0 -20
  25. data/vendor/jasmine/README.markdown +0 -28
  26. data/vendor/jasmine/Rakefile +0 -182
  27. data/vendor/jasmine/cruise_config.rb +0 -21
  28. data/vendor/jasmine/example/SpecRunner.html +0 -27
  29. data/vendor/jasmine/example/spec/PlayerSpec.js +0 -58
  30. data/vendor/jasmine/example/spec/SpecHelper.js +0 -9
  31. data/vendor/jasmine/example/src/Player.js +0 -22
  32. data/vendor/jasmine/example/src/Song.js +0 -7
  33. data/vendor/jasmine/images/fail-16.png +0 -0
  34. data/vendor/jasmine/images/fail.png +0 -0
  35. data/vendor/jasmine/images/go-16.png +0 -0
  36. data/vendor/jasmine/images/go.png +0 -0
  37. data/vendor/jasmine/images/pending-16.png +0 -0
  38. data/vendor/jasmine/images/pending.png +0 -0
  39. data/vendor/jasmine/images/question-bk.png +0 -0
  40. data/vendor/jasmine/images/questionbk-16.png +0 -0
  41. data/vendor/jasmine/images/spinner.gif +0 -0
  42. data/vendor/jasmine/jsdoc-template/allclasses.tmpl +0 -17
  43. data/vendor/jasmine/jsdoc-template/allfiles.tmpl +0 -56
  44. data/vendor/jasmine/jsdoc-template/class.tmpl +0 -646
  45. data/vendor/jasmine/jsdoc-template/index.tmpl +0 -39
  46. data/vendor/jasmine/jsdoc-template/publish.js +0 -184
  47. data/vendor/jasmine/jsdoc-template/static/default.css +0 -162
  48. data/vendor/jasmine/jsdoc-template/static/header.html +0 -2
  49. data/vendor/jasmine/jsdoc-template/static/index.html +0 -19
  50. data/vendor/jasmine/jsdoc-template/symbol.tmpl +0 -35
  51. data/vendor/jasmine/lib/jasmine-html.js +0 -188
  52. data/vendor/jasmine/lib/jasmine.css +0 -166
  53. data/vendor/jasmine/lib/jasmine.js +0 -2421
  54. data/vendor/jasmine/lib/json2.js +0 -478
  55. data/vendor/jasmine/spec/runner.html +0 -80
  56. data/vendor/jasmine/spec/suites/BaseSpec.js +0 -27
  57. data/vendor/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
  58. data/vendor/jasmine/spec/suites/EnvSpec.js +0 -158
  59. data/vendor/jasmine/spec/suites/ExceptionsSpec.js +0 -107
  60. data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
  61. data/vendor/jasmine/spec/suites/MatchersSpec.js +0 -795
  62. data/vendor/jasmine/spec/suites/MockClockSpec.js +0 -38
  63. data/vendor/jasmine/spec/suites/MultiReporterSpec.js +0 -45
  64. data/vendor/jasmine/spec/suites/NestedResultsSpec.js +0 -54
  65. data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
  66. data/vendor/jasmine/spec/suites/QueueSpec.js +0 -23
  67. data/vendor/jasmine/spec/suites/ReporterSpec.js +0 -56
  68. data/vendor/jasmine/spec/suites/RunnerSpec.js +0 -267
  69. data/vendor/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
  70. data/vendor/jasmine/spec/suites/SpecSpec.js +0 -124
  71. data/vendor/jasmine/spec/suites/SpySpec.js +0 -201
  72. data/vendor/jasmine/spec/suites/SuiteSpec.js +0 -120
  73. data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
  74. data/vendor/jasmine/spec/suites/UtilSpec.js +0 -40
  75. data/vendor/jasmine/spec/suites/WaitsForBlockSpec.js +0 -87
  76. data/vendor/jasmine/src/Block.js +0 -22
  77. data/vendor/jasmine/src/Env.js +0 -264
  78. data/vendor/jasmine/src/JsApiReporter.js +0 -102
  79. data/vendor/jasmine/src/Matchers.js +0 -354
  80. data/vendor/jasmine/src/MultiReporter.js +0 -35
  81. data/vendor/jasmine/src/NestedResults.js +0 -80
  82. data/vendor/jasmine/src/PrettyPrinter.js +0 -122
  83. data/vendor/jasmine/src/Queue.js +0 -99
  84. data/vendor/jasmine/src/Reporter.js +0 -31
  85. data/vendor/jasmine/src/Runner.js +0 -77
  86. data/vendor/jasmine/src/Spec.js +0 -242
  87. data/vendor/jasmine/src/Suite.js +0 -82
  88. data/vendor/jasmine/src/WaitsBlock.js +0 -13
  89. data/vendor/jasmine/src/WaitsForBlock.js +0 -52
  90. data/vendor/jasmine/src/base.js +0 -589
  91. data/vendor/jasmine/src/html/TrivialReporter.js +0 -188
  92. data/vendor/jasmine/src/html/jasmine.css +0 -166
  93. data/vendor/jasmine/src/mock-timeout.js +0 -183
  94. data/vendor/jasmine/src/util.js +0 -67
  95. data/vendor/jasmine/src/version.json +0 -5
@@ -1 +0,0 @@
1
- java -jar lib/jstestdriver/JsTestDriver.jar --port 9876 --runnerMode DEBUG
@@ -1,46 +0,0 @@
1
- (function() {
2
- var specs = [];
3
-
4
-
5
- describe('root describe', function() {
6
- it('nested it', function() {
7
- specs.push('nested it');
8
- });
9
- });
10
-
11
-
12
- describe('root describe with iit', function() {
13
- it('it as iit sibling', function() {
14
- specs.push('it as iit sibling');
15
- });
16
-
17
- iit('nested iit', function() {
18
- specs.push('nested iit');
19
- });
20
- });
21
-
22
-
23
- describe('describe that follows iit with a nested it', function() {
24
- it('nested it after iit', function() {
25
- specs.push('nested it after iit');
26
- });
27
- });
28
-
29
-
30
- describe('describe with iit followed by it', function() {
31
- iit('iit that preceeds an it', function() {
32
- specs.push('iit that preceeds an it');
33
- });
34
-
35
- it('it that follows an iit', function() {
36
- specs.push('it that follows an iit');
37
- });
38
- });
39
-
40
-
41
- describe('test summary', function() {
42
- iit('should have executed all iit tests and nothing else', function() {
43
- expect(specs).toEqual(['nested iit', 'iit that preceeds an it']);
44
- });
45
- });
46
- })();
@@ -1,89 +0,0 @@
1
- (function(){
2
- var depth;
3
-
4
- beforeEach(function(){
5
- depth = 1;
6
- });
7
-
8
- afterEach(function(){
9
- expect(depth).toEqual(1);
10
- });
11
-
12
- describe('describe', function(){
13
- beforeEach(function(){
14
- depth ++;
15
- });
16
-
17
- afterEach(function(){
18
- depth--;
19
- });
20
-
21
- it('should map it', function(){
22
- expect(depth).toEqual(2);
23
- });
24
-
25
- describe('nested', function(){
26
- beforeEach(function(){
27
- depth ++;
28
- });
29
-
30
- afterEach(function(){
31
- depth--;
32
- });
33
-
34
- it('should exectue nested', function(){
35
- expect(depth).toEqual(3);
36
- });
37
- });
38
- });
39
-
40
- describe("matchers", function(){
41
-
42
- beforeEach(function(){
43
- this.addMatchers({
44
- toBePersonNamed: function(name){
45
- return this.actual == name;
46
- }
47
- });
48
- });
49
-
50
- it('should work across multiple tests', function(){
51
- expect('misko').toBePersonNamed('misko');
52
- });
53
-
54
- it('should allow a creation of new matcher', function(){
55
- this.addMatchers({
56
- toBeMe: function(arg){
57
- return this.actual == 'misko';
58
- }
59
- });
60
- this.addMatchers({
61
- toBeMe2: function(arg){
62
- return this.actual == 'misko';
63
- }
64
- });
65
- expect('misko').toBeMe();
66
- expect('misko').toBeMe2();
67
- expect('adam').toBePersonNamed('adam');
68
- });
69
- });
70
-
71
- describe('runs', function(){
72
- it('should execute a runs block', function(){
73
- runs(function(){
74
- this.runsFunction = function(){
75
- return true;
76
- };
77
- spyOn(this, 'runsFunction');
78
- });
79
-
80
- runs(function(){
81
- this.runsFunction();
82
- });
83
-
84
- runs(function(){
85
- expect(this.runsFunction).toHaveBeenCalled();
86
- });
87
- });
88
- });
89
- })();
@@ -1,186 +0,0 @@
1
- /**
2
- * @fileoverview Jasmine JsTestDriver Adapter.
3
- * @author misko@hevery.com (Misko Hevery)
4
- */
5
- (function(window) {
6
- var rootDescribes = new Describes(window);
7
- var describePath = [];
8
- rootDescribes.collectMode();
9
-
10
- var jasmineTest = TestCase('Jasmine Adapter Tests', null, 'jasmine test case');
11
-
12
- var jasminePlugin = {
13
- name:'jasmine',
14
- runTestConfiguration: function(testRunConfiguration, onTestDone, onTestRunConfigurationComplete){
15
- if (testRunConfiguration.testCaseInfo_.template_ !== jasmineTest) return;
16
-
17
- var jasmineEnv = jasmine.currentEnv_ = new jasmine.Env();
18
- rootDescribes.playback();
19
- var specLog = jstestdriver.console.log_ = [];
20
- var start;
21
- jasmineEnv.specFilter = function(spec) {
22
- return rootDescribes.isExclusive(spec);
23
- };
24
- jasmineEnv.reporter = {
25
- log: function(str){
26
- specLog.push(str);
27
- },
28
-
29
- reportRunnerStarting: function(runner) { },
30
-
31
- reportSpecStarting: function(spec) {
32
- specLog = jstestdriver.console.log_ = [];
33
- start = new Date().getTime();
34
- },
35
-
36
- reportSpecResults: function(spec) {
37
- var suite = spec.suite;
38
- var results = spec.results();
39
- if (results.skipped) return;
40
- var end = new Date().getTime();
41
- var messages = [];
42
- var resultItems = results.getItems();
43
- var state = 'passed';
44
- for ( var i = 0; i < resultItems.length; i++) {
45
- if (!resultItems[i].passed()) {
46
- state = resultItems[i].message.match(/AssertionError:/) ? 'error' : 'failed';
47
- messages.push({
48
- message: resultItems[i].toString(),
49
- name: resultItems[i].trace.name,
50
- stack: formatStack(resultItems[i].trace.stack)
51
- });
52
- }
53
- }
54
- onTestDone(
55
- new jstestdriver.TestResult(
56
- suite.getFullName(),
57
- spec.description,
58
- state,
59
- jstestdriver.angular.toJson(messages),
60
- specLog.join('\n'),
61
- end - start));
62
- },
63
-
64
- reportSuiteResults: function(suite) {},
65
-
66
- reportRunnerResults: function(runner) {
67
- onTestRunConfigurationComplete();
68
- }
69
- };
70
- jasmineEnv.execute();
71
- return true;
72
- },
73
- onTestsFinish: function(){
74
- jasmine.currentEnv_ = null;
75
- rootDescribes.collectMode();
76
- }
77
- };
78
- jstestdriver.pluginRegistrar.register(jasminePlugin);
79
-
80
- function formatStack(stack) {
81
- var lines = (stack||'').split(/\r?\n/);
82
- var frames = [];
83
- for (i = 0; i < lines.length; i++) {
84
- if (!lines[i].match(/\/jasmine[\.-]/)) {
85
- frames.push(lines[i].replace(/https?:\/\/\w+(:\d+)?\/test\//, '').replace(/^\s*/, ' '));
86
- }
87
- }
88
- return frames.join('\n');
89
- }
90
-
91
- function noop(){}
92
- function Describes(window){
93
- var describes = {};
94
- var beforeEachs = {};
95
- var afterEachs = {};
96
- // Here we store:
97
- // 0: everyone runs
98
- // 1: run everything under ddescribe
99
- // 2: run only iits (ignore ddescribe)
100
- var exclusive = 0;
101
- var collectMode = true;
102
- intercept('describe', describes);
103
- intercept('xdescribe', describes);
104
- intercept('beforeEach', beforeEachs);
105
- intercept('afterEach', afterEachs);
106
-
107
- function intercept(functionName, collection){
108
- window[functionName] = function(desc, fn){
109
- if (collectMode) {
110
- collection[desc] = function(){
111
- jasmine.getEnv()[functionName](desc, fn);
112
- };
113
- } else {
114
- jasmine.getEnv()[functionName](desc, fn);
115
- }
116
- };
117
- }
118
- window.ddescribe = function(name, fn){
119
- if (exclusive < 1) {
120
- exclusive = 1; // run ddescribe only
121
- }
122
- window.describe(name, function(){
123
- var oldIt = window.it;
124
- window.it = function(name, fn){
125
- fn.exclusive = 1; // run anything under ddescribe
126
- jasmine.getEnv().it(name, fn);
127
- };
128
- try {
129
- fn.call(this);
130
- } finally {
131
- window.it = oldIt;
132
- };
133
- });
134
- };
135
- window.iit = function(name, fn){
136
- exclusive = fn.exclusive = 2; // run only iits
137
- jasmine.getEnv().it(name, fn);
138
- };
139
-
140
-
141
- this.collectMode = function() {
142
- collectMode = true;
143
- exclusive = 0; // run everything
144
- };
145
- this.playback = function(){
146
- collectMode = false;
147
- playback(beforeEachs);
148
- playback(afterEachs);
149
- playback(describes);
150
-
151
- function playback(set) {
152
- for ( var name in set) {
153
- set[name]();
154
- }
155
- }
156
- };
157
-
158
- this.isExclusive = function(spec) {
159
- if (exclusive) {
160
- var blocks = spec.queue.blocks;
161
- for ( var i = 0; i < blocks.length; i++) {
162
- if (blocks[i].func.exclusive >= exclusive) {
163
- return true;
164
- }
165
- }
166
- return false;
167
- }
168
- return true;
169
- };
170
- }
171
-
172
- })(window);
173
-
174
- // Patch Jasmine for proper stack traces
175
- jasmine.Spec.prototype.fail = function (e) {
176
- var expectationResult = new jasmine.ExpectationResult({
177
- passed: false,
178
- message: e ? jasmine.util.formatException(e) : 'Exception'
179
- });
180
- // PATCH
181
- if (e) {
182
- expectationResult.trace = e;
183
- }
184
- this.results_.addResult(expectationResult);
185
- };
186
-
@@ -1 +0,0 @@
1
- java -jar lib/jstestdriver/JsTestDriver.jar --config jsTestDriverIit.conf --tests "all" --reset
@@ -1,2 +0,0 @@
1
- java -jar lib/jstestdriver/JsTestDriver.jar --tests 'all' --reset
2
- java -jar lib/jstestdriver/JsTestDriver.jar --tests 'all'
@@ -1,2 +0,0 @@
1
- source test-regular.sh
2
- source test-iit.sh
@@ -1,6 +0,0 @@
1
- source :gemcutter
2
-
3
- gem "jekyll", "0.6.2"
4
- gem "json_pure", "~>1.4.3"
5
- gem "ragaskar-jsdoc_helper"
6
- gem "rake", "0.8.7"
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008-2010 Pivotal Labs
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,28 +0,0 @@
1
- <a name="README">[Jasmine](http://pivotal.github.com/jasmine/)</a>
2
- =======
3
- **A JavaScript Testing Framework**
4
-
5
- Want to use Jasmine in a project? Go HERE: [http://pivotal.github.com/jasmine/](http://pivotal.github.com/jasmine/)
6
-
7
- Want to contribute to Jasmine? Read on...
8
-
9
- <i>(More developer docs to come...)</i>
10
-
11
- ## Support
12
- We now have a Google Group for support & discussion.
13
-
14
- * Discussion: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
15
- * Group email: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com)
16
- * Current build status of Jasmine is visible at [ci.pivotallabs.com](http://ci.pivotallabs.com)
17
- * Pivotal Tracker project: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606)
18
- * Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD)
19
-
20
- ## Maintainers
21
- * [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs
22
- * [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
23
- * [Christian Williams](mailto:xian@pivotallabs.com), Pivotal Labs
24
-
25
- ## Developers
26
- We welcome your contributions! Jasmine is currently maintained by Davis Frank ([infews](http://github.com/infews)), Rajan Agaskar ([ragaskar](http://github.com/ragaskar)), and Christian Williams ([Xian](http://github.com/Xian)). You can help us by removing all other recipients from your pull request.
27
-
28
- Copyright (c) 2008-2010 Pivotal Labs. This software is licensed under the MIT License.
@@ -1,182 +0,0 @@
1
- def jasmine_sources
2
- sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"]
3
- sources += Dir.glob('src/*.js').reject { |f| f == 'src/base.js' || sources.include?(f) }.sort
4
- sources
5
- end
6
-
7
- def jasmine_html_sources
8
- ["src/html/TrivialReporter.js"]
9
- end
10
-
11
- def jasmine_version
12
- "#{version_hash['major']}.#{version_hash['minor']}.#{version_hash['build']}"
13
- end
14
-
15
- def version_hash
16
- require 'json'
17
- @version ||= JSON.parse(File.new("src/version.json").read);
18
- end
19
-
20
- task :default => 'jasmine:dist'
21
-
22
- def substitute_jasmine_version(filename)
23
- contents = File.read(filename)
24
- contents = contents.gsub(/##JASMINE_VERSION##/, (jasmine_version))
25
- contents = contents.gsub(/[^\n]*REMOVE_THIS_LINE_FROM_BUILD[^\n]*/, '')
26
- File.open(filename, 'w') { |f| f.write(contents) }
27
- end
28
-
29
- namespace :jasmine do
30
-
31
- desc 'Prepares for distribution'
32
- task :dist => ['jasmine:build', 'jasmine:doc', 'jasmine:build_example_project', 'jasmine:fill_index_downloads']
33
-
34
- desc 'Check jasmine sources for coding problems'
35
- task :lint do
36
- passed = true
37
- jasmine_sources.each do |src|
38
- lines = File.read(src).split(/\n/)
39
- lines.each_index do |i|
40
- line = lines[i]
41
- undefineds = line.scan(/.?undefined/)
42
- if undefineds.include?(" undefined") || undefineds.include?("\tundefined")
43
- puts "Dangerous undefined at #{src}:#{i}:\n > #{line}"
44
- passed = false
45
- end
46
-
47
- if line.scan(/window/).length > 0
48
- puts "Dangerous window at #{src}:#{i}:\n > #{line}"
49
- passed = false
50
- end
51
- end
52
- end
53
-
54
- unless passed
55
- puts "Lint failed!"
56
- exit 1
57
- end
58
- end
59
-
60
- desc 'Builds lib/jasmine from source'
61
- task :build => :lint do
62
- puts 'Building Jasmine from source'
63
-
64
- sources = jasmine_sources
65
- version = version_hash
66
-
67
- old_jasmine_files = Dir.glob('lib/jasmine*.js')
68
- old_jasmine_files.each { |file| File.delete(file) }
69
-
70
- File.open("lib/jasmine.js", 'w') do |jasmine|
71
- sources.each do |source_filename|
72
- jasmine.puts(File.read(source_filename))
73
- end
74
-
75
- jasmine.puts %{
76
- jasmine.version_= {
77
- "major": #{version['major'].to_json},
78
- "minor": #{version['minor'].to_json},
79
- "build": #{version['build'].to_json},
80
- "revision": #{Time.now.to_i}
81
- };
82
- }
83
- end
84
-
85
- File.open("lib/jasmine-html.js", 'w') do |jasmine_html|
86
- jasmine_html_sources.each do |source_filename|
87
- jasmine_html.puts(File.read(source_filename))
88
- end
89
- end
90
-
91
- FileUtils.cp("src/html/jasmine.css", "lib/jasmine.css")
92
- end
93
-
94
- downloads_file = 'pages/download.html.md'
95
- task :need_pages_submodule do
96
- unless File.exists?(downloads_file)
97
- raise "Jasmine pages submodule isn't present. Run git submodule update --init"
98
- end
99
- end
100
-
101
- desc "Build jasmine documentation"
102
- task :doc => :need_pages_submodule do
103
- puts 'Creating Jasmine Documentation'
104
- require 'rubygems'
105
- require 'jsdoc_helper'
106
-
107
- FileUtils.rm_r "pages/jsdoc", :force => true
108
-
109
- JsdocHelper::Rake::Task.new(:lambda_jsdoc) do |t|
110
- t[:files] = jasmine_sources << jasmine_html_sources
111
- t[:options] = "-a"
112
- t[:out] = "pages/jsdoc"
113
- # JsdocHelper bug: template must be relative to the JsdocHelper gem, ick
114
- t[:template] = File.join("../".*(100), Dir::getwd, "jsdoc-template")
115
- end
116
- Rake::Task[:lambda_jsdoc].invoke
117
- end
118
-
119
- desc "Build example project"
120
- task :build_example_project => :need_pages_submodule do
121
- require 'tmpdir'
122
-
123
- temp_dir = File.join(Dir.tmpdir, 'jasmine-standalone-project')
124
- puts "Building Example Project in #{temp_dir}"
125
- FileUtils.rm_r temp_dir if File.exists?(temp_dir)
126
- Dir.mkdir(temp_dir)
127
-
128
- root = File.expand_path(File.dirname(__FILE__))
129
- FileUtils.cp_r File.join(root, 'example/.'), File.join(temp_dir)
130
- substitute_jasmine_version(File.join(temp_dir, "SpecRunner.html"))
131
-
132
- lib_dir = File.join(temp_dir, "lib/jasmine-#{jasmine_version}")
133
- FileUtils.mkdir_p(lib_dir)
134
- {
135
- "lib/jasmine.js" => "jasmine.js",
136
- "lib/jasmine-html.js" => "jasmine-html.js",
137
- "src/html/jasmine.css" => "jasmine.css",
138
- "MIT.LICENSE" => "MIT.LICENSE"
139
- }.each_pair do |src, dest|
140
- FileUtils.cp(File.join(root, src), File.join(lib_dir, dest))
141
- end
142
-
143
- dist_dir = File.join(root, 'pages/downloads')
144
- zip_file_name = File.join(dist_dir, "jasmine-standalone-#{jasmine_version}.zip")
145
- puts "Zipping Example Project and moving to #{zip_file_name}"
146
- FileUtils.mkdir(dist_dir) unless File.exist?(dist_dir)
147
- if File.exist?(zip_file_name)
148
- puts "WARNING!!! #{zip_file_name} already exists!"
149
- FileUtils.rm(zip_file_name)
150
- end
151
- exec "cd #{temp_dir} && zip -r #{zip_file_name} . -x .[a-zA-Z0-9]*"
152
- end
153
-
154
- task :fill_index_downloads do
155
- require 'digest/sha1'
156
-
157
- download_html = "<!-- START_DOWNLOADS -->\n"
158
- Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f|
159
- sha1 = Digest::SHA1.hexdigest File.read(f)
160
-
161
- fn = f.sub(/^pages\//, '')
162
- version = /jasmine-standalone-(.*).zip/.match(f)[1]
163
- prerelease = /\.rc/.match(f)
164
- download_html += prerelease ? "<tr class=\"rc\">\n" : "<tr>\n"
165
- download_html += " <td class=\"link\"><a href=\"#{fn}\">#{fn.sub(/downloads\//, '')}</a></td>\n"
166
- download_html += " <td class=\"version\">#{version}</td>\n"
167
- download_html += " <td class=\"size\">#{File.size(f) / 1024}k</td>\n"
168
- download_html += " <td class=\"date\">#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}</td>\n"
169
- download_html += " <td class=\"sha\">#{sha1}</td>\n"
170
- download_html += "</tr>\n"
171
- end
172
- download_html += "<!-- END_DOWNLOADS -->"
173
-
174
- downloads_page = File.read(downloads_file)
175
- matcher = /<!-- START_DOWNLOADS -->.*<!-- END_DOWNLOADS -->/m
176
- downloads_page = downloads_page.sub(matcher, download_html)
177
- File.open(downloads_file, 'w') {|f| f.write(downloads_page)}
178
- puts "rewrote that file"
179
- end
180
- end
181
-
182
- task :jasmine => ['jasmine:dist']