diff --git a/Rakefile b/Rakefile index 7dae5fb..a7a199a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,37 @@ -desc 'Builds lib/jasmine from source' -namespace :build do - task :jasmine => 'build:doc' do +require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb")) + +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' sources = jasmine_sources version = version_hash @@ -21,10 +52,12 @@ jasmine.version_= { sources.each do |source_filename| jasmine.puts(File.read(source_filename)) end + jasmine.close end desc "Build jasmine documentation" task :doc do + puts 'Creating Jasmine Documentation' require 'rubygems' #sudo gem install ragaskar-jsdoc_helper require 'jsdoc_helper' @@ -34,52 +67,32 @@ jasmine.version_= { Rake::Task[:lambda_jsdoc].invoke end -end -def jasmine_sources - sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"] + desc "Run jasmine tests of source via server" + 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 -end + desc "Build jasmine and run tests via server" + task :server_build => 'jasmine:build' do -def jasmine_filename(version) - "jasmine-#{version['major']}.#{version['minor']}.#{version['build']}.js" -end + jasmine_includes = ['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] + start_jasmine_server(jasmine_includes) + end -def version_hash - JSON.parse(File.new("src/version.json").read); -end - -namespace :test do - desc "Run continuous integration tests" - task :ci => 'build:jasmine' do - require "spec" - require 'spec/rake/spectask' - Spec::Rake::SpecTask.new(:lambda_ci) do |t| - t.spec_opts = ["--color", "--format", "specdoc"] - t.spec_files = ["spec/jasmine_spec.rb"] + namespace :test do + desc "Run continuous integration tests" + task :ci => 'jasmine:build' do + require "spec" + require 'spec/rake/spectask' + Spec::Rake::SpecTask.new(:lambda_ci) do |t| + t.spec_opts = ["--color", "--format", "specdoc"] + t.spec_files = ["spec/jasmine_spec.rb"] + end + Rake::Task[:lambda_ci].invoke end - Rake::Task[:lambda_ci].invoke + 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 \ No newline at end of file diff --git a/doc/files.html b/doc/files.html index cf9fbc2..a6cf772 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index 4755245..f1d89e9 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index b65f072..c4e67c6 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index fa33e31..38555b7 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 9bc6463..3328c57 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -384,7 +384,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index a9b815b..409d8ee 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 374c612..666923c 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 8324b74..27d073a 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index 2b92aa0..fb7bfda 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 1bf3b29..e73dfad 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -384,7 +384,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index f4f9779..73759b6 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index f90344d..5283d7d 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index 942ebe9..08da603 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -402,7 +402,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index 5b25be6..9e631bc 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -678,7 +678,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:57 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index 84dd451..164fef0 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 19:44:54 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Sep 04 2009 23:03:58 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index 4cd1d25..ef13aaa 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -524,7 +524,7 @@ 517 "major": 0, 518 "minor": 9, 519 "build": 0, -520 "revision": 1252086971 +520 "revision": 1252129945 521 }; 522 /** 523 * @namespace diff --git a/examples/ruby/Rakefile b/examples/ruby/Rakefile index 79f3945..00dfb54 100644 --- a/examples/ruby/Rakefile +++ b/examples/ruby/Rakefile @@ -1,3 +1,5 @@ +require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb")) + namespace :test do desc "Run continuous integration tests" require "spec" @@ -11,22 +13,12 @@ end desc "Run specs via server" 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')) - 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 "your tests are here:" 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 diff --git a/examples/ruby/spec/jasmine_helper.rb b/examples/ruby/spec/jasmine_helper.rb new file mode 100644 index 0000000..84e01fe --- /dev/null +++ b/examples/ruby/spec/jasmine_helper.rb @@ -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 diff --git a/examples/ruby/spec/jasmine_spec.rb b/examples/ruby/spec/jasmine_spec.rb index 9d7d6fc..29f212a 100644 --- a/examples/ruby/spec/jasmine_spec.rb +++ b/examples/ruby/spec/jasmine_spec.rb @@ -1,21 +1,13 @@ require 'rubygems' -require File.expand_path(File.join(File.dirname(__FILE__), "../../../contrib/ruby/jasmine_spec_builder")) 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')) -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) +spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner) should_stop = false diff --git a/javascript.rake b/javascript.rake new file mode 100755 index 0000000..8d6a4e6 --- /dev/null +++ b/javascript.rake @@ -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 diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index 56dc239..8c62759 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -517,7 +517,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1252118695 + "revision": 1252130638 }; /** * @namespace diff --git a/spec/jasmine_helper.rb b/spec/jasmine_helper.rb new file mode 100755 index 0000000..1156e8f --- /dev/null +++ b/spec/jasmine_helper.rb @@ -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 diff --git a/spec/jasmine_spec.rb b/spec/jasmine_spec.rb index 06e3b40..29f212a 100644 --- a/spec/jasmine_spec.rb +++ b/spec/jasmine_spec.rb @@ -1,23 +1,13 @@ require 'rubygems' -require File.expand_path(File.join(File.dirname(__FILE__), "../contrib/ruby/jasmine_spec_builder")) 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 = { - "/spec" => 'spec', - "/lib" => 'lib', - "/src" => 'src' -} +jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path, + JasmineHelper.jasmine + JasmineHelper.spec_file_urls, + JasmineHelper.dir_mappings) -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 - -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) +spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner) should_stop = false