Integrate JasmineHelper
This commit is contained in:
parent
65cec7a2b9
commit
11f356e375
101
Rakefile
101
Rakefile
|
@ -1,6 +1,37 @@
|
||||||
desc 'Builds lib/jasmine from source'
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb"))
|
||||||
namespace :build do
|
|
||||||
task :jasmine => 'build:doc' do
|
def jasmine_sources
|
||||||
|
sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"]
|
||||||
|
sources += Dir.glob('src/*.js').reject{|f| f == 'src/base.js' || sources.include?(f)}.sort
|
||||||
|
end
|
||||||
|
|
||||||
|
def jasmine_filename(version)
|
||||||
|
"jasmine-#{version['major']}.#{version['minor']}.#{version['build']}.js"
|
||||||
|
end
|
||||||
|
|
||||||
|
def version_hash
|
||||||
|
JSON.parse(File.new("src/version.json").read);
|
||||||
|
end
|
||||||
|
|
||||||
|
def start_jasmine_server(jasmine_includes)
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
includes = jasmine_includes +
|
||||||
|
['/lib/json2.js',
|
||||||
|
'/lib/TrivialReporter.js']
|
||||||
|
|
||||||
|
puts "your tests are here:"
|
||||||
|
puts " http://localhost:8888/run.html"
|
||||||
|
|
||||||
|
Jasmine::SimpleServer.start(8888,
|
||||||
|
lambda { includes + JasmineHelper.spec_file_urls },
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :jasmine do
|
||||||
|
desc 'Builds lib/jasmine from source'
|
||||||
|
task :build => 'jasmine:doc' do
|
||||||
|
puts 'Building Jasmine from source'
|
||||||
require 'json'
|
require 'json'
|
||||||
sources = jasmine_sources
|
sources = jasmine_sources
|
||||||
version = version_hash
|
version = version_hash
|
||||||
|
@ -21,10 +52,12 @@ jasmine.version_= {
|
||||||
sources.each do |source_filename|
|
sources.each do |source_filename|
|
||||||
jasmine.puts(File.read(source_filename))
|
jasmine.puts(File.read(source_filename))
|
||||||
end
|
end
|
||||||
|
jasmine.close
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Build jasmine documentation"
|
desc "Build jasmine documentation"
|
||||||
task :doc do
|
task :doc do
|
||||||
|
puts 'Creating Jasmine Documentation'
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
#sudo gem install ragaskar-jsdoc_helper
|
#sudo gem install ragaskar-jsdoc_helper
|
||||||
require 'jsdoc_helper'
|
require 'jsdoc_helper'
|
||||||
|
@ -34,52 +67,32 @@ jasmine.version_= {
|
||||||
Rake::Task[:lambda_jsdoc].invoke
|
Rake::Task[:lambda_jsdoc].invoke
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def jasmine_sources
|
desc "Run jasmine tests of source via server"
|
||||||
sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"]
|
task :server do
|
||||||
|
jasmine_includes = jasmine_sources
|
||||||
|
start_jasmine_server(jasmine_includes)
|
||||||
|
end
|
||||||
|
|
||||||
sources += Dir.glob('src/*.js').reject{|f| f == 'src/base.js' || sources.include?(f)}.sort
|
desc "Build jasmine and run tests via server"
|
||||||
end
|
task :server_build => 'jasmine:build' do
|
||||||
|
|
||||||
def jasmine_filename(version)
|
jasmine_includes = ['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)]
|
||||||
"jasmine-#{version['major']}.#{version['minor']}.#{version['build']}.js"
|
start_jasmine_server(jasmine_includes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def version_hash
|
namespace :test do
|
||||||
JSON.parse(File.new("src/version.json").read);
|
desc "Run continuous integration tests"
|
||||||
end
|
task :ci => 'jasmine:build' do
|
||||||
|
require "spec"
|
||||||
namespace :test do
|
require 'spec/rake/spectask'
|
||||||
desc "Run continuous integration tests"
|
Spec::Rake::SpecTask.new(:lambda_ci) do |t|
|
||||||
task :ci => 'build:jasmine' do
|
t.spec_opts = ["--color", "--format", "specdoc"]
|
||||||
require "spec"
|
t.spec_files = ["spec/jasmine_spec.rb"]
|
||||||
require 'spec/rake/spectask'
|
end
|
||||||
Spec::Rake::SpecTask.new(:lambda_ci) do |t|
|
Rake::Task[:lambda_ci].invoke
|
||||||
t.spec_opts = ["--color", "--format", "specdoc"]
|
|
||||||
t.spec_files = ["spec/jasmine_spec.rb"]
|
|
||||||
end
|
end
|
||||||
Rake::Task[:lambda_ci].invoke
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Run jasmine tests via server"
|
|
||||||
task :jasmine_server do
|
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), "contrib/ruby/jasmine_spec_builder"))
|
|
||||||
|
|
||||||
includes = lambda do
|
|
||||||
jasmine_sources + ['lib/TrivialReporter.js'] + Dir.glob("spec/**/*.js")
|
|
||||||
end
|
|
||||||
|
|
||||||
dir_mappings = {
|
|
||||||
"/spec" => "spec",
|
|
||||||
"/lib" => "lib",
|
|
||||||
"/src" => 'src'
|
|
||||||
}
|
|
||||||
|
|
||||||
puts "your tests are here:"
|
|
||||||
puts " http://localhost:8888/run.html"
|
|
||||||
|
|
||||||
Jasmine::SimpleServer.start(8888, includes, dir_mappings)
|
|
||||||
end
|
end
|
|
@ -258,7 +258,7 @@ ul.inheritsList
|
||||||
</div>
|
</div>
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -300,7 +300,7 @@ ul.inheritsList
|
||||||
</div>
|
</div>
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -339,7 +339,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -384,7 +384,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -700,7 +700,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -384,7 +384,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -339,7 +339,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);</pre>
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -402,7 +402,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -678,7 +678,7 @@ Jasmine environment.
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -316,7 +316,7 @@ ul.inheritsList
|
||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -524,7 +524,7 @@
|
||||||
<span class='line'>517</span> </span><span class="WHIT"> </span><span class="STRN">"major"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>517</span> </span><span class="WHIT"> </span><span class="STRN">"major"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>518</span> </span><span class="WHIT"> </span><span class="STRN">"minor"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">9</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>518</span> </span><span class="WHIT"> </span><span class="STRN">"minor"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">9</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>519</span> </span><span class="WHIT"> </span><span class="STRN">"build"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'>519</span> </span><span class="WHIT"> </span><span class="STRN">"build"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'>520</span> </span><span class="WHIT"> </span><span class="STRN">"revision"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1252086971</span><span class="WHIT">
|
<span class='line'>520</span> </span><span class="WHIT"> </span><span class="STRN">"revision"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1252129945</span><span class="WHIT">
|
||||||
<span class='line'>521</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>521</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>522</span> </span><span class="COMM">/**
|
<span class='line'>522</span> </span><span class="COMM">/**
|
||||||
<span class='line'>523</span> * @namespace
|
<span class='line'>523</span> * @namespace
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb"))
|
||||||
|
|
||||||
namespace :test do
|
namespace :test do
|
||||||
desc "Run continuous integration tests"
|
desc "Run continuous integration tests"
|
||||||
require "spec"
|
require "spec"
|
||||||
|
@ -11,22 +13,12 @@ end
|
||||||
|
|
||||||
desc "Run specs via server"
|
desc "Run specs via server"
|
||||||
task :jasmine_server do
|
task :jasmine_server do
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), "../../contrib/ruby/jasmine_spec_builder"))
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
JASMINE_LIB = File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))
|
puts "your tests are here:"
|
||||||
dir_mappings = {
|
|
||||||
"/spec" => 'spec',
|
|
||||||
"/lib" => JASMINE_LIB
|
|
||||||
}
|
|
||||||
|
|
||||||
includes = ['lib/' + File.basename(Dir.glob("#{JASMINE_LIB}/jasmine*.js").first),
|
|
||||||
'lib/json2.js',
|
|
||||||
'lib/TrivialReporter.js']
|
|
||||||
|
|
||||||
spec_files = Dir.glob("spec/**/*[Ss]pec.js")
|
|
||||||
|
|
||||||
puts "your tests are here:"
|
|
||||||
puts " http://localhost:8888/run.html"
|
puts " http://localhost:8888/run.html"
|
||||||
|
|
||||||
Jasmine::SimpleServer.start(8888, includes + spec_files, dir_mappings)
|
Jasmine::SimpleServer.start(8888,
|
||||||
|
lambda { JasmineHelper.jasmine + JasmineHelper.spec_file_urls },
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
class JasmineHelper
|
||||||
|
def self.jasmine_lib_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'lib'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_root
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine
|
||||||
|
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
|
||||||
|
['/lib/json2.js',
|
||||||
|
'/lib/TrivialReporter.js']
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_src_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'src'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_spec_dir
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.raw_spec_files
|
||||||
|
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.spec_file_urls
|
||||||
|
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.dir_mappings
|
||||||
|
{
|
||||||
|
"/src" => jasmine_src_dir,
|
||||||
|
"/spec" => jasmine_spec_dir,
|
||||||
|
"/lib" => jasmine_lib_dir
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,21 +1,13 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), "../../../contrib/ruby/jasmine_spec_builder"))
|
|
||||||
require "selenium_rc"
|
require "selenium_rc"
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
|
||||||
|
JasmineHelper.jasmine + JasmineHelper.spec_file_urls,
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
|
||||||
JASMINE_LIB = File.expand_path(File.join(File.dirname(__FILE__), '../../../lib'))
|
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||||
dir_mappings = {
|
|
||||||
"/spec" => 'spec',
|
|
||||||
"/lib" => JASMINE_LIB
|
|
||||||
}
|
|
||||||
|
|
||||||
includes = ['lib/' + File.basename(Dir.glob("#{JASMINE_LIB}/jasmine*.js").first),
|
|
||||||
'lib/json2.js',
|
|
||||||
'lib/TrivialReporter.js']
|
|
||||||
|
|
||||||
spec_files = Dir.glob("spec/**/*[Ss]pec.js")
|
|
||||||
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path, includes + spec_files, dir_mappings)
|
|
||||||
spec_builder = Jasmine::SpecBuilder.new(spec_files, jasmine_runner)
|
|
||||||
|
|
||||||
should_stop = false
|
should_stop = false
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
namespace :spec do
|
||||||
|
desc "Run continuous integration tests"
|
||||||
|
require "spec"
|
||||||
|
require 'spec/rake/spectask'
|
||||||
|
|
||||||
|
Spec::Rake::SpecTask.new(:javascript) do |t|
|
||||||
|
t.spec_opts = ["--color", "--format", "specdoc"]
|
||||||
|
t.spec_files = ["spec/javascript/jasmine_spec.rb"]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
desc "Run specs via server"
|
||||||
|
task :jasmine_server do
|
||||||
|
require File.expand_path(File.join(RAILS_ROOT, "spec/javascript/jasmine_helper.rb"))
|
||||||
|
require File.expand_path(File.join(RAILS_ROOT, "spec/javascript/jasmine/contrib/ruby/jasmine_runner.rb"))
|
||||||
|
|
||||||
|
|
||||||
|
includes = ['lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first),
|
||||||
|
'lib/json2.js',
|
||||||
|
'lib/TrivialReporter.js']
|
||||||
|
|
||||||
|
|
||||||
|
puts "your tests are here:"
|
||||||
|
puts " http://localhost:8888/run.html"
|
||||||
|
|
||||||
|
Jasmine::SimpleServer.start(8888,
|
||||||
|
lambda { includes + JasmineHelper.spec_file_urls },
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
end
|
||||||
|
end
|
|
@ -517,7 +517,7 @@ jasmine.version_= {
|
||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 9,
|
"minor": 9,
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"revision": 1252118695
|
"revision": 1252130638
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @namespace
|
* @namespace
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
class JasmineHelper
|
||||||
|
def self.jasmine_lib_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'lib'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine
|
||||||
|
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
|
||||||
|
['/lib/json2.js',
|
||||||
|
'/lib/TrivialReporter.js']
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_root
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.jasmine_src_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'src'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_spec_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'spec'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.raw_spec_files
|
||||||
|
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.spec_file_urls
|
||||||
|
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.dir_mappings
|
||||||
|
{
|
||||||
|
"/src" => jasmine_src_dir,
|
||||||
|
"/spec" => jasmine_spec_dir,
|
||||||
|
"/lib" => jasmine_lib_dir
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,23 +1,13 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), "../contrib/ruby/jasmine_spec_builder"))
|
|
||||||
require "selenium_rc"
|
require "selenium_rc"
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
dir_mappings = {
|
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
|
||||||
"/spec" => 'spec',
|
JasmineHelper.jasmine + JasmineHelper.spec_file_urls,
|
||||||
"/lib" => 'lib',
|
JasmineHelper.dir_mappings)
|
||||||
"/src" => 'src'
|
|
||||||
}
|
|
||||||
|
|
||||||
def jasmine_sources
|
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||||
sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"]
|
|
||||||
|
|
||||||
sources += Dir.glob('src/*.js').reject{|f| f == 'src/base.js' || sources.include?(f)}.sort
|
|
||||||
end
|
|
||||||
|
|
||||||
includes = jasmine_sources + ['lib/json2.js', 'lib/TrivialReporter.js']
|
|
||||||
spec_files = Dir.glob("spec/**/*[Ss]pec.js")
|
|
||||||
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path, includes + spec_files, dir_mappings)
|
|
||||||
spec_builder = Jasmine::SpecBuilder.new(spec_files, jasmine_runner)
|
|
||||||
|
|
||||||
should_stop = false
|
should_stop = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue