js-test-driver-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -1
- data/README +40 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/js_test_driver.rb +5 -1
- data/lib/js_test_driver/config.rb +84 -7
- data/lib/js_test_driver/html_fixture.rb +40 -0
- data/lib/js_test_driver/runner.rb +21 -3
- data/test/fixtures/a.html +1 -0
- data/test/fixtures/b.html +1 -0
- data/test/fixtures/baz/a.html +1 -0
- data/test/fixtures/c.html +1 -0
- data/test/fixtures/foo/a.html +1 -0
- data/test/fixtures/foo/bar/a.html +1 -0
- data/test/fixtures/hello.txt +1 -0
- data/test/test_helper.rb +19 -0
- data/test/unit/config_test.rb +75 -2
- data/test/unit/html_fixture_test.rb +70 -0
- data/vendor/VERSIONS +3 -0
- data/vendor/jasmine-jstd-adapter/MIT.LICENSE +22 -0
- data/vendor/jasmine-jstd-adapter/README.md +25 -0
- data/vendor/jasmine-jstd-adapter/jsTestDriver.conf +6 -0
- data/vendor/jasmine-jstd-adapter/lib/jasmine/jasmine-0.11.1.js +2343 -0
- data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
- data/vendor/jasmine-jstd-adapter/server.sh +1 -0
- data/vendor/jasmine-jstd-adapter/src-test/tests.js +89 -0
- data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +111 -0
- data/vendor/jasmine-jstd-adapter/test.sh +1 -0
- data/vendor/jasmine/Gemfile +6 -0
- data/vendor/jasmine/MIT.LICENSE +20 -0
- data/vendor/jasmine/README.markdown +28 -0
- data/vendor/jasmine/Rakefile +178 -0
- data/vendor/jasmine/cruise_config.rb +21 -0
- data/vendor/jasmine/example/SpecRunner.html +27 -0
- data/vendor/jasmine/example/spec/PlayerSpec.js +58 -0
- data/vendor/jasmine/example/spec/SpecHelper.js +9 -0
- data/vendor/jasmine/example/src/Player.js +22 -0
- data/vendor/jasmine/example/src/Song.js +7 -0
- data/vendor/jasmine/images/fail-16.png +0 -0
- data/vendor/jasmine/images/fail.png +0 -0
- data/vendor/jasmine/images/go-16.png +0 -0
- data/vendor/jasmine/images/go.png +0 -0
- data/vendor/jasmine/images/pending-16.png +0 -0
- data/vendor/jasmine/images/pending.png +0 -0
- data/vendor/jasmine/images/question-bk.png +0 -0
- data/vendor/jasmine/images/questionbk-16.png +0 -0
- data/vendor/jasmine/images/spinner.gif +0 -0
- data/vendor/jasmine/lib/jasmine-html.js +182 -0
- data/vendor/jasmine/lib/jasmine.css +166 -0
- data/vendor/jasmine/lib/jasmine.js +2421 -0
- data/vendor/jasmine/lib/json2.js +478 -0
- data/vendor/jasmine/spec/runner.html +80 -0
- data/vendor/jasmine/spec/suites/BaseSpec.js +27 -0
- data/vendor/jasmine/spec/suites/CustomMatchersSpec.js +97 -0
- data/vendor/jasmine/spec/suites/EnvSpec.js +158 -0
- data/vendor/jasmine/spec/suites/ExceptionsSpec.js +107 -0
- data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +103 -0
- data/vendor/jasmine/spec/suites/MatchersSpec.js +795 -0
- data/vendor/jasmine/spec/suites/MockClockSpec.js +38 -0
- data/vendor/jasmine/spec/suites/MultiReporterSpec.js +45 -0
- data/vendor/jasmine/spec/suites/NestedResultsSpec.js +54 -0
- data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
- data/vendor/jasmine/spec/suites/QueueSpec.js +23 -0
- data/vendor/jasmine/spec/suites/ReporterSpec.js +56 -0
- data/vendor/jasmine/spec/suites/RunnerSpec.js +267 -0
- data/vendor/jasmine/spec/suites/SpecRunningSpec.js +1253 -0
- data/vendor/jasmine/spec/suites/SpecSpec.js +124 -0
- data/vendor/jasmine/spec/suites/SpySpec.js +201 -0
- data/vendor/jasmine/spec/suites/SuiteSpec.js +120 -0
- data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +235 -0
- data/vendor/jasmine/spec/suites/UtilSpec.js +40 -0
- data/vendor/jasmine/spec/suites/WaitsForBlockSpec.js +87 -0
- data/vendor/jasmine/src/Block.js +22 -0
- data/vendor/jasmine/src/Env.js +264 -0
- data/vendor/jasmine/src/JsApiReporter.js +102 -0
- data/vendor/jasmine/src/Matchers.js +354 -0
- data/vendor/jasmine/src/MultiReporter.js +35 -0
- data/vendor/jasmine/src/NestedResults.js +80 -0
- data/vendor/jasmine/src/PrettyPrinter.js +122 -0
- data/vendor/jasmine/src/Queue.js +99 -0
- data/vendor/jasmine/src/Reporter.js +31 -0
- data/vendor/jasmine/src/Runner.js +77 -0
- data/vendor/jasmine/src/Spec.js +242 -0
- data/vendor/jasmine/src/Suite.js +82 -0
- data/vendor/jasmine/src/WaitsBlock.js +13 -0
- data/vendor/jasmine/src/WaitsForBlock.js +52 -0
- data/vendor/jasmine/src/base.js +589 -0
- data/vendor/jasmine/src/html/TrivialReporter.js +182 -0
- data/vendor/jasmine/src/html/jasmine.css +166 -0
- data/vendor/jasmine/src/mock-timeout.js +183 -0
- data/vendor/jasmine/src/util.js +67 -0
- data/vendor/jasmine/src/version.json +5 -0
- metadata +102 -5
- data/test/unit/jsTestDriver.conf +0 -2
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
java -jar lib/jstestdriver/JsTestDriver.jar --port 9876 --runnerMode DEBUG
|
@@ -0,0 +1,89 @@
|
|
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
|
+
})();
|
@@ -0,0 +1,111 @@
|
|
1
|
+
/**
|
2
|
+
* @fileoverview Jasmine JsTestDriver Adapter.
|
3
|
+
* @author ibolmo@gmail.com (Olmo Maldonado)
|
4
|
+
* @author misko@hevery.com (Misko Hevery)
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function() {
|
8
|
+
|
9
|
+
function bind(_this, _function){
|
10
|
+
return function(){
|
11
|
+
return _function.call(_this);
|
12
|
+
};
|
13
|
+
}
|
14
|
+
|
15
|
+
var currentFrame = frame(null, null);
|
16
|
+
|
17
|
+
function frame(parent, name){
|
18
|
+
var caseName = (parent && parent.caseName ? parent.caseName + " " : '') + (name ? name : '');
|
19
|
+
var frame = {
|
20
|
+
name: name,
|
21
|
+
caseName: caseName,
|
22
|
+
parent: parent,
|
23
|
+
testCase: TestCase(caseName),
|
24
|
+
before: [],
|
25
|
+
after: [],
|
26
|
+
runBefore: function(){
|
27
|
+
if (parent) parent.runBefore.apply(this);
|
28
|
+
for ( var i = 0; i < frame.before.length; i++) {
|
29
|
+
frame.before[i].apply(this);
|
30
|
+
}
|
31
|
+
},
|
32
|
+
runAfter: function(){
|
33
|
+
for ( var i = 0; i < frame.after.length; i++) {
|
34
|
+
frame.after[i].apply(this);
|
35
|
+
}
|
36
|
+
if (parent) parent.runAfter.apply(this);
|
37
|
+
}
|
38
|
+
};
|
39
|
+
return frame;
|
40
|
+
};
|
41
|
+
|
42
|
+
jasmine.Env.prototype.describe = (function(describe){
|
43
|
+
return function(description){
|
44
|
+
currentFrame = frame(currentFrame, description);
|
45
|
+
var val = describe.apply(this, arguments);
|
46
|
+
currentFrame = currentFrame.parent;
|
47
|
+
return val;
|
48
|
+
};
|
49
|
+
|
50
|
+
})(jasmine.Env.prototype.describe);
|
51
|
+
|
52
|
+
var id = 0;
|
53
|
+
|
54
|
+
jasmine.Env.prototype.it = (function(it){
|
55
|
+
return function(desc, itFn){
|
56
|
+
var self = this;
|
57
|
+
var spec = it.apply(this, arguments);
|
58
|
+
var currentSpec = this.currentSpec;
|
59
|
+
if (!currentSpec.$id) {
|
60
|
+
currentSpec.$id = id++;
|
61
|
+
}
|
62
|
+
var frame = this.jstdFrame = currentFrame;
|
63
|
+
var name = 'test that it ' + desc;
|
64
|
+
if (this.jstdFrame.testCase.prototype[name])
|
65
|
+
throw "Spec with name '" + desc + "' already exists.";
|
66
|
+
this.jstdFrame.testCase.prototype[name] = function(){
|
67
|
+
jasmine.getEnv().currentSpec = currentSpec;
|
68
|
+
frame.runBefore.apply(currentSpec);
|
69
|
+
try {
|
70
|
+
currentSpec.queue.start();
|
71
|
+
} finally {
|
72
|
+
frame.runAfter.apply(currentSpec);
|
73
|
+
}
|
74
|
+
};
|
75
|
+
return spec;
|
76
|
+
};
|
77
|
+
|
78
|
+
})(jasmine.Env.prototype.it);
|
79
|
+
|
80
|
+
|
81
|
+
jasmine.Env.prototype.beforeEach = (function(beforeEach){
|
82
|
+
return function(beforeEachFunction) {
|
83
|
+
beforeEach.apply(this, arguments);
|
84
|
+
currentFrame.before.push(beforeEachFunction);
|
85
|
+
};
|
86
|
+
|
87
|
+
})(jasmine.Env.prototype.beforeEach);
|
88
|
+
|
89
|
+
|
90
|
+
jasmine.Env.prototype.afterEach = (function(afterEach){
|
91
|
+
return function(afterEachFunction) {
|
92
|
+
afterEach.apply(this, arguments);
|
93
|
+
currentFrame.after.push(afterEachFunction);
|
94
|
+
};
|
95
|
+
|
96
|
+
})(jasmine.Env.prototype.afterEach);
|
97
|
+
|
98
|
+
|
99
|
+
jasmine.NestedResults.prototype.addResult = (function(addResult){
|
100
|
+
return function(result) {
|
101
|
+
addResult.call(this, result);
|
102
|
+
if (result.type != 'MessageResult' && !result.passed()) fail(result.message);
|
103
|
+
};
|
104
|
+
|
105
|
+
})(jasmine.NestedResults.prototype.addResult);
|
106
|
+
|
107
|
+
// Reset environment with overriden methods.
|
108
|
+
jasmine.currentEnv_ = null;
|
109
|
+
jasmine.getEnv();
|
110
|
+
|
111
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
java -jar lib/jstestdriver/JsTestDriver.jar --tests all --reset
|
@@ -0,0 +1,20 @@
|
|
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.
|
@@ -0,0 +1,28 @@
|
|
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.
|
@@ -0,0 +1,178 @@
|
|
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
|
+
task :need_pages_submodule do
|
95
|
+
unless File.exists?('pages/index.html')
|
96
|
+
raise "Jasmine pages submodule isn't present. Run git submodule update --init"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
desc "Build jasmine documentation"
|
101
|
+
task :doc => :need_pages_submodule do
|
102
|
+
puts 'Creating Jasmine Documentation'
|
103
|
+
require 'rubygems'
|
104
|
+
require 'jsdoc_helper'
|
105
|
+
|
106
|
+
FileUtils.rm_r "pages/jsdoc", :force => true
|
107
|
+
|
108
|
+
JsdocHelper::Rake::Task.new(:lambda_jsdoc) do |t|
|
109
|
+
t[:files] = jasmine_sources << jasmine_html_sources
|
110
|
+
t[:options] = "-a"
|
111
|
+
t[:out] = "pages/jsdoc"
|
112
|
+
end
|
113
|
+
Rake::Task[:lambda_jsdoc].invoke
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "Build example project"
|
117
|
+
task :build_example_project => :need_pages_submodule do
|
118
|
+
require 'tmpdir'
|
119
|
+
|
120
|
+
temp_dir = File.join(Dir.tmpdir, 'jasmine-standalone-project')
|
121
|
+
puts "Building Example Project in #{temp_dir}"
|
122
|
+
FileUtils.rm_r temp_dir if File.exists?(temp_dir)
|
123
|
+
Dir.mkdir(temp_dir)
|
124
|
+
|
125
|
+
root = File.expand_path(File.dirname(__FILE__))
|
126
|
+
FileUtils.cp_r File.join(root, 'example/.'), File.join(temp_dir)
|
127
|
+
substitute_jasmine_version(File.join(temp_dir, "SpecRunner.html"))
|
128
|
+
|
129
|
+
lib_dir = File.join(temp_dir, "lib/jasmine-#{jasmine_version}")
|
130
|
+
FileUtils.mkdir_p(lib_dir)
|
131
|
+
{
|
132
|
+
"lib/jasmine.js" => "jasmine.js",
|
133
|
+
"lib/jasmine-html.js" => "jasmine-html.js",
|
134
|
+
"src/html/jasmine.css" => "jasmine.css"
|
135
|
+
}.each_pair do |src, dest|
|
136
|
+
FileUtils.cp(File.join(root, src), File.join(lib_dir, dest))
|
137
|
+
end
|
138
|
+
|
139
|
+
dist_dir = File.join(root, 'pages/downloads')
|
140
|
+
zip_file_name = File.join(dist_dir, "jasmine-standalone-#{jasmine_version}.zip")
|
141
|
+
puts "Zipping Example Project and moving to #{zip_file_name}"
|
142
|
+
FileUtils.mkdir(dist_dir) unless File.exist?(dist_dir)
|
143
|
+
if File.exist?(zip_file_name)
|
144
|
+
puts "WARNING!!! #{zip_file_name} already exists!"
|
145
|
+
FileUtils.rm(zip_file_name)
|
146
|
+
end
|
147
|
+
exec "cd #{temp_dir} && zip -r #{zip_file_name} . -x .[a-zA-Z0-9]*"
|
148
|
+
end
|
149
|
+
|
150
|
+
task :fill_index_downloads do
|
151
|
+
require 'digest/sha1'
|
152
|
+
|
153
|
+
download_html = "<!-- START_DOWNLOADS -->\n"
|
154
|
+
download_html += "<table>\n<tr><th></th><th>Version</th><th>Size</th><th>Date</th><th>SHA1</th></tr>\n"
|
155
|
+
Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f|
|
156
|
+
sha1 = Digest::SHA1.hexdigest File.read(f)
|
157
|
+
|
158
|
+
fn = f.sub(/^pages\//, '')
|
159
|
+
version = /jasmine-standalone-(.*).zip/.match(f)[1]
|
160
|
+
download_html += "<tr>\n"
|
161
|
+
download_html += "<td class=\"link\"><a href='#{fn}'>#{fn.sub(/downloads\//, '')}</a></td>\n"
|
162
|
+
download_html += "<td class=\"version\">#{version}</td>\n"
|
163
|
+
download_html += "<td class=\"size\">#{File.size(f) / 1024}k</td>\n"
|
164
|
+
download_html += "<td class=\"date\">#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}</td>\n"
|
165
|
+
download_html += "<td class=\"sha\">#{sha1}</td>\n"
|
166
|
+
download_html += "</tr>\n"
|
167
|
+
end
|
168
|
+
download_html += "</table>\n<!-- END_DOWNLOADS -->"
|
169
|
+
|
170
|
+
index_page = File.read('pages/index.html')
|
171
|
+
matcher = /<!-- START_DOWNLOADS -->.*<!-- END_DOWNLOADS -->/m
|
172
|
+
index_page = index_page.sub(matcher, download_html)
|
173
|
+
File.open('pages/index.html', 'w') {|f| f.write(index_page)}
|
174
|
+
puts "rewrote that file"
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
task :jasmine => ['jasmine:dist']
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Project-specific configuration for CruiseControl.rb
|
2
|
+
Project.configure do |project|
|
3
|
+
|
4
|
+
# Send email notifications about broken and fixed builds to email1@your.site, email2@your.site (default: send to nobody)
|
5
|
+
# project.email_notifier.emails = ['email1@your.site', 'email2@your.site']
|
6
|
+
|
7
|
+
# Set email 'from' field to john@doe.com:
|
8
|
+
# project.email_notifier.from = 'john@doe.com'
|
9
|
+
|
10
|
+
# Build the project by invoking rake task 'custom'
|
11
|
+
project.rake_task = 'jasmine:test:ci:saucelabs'
|
12
|
+
|
13
|
+
# Build the project by invoking shell script "build_my_app.sh". Keep in mind that when the script is invoked,
|
14
|
+
# current working directory is <em>[cruise data]</em>/projects/your_project/work, so if you do not keep build_my_app.sh
|
15
|
+
# in version control, it should be '../build_my_app.sh' instead
|
16
|
+
#project.build_command = 'cp ../saucelabs.yml .'
|
17
|
+
|
18
|
+
# Ping Subversion for new revisions every 5 minutes (default: 30 seconds)
|
19
|
+
# project.scheduler.polling_interval = 5.minutes
|
20
|
+
|
21
|
+
end
|