Build html support classes (just TrivialReporter for now) into jasmine-html.js.

This commit is contained in:
Lee Byrd & Christian Williams 2010-06-24 17:33:46 -07:00
parent 1057596665
commit 85351f2c1c
6 changed files with 44 additions and 24 deletions

View File

@ -6,6 +6,10 @@ def jasmine_sources
sources
end
def jasmine_html_sources
["src/html/TrivialReporter.js"]
end
def jasmine_filename
"jasmine-#{jasmine_version}.js"
end
@ -81,8 +85,7 @@ namespace :jasmine do
old_jasmine_files = Dir.glob('lib/jasmine*.js')
old_jasmine_files.each { |file| File.delete(file) }
jasmine = File.new("lib/jasmine.js", 'w')
File.open("lib/jasmine.js", 'w') do |jasmine|
sources.each do |source_filename|
jasmine.puts(File.read(source_filename))
end
@ -93,12 +96,17 @@ jasmine.version_= {
"minor": #{version['minor']},
"build": #{version['build']},
"revision": #{Time.now.to_i}
};
};
}
end
jasmine.close
File.open("lib/jasmine-html.js", 'w') do |jasmine_html|
jasmine_html_sources.each do |source_filename|
jasmine_html.puts(File.read(source_filename))
end
end
FileUtils.cp("lib/jasmine.js", "lib/#{jasmine_filename version}")
FileUtils.cp("src/html/jasmine.css", "lib/jasmine.css")
end
desc "Build jasmine documentation"
@ -110,7 +118,7 @@ jasmine.version_= {
JsdocHelper::Rake::Task.new(:lambda_jsdoc) do |t|
t[:files] = jasmine_sources << 'lib/TrivialReporter.js'
t[:files] = jasmine_sources << jasmine_html_sources
t[:options] = "-a"
end
Rake::Task[:lambda_jsdoc].invoke
@ -131,12 +139,12 @@ jasmine.version_= {
lib_dir = File.join(temp_dir, "lib/jasmine-#{jasmine_version}")
FileUtils.mkdir_p(lib_dir)
[
"jasmine.js",
"TrivialReporter.js",
"jasmine.css"
].each do |f|
FileUtils.cp(File.join(root, 'lib', f), File.join(lib_dir, f))
{
"lib/jasmine.js" => "jasmine.js",
"lib/jasmine-html.js" => "jasmine-html.js",
"src/html/jasmine.css" => "jasmine.css"
}.each_pair do |src, dest|
FileUtils.cp(File.join(root, src), File.join(lib_dir, dest))
end
dist = File.join(root, 'dist')
@ -147,7 +155,7 @@ jasmine.version_= {
task :server do
files = jasmine_sources + ['lib/TrivialReporter.js', 'lib/consolex.js']
files = jasmine_sources + jasmine_html_sources
jasmine_includes = lambda {
raw_jasmine_includes = files.collect { |f| File.expand_path(File.join(JasmineHelper.jasmine_root, f)) }
Jasmine.cachebust(raw_jasmine_includes).collect { |f| f.sub(JasmineHelper.jasmine_src_dir, "/src").sub(JasmineHelper.jasmine_lib_dir, "/lib") }

View File

@ -5,7 +5,7 @@
<title>Jasmine Test Runner</title>
<link rel="stylesheet" type="text/css" href="lib/jasmine-##JASMINE_VERSION##/jasmine.css">
<script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/TrivialReporter.js"></script>
<script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/jasmine-html.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="src/Player.js"></script>

View File

@ -929,6 +929,10 @@ jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
};
//noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportSpecStarting = function(spec) {
};
//noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportSpecResults = function(spec) {
};
@ -1410,7 +1414,14 @@ jasmine.MultiReporter.prototype.addReporter = function(reporter) {
};
(function() {
var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"];
var functionNames = [
"reportRunnerStarting",
"reportRunnerResults",
"reportSuiteResults",
"reportSpecStarting",
"reportSpecResults",
"log"
];
for (var i = 0; i < functionNames.length; i++) {
var functionName = functionNames[i];
jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
@ -1934,7 +1945,8 @@ jasmine.Spec.prototype.execute = function(onComplete) {
spec.finish(onComplete);
return;
}
this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
this.env.reporter.reportSpecStarting(this);
spec.env.currentSpec = spec;
@ -2327,5 +2339,5 @@ jasmine.version_= {
"major": 0,
"minor": 11,
"build": 0,
"revision": 1277400646
};
"revision": 1277425679
};

View File

@ -28,7 +28,7 @@
<script type="text/javascript" src="../src/WaitsBlock.js"></script>
<script type="text/javascript" src="../src/WaitsForBlock.js"></script>
<script type="text/javascript" src="../lib/TrivialReporter.js"></script>
<script type="text/javascript" src="../src/html/TrivialReporter.js"></script>
<script type="text/javascript" src="../lib/consolex.js"></script>
@ -73,7 +73,7 @@
})();
</script>
<link href="../lib/jasmine.css" rel="stylesheet"/>
<link href="../src/html/jasmine.css" rel="stylesheet"/>
</head>
<body>