diff --git a/Contribute.markdown b/Contribute.markdown index 8c0ffd18..a0491368 100644 --- a/Contribute.markdown +++ b/Contribute.markdown @@ -4,6 +4,36 @@ We welcome your contributions - Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists (the main group - [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js) and the developer's list - [http://groups.google.com/group/jasmine-js-dev](http://groups.google.com/group/jasmine-js-dev)) before starting work - what you're looking for may already have been done. If it hasn't, the community can help make your contribution better. +## General Workflow + +Please submit pull requests via feature branches using the semi-standard workflow of: + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + +## Install Dependencies + +Jasmine Core relies on Ruby and Node.js. + +To install the Ruby dependencies, you will need Ruby, Rubygems, and Bundler available. Then: + + $ bundle + +...will install all of the Ruby dependencies. + +To install the Node dependencies, you will need Node.js, Npm, and [Grunt](http://gruntjs.com/) (including the grunt-cli). + + $ npm install --local + +...will install all of the node modules locally. If when you run + + $ grunt + +...you see that JSHint runs your system is ready. + ## How to write new Jasmine code Or, How to make a successful pull request @@ -12,24 +42,29 @@ Or, How to make a successful pull request * _Be environment agnostic_ - server-side developers are just as important as browser developers * _Be browser agnostic_ - if you must rely on browser-specific functionality, please write it in a way that degrades gracefully * _Write specs_ - Jasmine's a testing framework; don't add functionality without test-driving it +* _Write code in the style of the rest of the repo_ - Jasmine should look like a cohesive whole * _Ensure the *entire* test suite is green_ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users Follow these tips and your pull request, patch, or suggestion is much more likely to be integrated. -## Environment - -Ruby, RubyGems and Rake are used in order to script the various file interactions. You will need to run on a system that supports Ruby in order to run Jasmine's specs. - -Node.js is used to run most of the specs (the HTML-independent code) and should be present. Additionally, the JS Hint project scrubs the source code as part of the spec process. - ## Development All source code belongs in `src/`. The `core/` directory contains the bulk of Jasmine's functionality. This code should remain browser- and environment-agnostic. If your feature or fix cannot be, as mentioned above, please degrade gracefully. Any code that should only be in a non-browser environment should live in `src/console/`. Any code that depends on a browser (specifically, it expects `window` to be the global or `document` is present) should live in `src/html/`. -Please respect the code patterns as possible. For example, using `jasmine.getGlobal()` to get the global object so as to remain environment agnostic. - ## Running Specs +Jasmine uses the Jasmine Ruby gem to test itself in browser. + + $ rake jasmine + +...and then visit `http://localhost:8888` to run specs. + +Jasmine uses a Node + + and uses a custom runner for node. + +Tests in Bro + As in all good projects, the `spec/` directory mirrors `src/` and follows the same rules. The browser runner will include and attempt to run all specs. The node runner will exclude any html-dependent specs (those in `spec/html/`). You will notice that all specs are run against the built `jasmine.js` instead of the component source files. This is intentional as a way to ensure that the concatenation code is working correctly. diff --git a/Gruntfile.js b/Gruntfile.js index cf27b91f..1dc6824d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,18 +17,24 @@ module.exports = function(grunt) { grunt.registerTask('default', ['jshint:all']); + var version = require('./grunt/tasks/version.js'); + var standaloneBuilder = require('./grunt/tasks/build_standalone.js'); + + grunt.registerTask('build:copyVersionToGem', + "Propagates the version from package.json to version.rb", + version.copyToGem); + grunt.registerTask('buildDistribution', 'Builds and lints jasmine.js, jasmine-html.js, jasmine.css', [ 'compass', 'jshint:beforeConcat', 'concat', - 'jshint:afterConcat' + 'jshint:afterConcat', + 'build:copyVersionToGem' ] ); - var standaloneBuilder = require('./grunt/tasks/build_standalone.js'); - grunt.registerTask("build:compileSpecRunner", "Processes the spec runner template and writes to a tmp file", standaloneBuilder.compileSpecRunner @@ -47,4 +53,12 @@ module.exports = function(grunt) { "build:cleanSpecRunner" ] ); + + var spec = require('./grunt/tasks/spec.js'); + + grunt.registerTask("execSpecsInNode", + "Run Jasmine core specs in Node.js", + spec.execSpecsInNode + ); + }; \ No newline at end of file diff --git a/README.markdown b/README.markdown index 04a899b3..3953cb0c 100644 --- a/README.markdown +++ b/README.markdown @@ -7,11 +7,9 @@ Jasmine is a Behavior Driven Development testing framework for JavaScript. It do Documentation & guides live here: [http://pivotal.github.com/jasmine/](http://pivotal.github.com/jasmine/) -# DEV GUIDE +## Contributing -Dependencies for this repo -* Ruby > 1.9, Rubygems, Bundler -* Node.js, npm +Please read the [contributors' guide](https://github.com/pivotal/jasmine/blob/master/Contribute.markdown) ## Support @@ -20,11 +18,10 @@ Dependencies for this repo * View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606) * Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD) - ## Maintainers * [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs * [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs * [Christian Williams](mailto:antixian666@gmail.com), Square -Copyright (c) 2008-2012 Pivotal Labs. This software is licensed under the MIT License. +Copyright (c) 2008-2013 Pivotal Labs. This software is licensed under the MIT License. diff --git a/Rakefile b/Rakefile index 98621037..19072dbf 100644 --- a/Rakefile +++ b/Rakefile @@ -1,49 +1,12 @@ require "bundler" Bundler::GemHelper.install_tasks require "json" -require "tilt" require "jasmine" Dir["#{File.dirname(__FILE__)}/tasks/**/*.rb"].each do |file| require file end -desc "Run all Jasmine JS specs" -task :jasmine_specs do - jasmine_dev = JasmineDev.new - - return unless jasmine_dev.node_installed? - - system "thor jasmine_dev:execute_specs" - - puts "\n\033[33m>>> DEPRECATED <<< Run Jasmine's JavaScript specs with 'thor jasmine_dev:execute_specs'\n\033[0m" -end - -desc "Run all Jasmine core tests (JavaScript and dev tasks)" -task :spec => :require_pages_submodule do - jasmine_dev = JasmineDev.new - - return unless jasmine_dev.node_installed? - - system "rspec" -end - -task :require_pages_submodule do - jasmine_dev = JasmineDev.new - - unless jasmine_dev.pages_submodule_installed? - puts 'Installing the Github pages submodule:' - system 'git submodule update --init' - puts 'Now continuing...' - end -end - -desc "View full development tasks" -task :list_dev_tasks do - puts "Jasmine uses Thor for command line tasks for development. Here is the command set:" - system "thor list" -end - # TODO: Is there better way to invoke this using Jasmine gem??? task :core_spec do exec "ruby spec/jasmine_self_test_spec.rb" @@ -74,5 +37,3 @@ end desc "Run specs via server" task :jasmine => ['jasmine:server'] - - diff --git a/dist/jasmine-standalone-2.0.0-alpha.zip b/dist/jasmine-standalone-2.0.0-alpha.zip new file mode 100644 index 00000000..0df49dc7 Binary files /dev/null and b/dist/jasmine-standalone-2.0.0-alpha.zip differ diff --git a/grunt/config/compress.js b/grunt/config/compress.js index 8c02cdda..eb7db650 100644 --- a/grunt/config/compress.js +++ b/grunt/config/compress.js @@ -29,7 +29,7 @@ module.exports = { cwd: lib("") }, { - src: [ "boot.js"], + src: [ "boot.js" ], dest: standaloneLibDir, expand: true, cwd: lib("boot") diff --git a/grunt/config/concat.js b/grunt/config/concat.js index a8b9ae2f..b86e4196 100644 --- a/grunt/config/concat.js +++ b/grunt/config/concat.js @@ -1,3 +1,13 @@ +var grunt = require('grunt'); + +function license() { + var currentYear = "" + new Date(Date.now()).getFullYear(); + + return grunt.template.process( + grunt.file.read("grunt/templates/licenseBanner.js.jst"), + { data: { currentYear: currentYear}}); +} + module.exports = { 'jasmine-html': { src: [ @@ -23,7 +33,12 @@ module.exports = { ], dest: 'lib/jasmine-core/jasmine.js' }, + boot: { + src: ['lib/jasmine-core/boot/boot.js'], + dest: 'lib/jasmine-core/boot.js' + }, options: { + banner: license(), process: { data: { version: global.jasmineVersion diff --git a/grunt/tasks/build_standalone.js b/grunt/tasks/build_standalone.js index 285b57b6..84482b8d 100644 --- a/grunt/tasks/build_standalone.js +++ b/grunt/tasks/build_standalone.js @@ -1,14 +1,14 @@ var grunt = require("grunt"); -var _ = require("underscore"); function standaloneTmpDir(path) { return "dist/tmp/" + path; } module.exports = { compileSpecRunner: function() { - var runnerTemplate = _.template(grunt.file.read("lib/templates/SpecRunner.html.jst")), - runner = runnerTemplate({ jasmineVersion: global.jasmineVersion }); + var runnerHtml = grunt.template.process( + grunt.file.read("grunt/templates/SpecRunner.html.jst"), + { data: { jasmineVersion: global.jasmineVersion }}); - grunt.file.write(standaloneTmpDir("SpecRunner.html"), runner); + grunt.file.write(standaloneTmpDir("SpecRunner.html"), runnerHtml); }, cleanSpecRunner: function() { diff --git a/grunt/tasks/spec.js b/grunt/tasks/spec.js new file mode 100644 index 00000000..ceb49465 --- /dev/null +++ b/grunt/tasks/spec.js @@ -0,0 +1,7 @@ +var shell = require('shelljs'); + +module.exports = { + execSpecsInNode: function() { + shell.exec("node spec/node_suite.js --color=true") + } +}; \ No newline at end of file diff --git a/grunt/tasks/version.js b/grunt/tasks/version.js new file mode 100644 index 00000000..f8ff6a10 --- /dev/null +++ b/grunt/tasks/version.js @@ -0,0 +1,14 @@ +var grunt = require("grunt"); + +function gemLib(path) { return './lib/jasmine-core/' + path; } +function nodeToRuby(version) { return version.replace('-', '.'); } + +module.exports = { + copyToGem: function() { + var versionRb = grunt.template.process( + grunt.file.read("grunt/templates/version.rb.jst"), + { data: { jasmineVersion: nodeToRuby(global.jasmineVersion) }}); + + grunt.file.write(gemLib("version.rb"), versionRb); + } +}; diff --git a/lib/templates/SpecRunner.html.jst b/grunt/templates/SpecRunner.html.jst similarity index 100% rename from lib/templates/SpecRunner.html.jst rename to grunt/templates/SpecRunner.html.jst diff --git a/grunt/templates/licenseBanner.js.jst b/grunt/templates/licenseBanner.js.jst new file mode 100644 index 00000000..2b28f223 --- /dev/null +++ b/grunt/templates/licenseBanner.js.jst @@ -0,0 +1,22 @@ +/* +Copyright (c) 2008-<%= currentYear %> Pivotal Labs + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ diff --git a/grunt/templates/version.rb.jst b/grunt/templates/version.rb.jst new file mode 100644 index 00000000..411403c2 --- /dev/null +++ b/grunt/templates/version.rb.jst @@ -0,0 +1,9 @@ +# +# DO NOT Edit this file. Canonical version of Jasmine lives in the repo's package.json. This file is generated +# by a grunt task when the standalone release is built. +# +module Jasmine + module Core + VERSION = "<%= jasmineVersion %>" + end +end diff --git a/jasmine-core.gemspec b/jasmine-core.gemspec index 7f4711e3..2a63cde4 100644 --- a/jasmine-core.gemspec +++ b/jasmine-core.gemspec @@ -17,16 +17,11 @@ Gem::Specification.new do |s| s.files = Dir.glob("./lib/**/*") + Dir.glob("./lib/jasmine-core/spec/**/*.js") s.require_paths = ["lib"] s.add_development_dependency "json_pure", ">= 1.4.3" - s.add_development_dependency "tilt" s.add_development_dependency "sass" s.add_development_dependency "compass" s.add_development_dependency "ragaskar-jsdoc_helper" s.add_development_dependency "rspec" s.add_development_dependency "fuubar" s.add_development_dependency "awesome_print" - s.add_development_dependency "thor" s.add_development_dependency "nokogiri" - s.add_development_dependency "redcarpet", "1.7" - s.add_development_dependency "rocco" - s.add_development_dependency "rdiscount" end diff --git a/jasmine_dev.thor b/jasmine_dev.thor deleted file mode 100644 index 7fe0ca71..00000000 --- a/jasmine_dev.thor +++ /dev/null @@ -1 +0,0 @@ -require "#{File.expand_path(File.dirname(__FILE__))}/tasks/jasmine_dev" \ No newline at end of file diff --git a/lib/jasmine-core/boot.js b/lib/jasmine-core/boot.js new file mode 100644 index 00000000..c8977021 --- /dev/null +++ b/lib/jasmine-core/boot.js @@ -0,0 +1,126 @@ +/* +Copyright (c) 2008-2013 Pivotal Labs + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +// Jasmine boot.js for browser runners - exposes external/global interface, builds the Jasmine environment and executes it. +(function() { + var env = jasmine.getEnv(); + + var jasmineInterface = { + describe: function(description, specDefinitions) { + return env.describe(description, specDefinitions); + }, + + xdescribe: function(description, specDefinitions) { + return env.xdescribe(description, specDefinitions); + }, + + it: function(desc, func) { + return env.it(desc, func); + }, + + xit: function(desc, func) { + return env.xit(desc, func); + }, + + beforeEach: function(beforeEachFunction) { + return env.beforeEach(beforeEachFunction); + }, + + afterEach: function(afterEachFunction) { + return env.afterEach(afterEachFunction); + }, + + expect: function(actual) { + return env.expect(actual); + }, + + pending: function() { + return env.pending(); + }, + + addMatchers: function(matchers) { + return env.addMatchers(matchers); + }, + + spyOn: function(obj, methodName) { + return env.spyOn(obj, methodName); + }, + + clock: env.clock, + setTimeout: env.clock.setTimeout, + clearTimeout: env.clock.clearTimeout, + setInterval: env.clock.setInterval, + clearInterval: env.clock.clearInterval, + + jsApiReporter: new jasmine.JsApiReporter(jasmine) + }; + + if (typeof window == "undefined" && typeof exports == "object") { + extend(exports, jasmineInterface); + } else { + extend(window, jasmineInterface); + } + + var queryString = new jasmine.QueryString({ + getWindowLocation: function() { return window.location; } + }); + + // TODO: move all of catching to raise so we don't break our brains + var catchingExceptions = queryString.getParam("catch"); + env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions); + + var htmlReporter = new jasmine.HtmlReporter({ + env: env, + queryString: queryString, + onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); }, + getContainer: function() { return document.body; }, + createElement: function() { return document.createElement.apply(document, arguments); }, + createTextNode: function() { return document.createTextNode.apply(document, arguments); } + }); + + env.addReporter(jasmineInterface.jsApiReporter); + env.addReporter(htmlReporter); + + var specFilter = new jasmine.HtmlSpecFilter({ + filterString: function() { return queryString.getParam("spec"); } + }); + + env.specFilter = function(spec) { + return specFilter.matches(spec.getFullName()); + }; + + var currentWindowOnload = window.onload; + + window.onload = function() { + if (currentWindowOnload) { + currentWindowOnload(); + } + htmlReporter.initialize(); + env.execute(); + }; + + function extend(destination, source) { + for (var property in source) destination[property] = source[property]; + return destination; + } + +}()); diff --git a/lib/jasmine-core/boot/boot.js b/lib/jasmine-core/boot/boot.js index aa29f812..aea8e00c 100644 --- a/lib/jasmine-core/boot/boot.js +++ b/lib/jasmine-core/boot/boot.js @@ -1,3 +1,4 @@ +// Jasmine boot.js for browser runners - exposes external/global interface, builds the Jasmine environment and executes it. (function() { var env = jasmine.getEnv(); diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index 4f75e167..dcc89137 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -1,3 +1,25 @@ +/* +Copyright (c) 2008-2013 Pivotal Labs + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ jasmine.HtmlReporter = function(options) { var env = options.env || {}, getContainer = options.getContainer, diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 622dc452..32c580e9 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1,3 +1,25 @@ +/* +Copyright (c) 2008-2013 Pivotal Labs + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. @@ -372,22 +394,9 @@ jasmine.createSpyObj = function(baseName, methodNames) { return obj; }; -/** - * @namespace - */ jasmine.util = {}; -/** - * Declare that a child class inherit it's prototype from the parent class. - * - * @private - * @param {Function} childClass - * @param {Function} parentClass - */ jasmine.util.inherit = function(childClass, parentClass) { - /** - * @private - */ var subclass = function() { }; subclass.prototype = parentClass.prototype; diff --git a/lib/jasmine-core/version.rb b/lib/jasmine-core/version.rb index 2dafd0eb..e9afa67a 100644 --- a/lib/jasmine-core/version.rb +++ b/lib/jasmine-core/version.rb @@ -1,6 +1,9 @@ +# +# DO NOT Edit this file. Canonical version of Jasmine lives in the repo's package.json. This file is generated +# by a grunt task when the standalone release is built. +# module Jasmine module Core - VERSION = "1.3.1" + VERSION = "2.0.0.alpha" end end - diff --git a/package.json b/package.json index b350cd47..cfd29227 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,11 @@ "license": "MIT", "version": "2.0.0-alpha", "devDependencies": { + "grunt": "~0.4.1", "grunt-contrib-jshint": "~0.2.0", "grunt-contrib-concat": "~0.1.3", "grunt-contrib-compass": "~0.1.3", "grunt-contrib-compress": "~0.4.1", - "underscore": "~1.4.4" + "shelljs": "~0.1.2" } } diff --git a/spec/runner.html b/spec/runner.html deleted file mode 100644 index ef77db8d..00000000 --- a/spec/runner.html +++ /dev/null @@ -1,50 +0,0 @@ - - - Jasmine Spec Runner: Jasmine Core - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a2e43eb4..5abda95f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,8 +18,6 @@ def project_root File.join(File.expand_path(File.dirname(__FILE__)), '..') end -require "#{project_root}/tasks/jasmine_dev" - def capture_output(capture = true) if capture output = StringIO.new diff --git a/spec/tasks/build_github_pages_spec.rb b/spec/tasks/build_github_pages_spec.rb deleted file mode 100644 index 921ed140..00000000 --- a/spec/tasks/build_github_pages_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper.rb' - -describe "Build Github Pages task" do - - let(:pages_dir) { File.join(Dir.tmpdir, 'pages') } - let(:jasmine_dev) { JasmineDev.new } - - before do - reset_dir pages_dir - end - - describe "when the Github pages submodule is not present" do - before do - jasmine_dev.should_receive(:has_pages_submodule?).and_return(false) - - @output = capture_output { jasmine_dev.build_github_pages pages_dir } - end - - it "should tell the user the task is running" do - @output.should match(/Building Github Pages/) - end - - it "should prompt the user to install the submodule" do - @output.should match(/Submodule for Github Pages isn't present/) - end - end - - describe "when the Github pages submodule is present" do - before do - jasmine_dev.should_receive(:has_pages_submodule?).and_return(true) - - @output = capture_output { jasmine_dev.build_github_pages pages_dir } - end - - it "should tell the user the task is running" do - @output.should match(/Building Github Pages/) - end - - it "should copy the latest jasmine files to the pages dir" do - ['jasmine.js', 'jasmine.css', 'jasmine-html.js'].each do |lib_file| - source = File.read(File.join(project_root, 'lib', 'jasmine-core', lib_file)) - dest = File.read(File.join(pages_dir, 'lib', lib_file)) - - source.should == dest - end - end - - it "should build a new page" do - @output.should match(/rocco/) - File.exist?(File.join(pages_dir, 'introduction.html')).should be_true - end - - it "should copy the rocco output to index.html" do - introduction = File.read(File.join(pages_dir, 'introduction.html')) - index = File.read(File.join(pages_dir, 'index.html')) - - index.should == introduction - end - end -end \ No newline at end of file diff --git a/spec/tasks/count_specs_spec.rb b/spec/tasks/count_specs_spec.rb deleted file mode 100644 index 3f4afd09..00000000 --- a/spec/tasks/count_specs_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper.rb' - -describe "Spec counting task" do - - let(:jasmine_dev) { JasmineDev.new } - - before do - @output = capture_output { jasmine_dev.count_specs } - end - - it "should tell the developer that the specs are being counted" do - @output.should match(/Counting specs/) - end - - it "should report the number of specs that will run in node" do - @output.should match(/\d+ \e\[0mspecs for Node.js/) - end - - it "should report the number of specs that will run in the browser" do - @output.should match(/\d+ \e\[0mspecs for Browser/) - end - - it "should remind the developer to check the count" do - @output.should match(/Please verify/) - end -end \ No newline at end of file diff --git a/spec/tasks/execute_specs_spec.rb b/spec/tasks/execute_specs_spec.rb deleted file mode 100644 index 040378ef..00000000 --- a/spec/tasks/execute_specs_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'spec_helper.rb' - -describe "Spec tasks" do - - let(:jasmine_dev) { JasmineDev.new } - - describe "execute_specs_in_node" do - describe "when Node.js is not present" do - before do - jasmine_dev.should_receive(:has_node?).and_return(false) - @output = capture_output { jasmine_dev.execute_specs_in_node } - end - - it "should prompt the user to install Node" do - @output.should match(/Node\.js is required/) - end - end - - describe "when Node.js is present" do - before do - jasmine_dev.should_receive(:has_node?).and_return(true) - @output = capture_output { jasmine_dev.execute_specs_in_node } - end - - it "should build the distribution" do - @output.should match(/Building Jasmine distribution/) - end - - it "should tell the developer that the specs are being counted" do - @output.should match(/Counting specs/) - end - - it "should tell the user that the specs are running in Node.js" do - @output.should match(/specs via Node/) - @output.should match(/Started/) - @output.should match(/\d+ specs, 0 failures/) - end - end - end - - describe "execute_specs_in_browser" do - before do - jasmine_dev.should_receive(:run) - @output = capture_output { jasmine_dev.execute_specs_in_browser } - end - - it "should build the distribution" do - @output.should match(/Building Jasmine distribution/) - end - - it "should tell the developer that the specs are being counted" do - @output.should match(/Counting specs/) - end - - it "should tell the user that the specs are running in the broswer" do - @output.should match(/specs via the default web browser/) - end - end - - describe "execute_specs" do - before do - @output = capture_output { jasmine_dev.execute_specs } - end - - it "should build the distribution" do - @output.should match(/Building Jasmine distribution/) - end - - it "should tell the developer that the specs are being counted" do - @output.should match(/Counting specs/) - end - - it "should tell the user that the specs are running in Node.js" do - @output.should match(/specs via Node/) - end - - it "should tell the user that the specs are running in the broswer" do - @output.should match(/specs via the default web browser/) - end - end -end \ No newline at end of file diff --git a/spec/tasks/release_spec.rb b/spec/tasks/release_spec.rb deleted file mode 100644 index b7eff4b5..00000000 --- a/spec/tasks/release_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -require 'spec_helper.rb' - -describe "Release task" do - - let(:jasmine_dev) { JasmineDev.new } - - describe "when the pages submodule is not present" do - before do - jasmine_dev.should_receive(:has_pages_submodule?).and_return(false) - - @output = capture_output { jasmine_dev.release_prep } - end - - it "should tell the user the task is running" do - @output.should match(/Building Release/) - end - - it "should prompt the user to install the submodule" do - @output.should match(/Submodule for Github Pages isn't present/) - end - end - - describe "when the pages submodule is present" do - before do - JasmineDev.any_instance.should_receive(:write_version_files) - JasmineDev.any_instance.should_receive(:build_distribution) - JasmineDev.any_instance.should_receive(:build_standalone_distribution) - JasmineDev.any_instance.should_receive(:build_github_pages) - - jasmine_dev.should_receive(:has_pages_submodule?).and_return(true) - - @output = capture_output { jasmine_dev.release_prep } - end - - it "should tell the user the task is running" do - @output.should match(/Building Release/) - end - end -end \ No newline at end of file diff --git a/src/html/jasmine.css b/src/html/jasmine.css index 0a0ce800..da978dad 100644 --- a/src/html/jasmine.css +++ b/src/html/jasmine.css @@ -1,54 +1,107 @@ +/* line 24, _HTMLReporter.scss */ body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; } +/* line 31, _HTMLReporter.scss */ .html-reporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } +/* line 38, _HTMLReporter.scss */ .html-reporter a { text-decoration: none; } +/* line 41, _HTMLReporter.scss */ .html-reporter a:hover { text-decoration: underline; } +/* line 46, _HTMLReporter.scss */ .html-reporter p, .html-reporter h1, .html-reporter h2, .html-reporter h3, .html-reporter h4, .html-reporter h5, .html-reporter h6 { margin: 0; line-height: 14px; } +/* line 58, _HTMLReporter.scss */ .html-reporter .banner, .html-reporter .symbol-summary, .html-reporter .summary, .html-reporter .result-message, .html-reporter .spec .description, .html-reporter .spec-detail .description, .html-reporter .alert .bar, .html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; } +/* line 63, _HTMLReporter.scss */ .html-reporter .banner .version { margin-left: 14px; } +/* line 69, _HTMLReporter.scss */ .html-reporter #jasmine_content { position: fixed; right: 100%; } +/* line 74, _HTMLReporter.scss */ .html-reporter .version { color: #aaaaaa; } +/* line 80, _HTMLReporter.scss */ .html-reporter .banner { margin-top: 14px; } +/* line 84, _HTMLReporter.scss */ .html-reporter .duration { color: #aaaaaa; float: right; } +/* line 91, _HTMLReporter.scss */ .html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; } +/* line 95, _HTMLReporter.scss */ .html-reporter .symbol-summary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; } +/* line 104, _HTMLReporter.scss */ .html-reporter .symbol-summary li.passed { font-size: 14px; } +/* line 107, _HTMLReporter.scss */ .html-reporter .symbol-summary li.passed:before { color: #5e7d00; content: "\02022"; } +/* line 113, _HTMLReporter.scss */ .html-reporter .symbol-summary li.failed { line-height: 9px; } +/* line 116, _HTMLReporter.scss */ .html-reporter .symbol-summary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; } +/* line 124, _HTMLReporter.scss */ .html-reporter .symbol-summary li.disabled { font-size: 14px; } +/* line 127, _HTMLReporter.scss */ .html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; } +/* line 133, _HTMLReporter.scss */ .html-reporter .symbol-summary li.pending { line-height: 17px; } +/* line 135, _HTMLReporter.scss */ .html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; } +/* line 143, _HTMLReporter.scss */ .html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; } +/* line 152, _HTMLReporter.scss */ .html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } +/* line 159, _HTMLReporter.scss */ .html-reporter .bar.failed { background-color: #b03911; } +/* line 163, _HTMLReporter.scss */ .html-reporter .bar.passed { background-color: #a6b779; } +/* line 167, _HTMLReporter.scss */ .html-reporter .bar.skipped { background-color: #bababa; } +/* line 171, _HTMLReporter.scss */ .html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; } +/* line 175, _HTMLReporter.scss */ .html-reporter .bar.menu a { color: #333333; } +/* line 180, _HTMLReporter.scss */ .html-reporter .bar a { color: white; } +/* line 188, _HTMLReporter.scss */ .html-reporter.spec-list .bar.menu.failure-list, .html-reporter.spec-list .results .failures { display: none; } +/* line 195, _HTMLReporter.scss */ .html-reporter.failure-list .bar.menu.spec-list, .html-reporter.failure-list .summary { display: none; } +/* line 200, _HTMLReporter.scss */ .html-reporter .running-alert { background-color: #666666; } +/* line 206, _HTMLReporter.scss */ .html-reporter .results { margin-top: 14px; } +/* line 214, _HTMLReporter.scss */ .html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } +/* line 218, _HTMLReporter.scss */ .html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } +/* line 223, _HTMLReporter.scss */ .html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } +/* line 228, _HTMLReporter.scss */ .html-reporter.showDetails .summary { display: none; } +/* line 232, _HTMLReporter.scss */ .html-reporter.showDetails #details { display: block; } +/* line 237, _HTMLReporter.scss */ .html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } +/* line 244, _HTMLReporter.scss */ .html-reporter .summary { margin-top: 14px; } +/* line 247, _HTMLReporter.scss */ .html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; } +/* line 253, _HTMLReporter.scss */ .html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; } +/* line 260, _HTMLReporter.scss */ .html-reporter .summary li.passed a { color: #5e7d00; } +/* line 264, _HTMLReporter.scss */ .html-reporter .summary li.failed a { color: #b03911; } +/* line 268, _HTMLReporter.scss */ .html-reporter .summary li.pending a { color: #ba9d37; } +/* line 274, _HTMLReporter.scss */ .html-reporter .description + .suite { margin-top: 0; } +/* line 278, _HTMLReporter.scss */ .html-reporter .suite { margin-top: 14px; } +/* line 281, _HTMLReporter.scss */ .html-reporter .suite a { color: #333333; } +/* line 289, _HTMLReporter.scss */ .html-reporter .failures .spec-detail { margin-bottom: 28px; } +/* line 292, _HTMLReporter.scss */ .html-reporter .failures .spec-detail .description { display: block; color: white; background-color: #b03911; } +/* line 304, _HTMLReporter.scss */ .html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; } +/* line 312, _HTMLReporter.scss */ .html-reporter .result-message span.result { display: block; } -.html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #dddddd; background: white; white-space: pre; } +/* line 316, _HTMLReporter.scss */ +.html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } diff --git a/tasks/docs.rb b/tasks/docs.rb deleted file mode 100644 index b940aecc..00000000 --- a/tasks/docs.rb +++ /dev/null @@ -1,17 +0,0 @@ -desc "Build jasmine documentation" -task :doc => :require_pages_submodule do - puts 'Creating Jasmine Documentation' - require 'rubygems' - require 'jsdoc_helper' - - FileUtils.rm_r "pages/jsdoc", :force => true - - JsdocHelper::Rake::Task.new(:lambda_jsdoc) do |t| - t[:files] = core_sources + html_sources + console_sources - t[:options] = "-a" - t[:out] = "pages/jsdoc" - # JsdocHelper bug: template must be relative to the JsdocHelper gem, ick - t[:template] = File.join("../".*(100), Dir::getwd, "jsdoc-template") - end - Rake::Task[:lambda_jsdoc].invoke -end diff --git a/tasks/jasmine_dev.rb b/tasks/jasmine_dev.rb deleted file mode 100644 index 236c9424..00000000 --- a/tasks/jasmine_dev.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'thor' -require 'json' -require 'tilt' -require 'ostruct' - -$:.unshift(File.join(File.dirname(__FILE__), "jasmine_dev")) - -require "base" -require "build_github_pages" -require "count_specs" -require "execute_specs" -require "release" diff --git a/tasks/jasmine_dev/base.rb b/tasks/jasmine_dev/base.rb deleted file mode 100644 index 07dc09e4..00000000 --- a/tasks/jasmine_dev/base.rb +++ /dev/null @@ -1,54 +0,0 @@ -class JasmineDev < Thor - include Thor::Actions - - def self.source_root - File.dirname(__FILE__) - end - - def self.source_paths - [ - File.join(JasmineDev.project_root, 'lib', 'jasmine-core'), - JasmineDev.project_root - ] - end - - def self.project_root - File.join(JasmineDev.source_root, '..', '..') - end - - def self.spacer - "\n--------------------" - end - - no_tasks do - # allows merged stdout in test with low-harassment - def run_with_output(*run_args) - say run *run_args - end - - def node_installed? - return true if has_node? - - say "Node.js is required to develop Jasmine. Please visit http://nodejs.org to install.", - :red - false - end - - def has_node? - run "which node", :verbose => false, :capture => true - $?.exitstatus == 0 - end - - def pages_submodule_installed? - return true if has_pages_submodule? - - say "Submodule for Github Pages isn't present. Run git submodule update --init", - :red - false - end - - def has_pages_submodule? - File.exist?(File.join(JasmineDev.project_root, 'pages', 'index.html')) - end - end -end diff --git a/tasks/jasmine_dev/build_github_pages.rb b/tasks/jasmine_dev/build_github_pages.rb deleted file mode 100644 index 373d3e39..00000000 --- a/tasks/jasmine_dev/build_github_pages.rb +++ /dev/null @@ -1,28 +0,0 @@ -class JasmineDev < Thor - - desc "build_github_pages", "Build static pages for pivotal.github.com/jasmine" - def build_github_pages(pages_dir = File.expand_path(File.join('.', 'pages'))) - say JasmineDev.spacer - - say "Building Github Pages...", :cyan - - return unless pages_submodule_installed? - - project_lib_dir = File.join(JasmineDev.project_root, 'lib', 'jasmine-core') - - pages_lib_dir = File.join(pages_dir, 'lib') - FileUtils.rm_r(pages_lib_dir) if File.exist?(pages_lib_dir) - - ['jasmine.js', 'jasmine-html.js', 'jasmine.css'].each do |file| - copy_file File.join(project_lib_dir, file), File.join(pages_lib_dir, file) - end - - inside File.join(JasmineDev.project_root, 'pages', 'src') do - run_with_output "bundle exec rocco -l js introduction.js -t layout.mustache -o #{pages_dir}" - end - - inside pages_dir do - copy_file File.join(pages_dir,'introduction.html'), File.join(pages_dir,'index.html') - end - end -end \ No newline at end of file diff --git a/tasks/jasmine_dev/count_specs.rb b/tasks/jasmine_dev/count_specs.rb deleted file mode 100644 index 1a96d24b..00000000 --- a/tasks/jasmine_dev/count_specs.rb +++ /dev/null @@ -1,29 +0,0 @@ -class JasmineDev < Thor - - desc "count_specs", "Count the number of specs for each test runner" - def count_specs - say JasmineDev.spacer - say "Counting specs...", :cyan - - core_spec_count = count_specs_in(File.join('spec', 'core')) - console_spec_count = count_specs_in(File.join('spec', 'console')) - html_spec_count = count_specs_in(File.join('spec', 'html')) - - say "#{(core_spec_count + console_spec_count).to_s} ", :yellow - say "specs for Node.js runner (exclude DOM-related specs)" - say "#{(core_spec_count + console_spec_count + html_spec_count).to_s} ", :yellow - say "specs for Browser runner (all specs)" - say "\n" - say "Please verify that these numbers match the runner output." - end - - no_tasks do - def count_specs_in(relative_path) - files = Dir.glob(File.join(JasmineDev.project_root, relative_path, '*.js')) - files.inject(0) do |count, file| - File.read(file).scan(/^\s*it\(.*/) { |s| count += 1 } - count - end - end - end -end diff --git a/tasks/jasmine_dev/execute_specs.rb b/tasks/jasmine_dev/execute_specs.rb deleted file mode 100644 index 52b6b9ca..00000000 --- a/tasks/jasmine_dev/execute_specs.rb +++ /dev/null @@ -1,54 +0,0 @@ -class JasmineDev < Thor - - desc "execute_specs_in_node", "Run all relevant specs in Node.js" - - def execute_specs_in_node - return unless node_installed? - - `grunt buildDistribution` - invoke :count_specs - - say JasmineDev.spacer - - say "Running all appropriate specs via Node.js...", :cyan - - with_color_option = STDOUT.isatty ? "--color" : "--noColor" - - run_with_output "node spec/node_suite.js #{with_color_option}", :capture => true - end - - desc "execute_specs_in_browser", "Run all relevent specs in your default browser" - - def execute_specs_in_browser - return unless node_installed? - - `grunt buildDistribution` - invoke :count_specs - - say JasmineDev.spacer - - say "Running all appropriate specs via the default web browser...", :cyan - - open_specs_in_browser - end - - desc "execute_specs", "Run all of Jasmine's JavaScript specs" - - def execute_specs - invoke :execute_specs_in_node - invoke :execute_specs_in_browser - end - - no_tasks do - def open_specs_in_browser - require 'rbconfig' - - case Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG['host_os'] - when /linux/ - run "xdg-open spec/runner.html" - else - run "open spec/runner.html" - end - end - end -end diff --git a/tasks/jasmine_dev/release.rb b/tasks/jasmine_dev/release.rb deleted file mode 100644 index f75ecc2d..00000000 --- a/tasks/jasmine_dev/release.rb +++ /dev/null @@ -1,13 +0,0 @@ -class JasmineDev < Thor - - desc 'release_prep', "Update version and build distributions" - def release_prep - say JasmineDev.spacer - - say "Building Release...", :cyan - - return unless pages_submodule_installed? - - invoke :build_github_pages - end -end \ No newline at end of file