Compare commits
18 Commits
v1.1.0.rc1
...
v1.1.0.rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a617b59e6a | ||
|
|
917b37481e | ||
|
|
67bbc98faa | ||
|
|
620f7b6e4c | ||
|
|
b722f416c7 | ||
|
|
634a7dc402 | ||
|
|
a4522e4dce | ||
|
|
e113c338d0 | ||
|
|
b81f690a25 | ||
|
|
c06e189699 | ||
|
|
67b6cfb828 | ||
|
|
57e622fb2a | ||
|
|
c0664dd6aa | ||
|
|
b640ce6fc0 | ||
|
|
e9af7834f5 | ||
|
|
0d43ae9c38 | ||
|
|
3775919c92 | ||
|
|
a692ff8c95 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,5 +7,6 @@ site/
|
||||
.rvmrc
|
||||
*.gem
|
||||
.bundle
|
||||
tags
|
||||
Gemfile.lock
|
||||
pkg/*
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
# Developing for Jasmine Core
|
||||
# Developing for Jasmine Core
|
||||
|
||||
This repo is for the core code of Jasmine - `jasmine.js`. This implements the basic spec-defining, -executing, and -results-reporting logic.
|
||||
## How to Contribute
|
||||
|
||||
## How to write new Jasmine code
|
||||
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.
|
||||
|
||||
## How to write new Jasmine code
|
||||
|
||||
Or, How to make a successful pull request
|
||||
|
||||
* _Do not change the public interface_. Lots of projects depend on Jasmine and if you aren't careful you'll break them
|
||||
* _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
|
||||
* _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.
|
||||
|
||||
|
||||
1
Gemfile
1
Gemfile
@@ -1,3 +1,4 @@
|
||||
source :rubygems
|
||||
gem "term-ansicolor", :require => "term/ansicolor"
|
||||
gem "rake"
|
||||
gemspec
|
||||
|
||||
@@ -6,6 +6,13 @@ 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/)
|
||||
|
||||
## What's Here?
|
||||
|
||||
*
|
||||
|
||||
|
||||
|
||||
|
||||
## Support
|
||||
|
||||
* Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
||||
@@ -14,32 +21,6 @@ Documentation & guides live here: [http://pivotal.github.com/jasmine/](http://pi
|
||||
* 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)
|
||||
|
||||
## How to Contribute
|
||||
|
||||
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.
|
||||
|
||||
### Development Environment
|
||||
|
||||
Jasmine Core relies on Ruby for executing the test suite and building the project for release. The spec suite runs in any major, modern browser (Firefox, Safari, Chrome, and yes various IE's) and in [Node.js](http://nodejs.org). While you probably have browsers installed, you want to make sure that Ruby and Node are present.
|
||||
|
||||
### How to Develop for Jasmine Core
|
||||
|
||||
* Write specs
|
||||
* Make them pass in a browser (or three):
|
||||
* open `spec/runner.html` in your browsers
|
||||
* `rake spec:browser` will run in the default browser on MacOS
|
||||
* Make them pass in Node: `rake spec:node`
|
||||
* Fix any warnings or errors from JSHint: `rake jasmine:lint`
|
||||
|
||||
Running `rake spec` will run the browser tests, then run specs in Node, then run JSHint. But this will only run in the default browser and only on MacOS (for now).
|
||||
|
||||
|
||||
### Making a Successful Pull Request
|
||||
|
||||
* __Include specs for your work__ - it helps us understand your intent and makes sure that future development doesn't break your work
|
||||
* __Ensure the full test suite is green__ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users
|
||||
|
||||
Do these things and we'll take a look.
|
||||
|
||||
## Maintainers
|
||||
|
||||
|
||||
6
Rakefile
6
Rakefile
@@ -11,13 +11,17 @@ end
|
||||
task :default => :spec
|
||||
|
||||
task :require_pages_submodule do
|
||||
raise "Submodule for Github Pages isn't present. Run git submodule update --init" unless File.exist?('pages/download.html')
|
||||
raise "Submodule for Github Pages isn't present. Run git submodule update --init" unless pages_submodule_present
|
||||
end
|
||||
|
||||
task :require_node do
|
||||
raise "\nNode.js is required to develop code for Jasmine. Please visit http://nodejs.org to install.\n\n" unless node_installed?
|
||||
end
|
||||
|
||||
def pages_submodule_present
|
||||
File.exist?('pages/download.html')
|
||||
end
|
||||
|
||||
def node_installed?
|
||||
`which node` =~ /node/
|
||||
end
|
||||
|
||||
@@ -1,12 +1,40 @@
|
||||
## Release
|
||||
__Jasmine Core Maintainers Only__
|
||||
# How to work on a Jasmine Release
|
||||
|
||||
The current version lives in the file `src/version.json`. We attempt to stick to Semantic Versioning
|
||||
## Development
|
||||
___Jasmine Core Maintainers Only___
|
||||
|
||||
## The Github Pages
|
||||
Follow the instructions in `Contribute.markdown` during development.
|
||||
|
||||
### Git Commits
|
||||
|
||||
|
||||
### Version
|
||||
|
||||
We attempt to stick to [Semantic Versioning](). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible.
|
||||
|
||||
The current version lives in the file `src/version.json`. This file should be set to the version that is _currently_ under development. That is, if version 1.0.0 is the current release then version should be incremented say, to 1.1.0.
|
||||
|
||||
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
||||
|
||||
|
||||
### Update the Github Pages (as needed)
|
||||
|
||||
Github pages have to exist in a branch called gh-pages in order for their app to serve them. This repo adds that branch as a submodule under the `pages` directory. This is a bit of a hack, but it allows us to work with the pages and the source at the same time and with one set of rake tasks.
|
||||
|
||||
If you want to submit changes to this repo and aren't a Pivotal Labs employee, you can fork and work in the gh-pages branch. You won't be able to edit the pages in the submodule off of master.
|
||||
If you want to submit changes to this repo and aren't a Pivotal Labs employee, you can fork and work in the `gh-pages` branch. You won't be able to edit the pages in the submodule off of master.
|
||||
|
||||
The pages are built with [Frank](https://github.com/blahed/frank). All the source for these pages live in the pages_source directory.
|
||||
The pages are built with [Frank](https://github.com/blahed/frank). All the source for these pages live in the `pages/pages_source` directory.
|
||||
|
||||
## Release
|
||||
|
||||
When ready to release - specs are all green and the stories are done:
|
||||
|
||||
1. Update the version in `version.json` to a release candidate - add an `rc` property with a value of 1
|
||||
1. Update any comments on the public interfaces
|
||||
1. `rake doc` - builds the `jsdoc` pages
|
||||
1. Update any links or top-level landing page for the Github Pages
|
||||
1. `rake standalone` - builds the standalone distribution ZIP file
|
||||
1. `rake build_pages` - builds the Github Pages
|
||||
1. `rake release` - tags the repo with the version, builds the `jasmine-core` gem, pushes the gem to Rubygems.org
|
||||
|
||||
There should be a post to Pivotal Labs blog and a tweet to that link.
|
||||
|
||||
@@ -13,8 +13,7 @@ Gem::Specification.new do |s|
|
||||
s.homepage = "http://pivotal.github.com/jasmine"
|
||||
s.rubyforge_project = "jasmine-core"
|
||||
|
||||
s.files = Dir.glob("./lib/**/*")
|
||||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
||||
s.files = Dir.glob("./lib/**/*") + Dir.glob("./lib/jasmine-core/spec/**/*.js")
|
||||
s.require_paths = ["lib"]
|
||||
s.add_development_dependency "term-ansicolor"
|
||||
s.add_development_dependency "json_pure", ">= 1.4.3"
|
||||
|
||||
@@ -9,6 +9,25 @@ module Jasmine
|
||||
(["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq
|
||||
end
|
||||
|
||||
SPEC_TYPES = ["core", "html", "node"]
|
||||
|
||||
def core_spec_files
|
||||
spec_files("core")
|
||||
end
|
||||
|
||||
def html_spec_files
|
||||
spec_files("html")
|
||||
end
|
||||
|
||||
def node_spec_files
|
||||
spec_files("node")
|
||||
end
|
||||
|
||||
def spec_files(type)
|
||||
raise ArgumentError.new("Unrecognized spec type") unless SPEC_TYPES.include?(type)
|
||||
(Dir.glob(File.join(path, "spec", type, "*.js"))).map { |f| File.join("spec", type, File.basename(f)) }.uniq
|
||||
end
|
||||
|
||||
def css_files
|
||||
Dir.glob(File.join(path, "*.css")).map { |f| File.basename(f) }
|
||||
end
|
||||
|
||||
@@ -735,17 +735,17 @@ jasmine.Env.prototype.version = function () {
|
||||
* @returns string containing jasmine version build info, if set.
|
||||
*/
|
||||
jasmine.Env.prototype.versionString = function() {
|
||||
if (jasmine.version_) {
|
||||
var version = this.version();
|
||||
var versionString = version.major + "." + version.minor + "." + version.build;
|
||||
if (version.release_candidate) {
|
||||
versionString += ".rc" + version.release_candidate
|
||||
}
|
||||
versionString += " revision " + version.revision
|
||||
return versionString;
|
||||
} else {
|
||||
if (!jasmine.version_) {
|
||||
return "version unknown";
|
||||
}
|
||||
|
||||
var version = this.version();
|
||||
var versionString = version.major + "." + version.minor + "." + version.build;
|
||||
if (version.release_candidate) {
|
||||
versionString += ".rc" + version.release_candidate
|
||||
}
|
||||
versionString += " revision " + version.revision;
|
||||
return versionString;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2472,5 +2472,6 @@ jasmine.version_= {
|
||||
"major": 1,
|
||||
"minor": 1,
|
||||
"build": 0,
|
||||
"revision": 1308358300
|
||||
"revision": 1308965645,
|
||||
"release_candidate": 2
|
||||
};
|
||||
|
||||
1
lib/jasmine-core/spec
Symbolic link
1
lib/jasmine-core/spec
Symbolic link
@@ -0,0 +1 @@
|
||||
../../spec
|
||||
@@ -1,8 +1,6 @@
|
||||
module Jasmine
|
||||
module Core
|
||||
require 'json'
|
||||
VERSION_HASH = JSON.parse(File.new(File.join(File.dirname(__FILE__), "..", "..", "src", "version.json")).read);
|
||||
VERSION = "#{VERSION_HASH['major']}.#{VERSION_HASH['minor']}.#{VERSION_HASH['build']}"
|
||||
VERSION << ".rc#{VERSION_HASH['release_candidate']}" if VERSION_HASH['release_candidate']
|
||||
VERSION = "1.1.0.rc2"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
2
pages
2
pages
Submodule pages updated: d08ce2de24...a9d577eb45
@@ -51,17 +51,17 @@ jasmine.Env.prototype.version = function () {
|
||||
* @returns string containing jasmine version build info, if set.
|
||||
*/
|
||||
jasmine.Env.prototype.versionString = function() {
|
||||
if (jasmine.version_) {
|
||||
var version = this.version();
|
||||
var versionString = version.major + "." + version.minor + "." + version.build;
|
||||
if (version.release_candidate) {
|
||||
versionString += ".rc" + version.release_candidate
|
||||
}
|
||||
versionString += " revision " + version.revision
|
||||
return versionString;
|
||||
} else {
|
||||
if (!jasmine.version_) {
|
||||
return "version unknown";
|
||||
}
|
||||
|
||||
var version = this.version();
|
||||
var versionString = version.major + "." + version.minor + "." + version.build;
|
||||
if (version.release_candidate) {
|
||||
versionString += ".rc" + version.release_candidate
|
||||
}
|
||||
versionString += " revision " + version.revision;
|
||||
return versionString;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
jasmine.version_= {
|
||||
"major": <%= major %>,
|
||||
"minor": <%= minor %>,
|
||||
"build": <%= build %>,
|
||||
"revision": <%= revision %><%= %Q{,\n "rc": #{rc}} if rc %>
|
||||
};
|
||||
6
src/templates/version.js.erb
Normal file
6
src/templates/version.js.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
jasmine.version_= {
|
||||
"major": <%= major %>,
|
||||
"minor": <%= minor %>,
|
||||
"build": <%= build %>,
|
||||
"revision": <%= revision %><%= %Q{,\n "release_candidate": #{release_candidate}} if release_candidate %>
|
||||
};
|
||||
6
src/templates/version.rb.erb
Normal file
6
src/templates/version.rb.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
module Jasmine
|
||||
module Core
|
||||
VERSION = "<%= "#{major}.#{minor}.#{build}" %><%= ".rc#{release_candidate}" if release_candidate %>"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,5 +2,6 @@ jasmine.version_= {
|
||||
"major": 1,
|
||||
"minor": 1,
|
||||
"build": 0,
|
||||
"revision": 1308358300
|
||||
"revision": 1308965645,
|
||||
"release_candidate": 2
|
||||
};
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
"major": 1,
|
||||
"minor": 1,
|
||||
"build": 0,
|
||||
"release_candidate": 1
|
||||
"release_candidate": 2
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
desc "Build core jasmine.js"
|
||||
task :build_dist => [:lint, :write_version_file] do
|
||||
task :build_dist => [:lint, :write_version_files] do
|
||||
puts 'Building Jasmine distribution from source'.cyan
|
||||
|
||||
concat_into('lib/jasmine-core/jasmine.js') { core_sources + version_source_file }
|
||||
concat_into('lib/jasmine-core/jasmine-html.js') { html_sources }
|
||||
concat_into('./lib/jasmine-core/jasmine.js') { core_sources + version_source_file }
|
||||
concat_into('./lib/jasmine-core/jasmine-html.js') { html_sources }
|
||||
|
||||
FileUtils.cp('src/html/jasmine.css', 'lib/jasmine-core/jasmine.css')
|
||||
FileUtils.cp('./src/html/jasmine.css', './lib/jasmine-core/jasmine.css')
|
||||
end
|
||||
|
||||
def concat_into(output_file, &block)
|
||||
@@ -25,18 +25,22 @@ end
|
||||
|
||||
task :hint => :lint
|
||||
|
||||
task :write_version_file do
|
||||
template = Tilt.new('src/templates/version.erb')
|
||||
task :write_version_files do
|
||||
scope = OpenStruct.new(:major => version_hash["major"],
|
||||
:minor => version_hash["minor"],
|
||||
:build => version_hash["build"],
|
||||
:release_candidate => version_hash["release_candidate"],
|
||||
:revision => Time.now.to_i)
|
||||
|
||||
File.open('src/version.js', 'w+') do |f|
|
||||
f << template.render(scope)
|
||||
js_template = Tilt.new('./src/templates/version.js.erb')
|
||||
File.open('./src/version.js', 'w+') do |f|
|
||||
f << js_template.render(scope)
|
||||
end
|
||||
|
||||
rb_template = Tilt.new('./src/templates/version.rb.erb')
|
||||
File.open('./lib/jasmine-core/version.rb', 'w+') do |f|
|
||||
f << rb_template.render(scope)
|
||||
end
|
||||
end
|
||||
|
||||
def version_source_file
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require 'json'
|
||||
|
||||
def core_sources
|
||||
first_sources = JSON.parse(File.read('src/SourcesList.json')).collect { |f| "./src/core/#{f}" }
|
||||
first_sources = JSON.parse(File.read('./src/SourcesList.json')).collect { |f| "./src/core/#{f}" }
|
||||
|
||||
remaining_sources = Dir.glob('./src/core/*.js').reject { |f| first_sources.include?(f) }.sort
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ task :build_pages => :require_pages_submodule do
|
||||
system("frank export ../pages_output")
|
||||
end
|
||||
puts "\n"
|
||||
puts "Copying built website to the root of the gh-pages branch"
|
||||
puts "Copying built website to the root of the gh-pages branch".cyan
|
||||
puts "\n\n"
|
||||
system("cp -r pages_output/* .")
|
||||
end
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
require 'ostruct'
|
||||
|
||||
desc "Build standalone distribution, block if zip of current version"
|
||||
task :standalone_safe => [:require_pages_submodule, :protect_current_dist_zip, :build_spec_runner_html]
|
||||
|
||||
desc "Build standalone distribution"
|
||||
task :standalone => [:require_pages_submodule, :build_spec_runner_html] do
|
||||
task :standalone => [:require_pages_submodule, :protect_current_dist_zip, :build_spec_runner_html] do
|
||||
require 'tmpdir'
|
||||
|
||||
zip_root = File.join(Dir.tmpdir, "zip_root")
|
||||
@@ -81,5 +78,14 @@ task :protect_current_dist_zip do
|
||||
dist_dir = File.join(root, 'pages/downloads')
|
||||
zip_file_name = File.join(dist_dir, "jasmine-standalone-#{version_string}.zip")
|
||||
|
||||
raise "STOPPED: #{zip_file_name} already exists" if File.exist?(zip_file_name)
|
||||
zip_present_message = "\n\n"
|
||||
zip_present_message << "==> STOPPED <==".red
|
||||
zip_present_message << "\n\n"
|
||||
zip_present_message << "The file ".red + "#{zip_file_name}" + " already exists.".red + "\n"
|
||||
zip_present_message << "If you should be building the next version, update src/version.json"
|
||||
zip_present_message << "\n"
|
||||
zip_present_message << "If the version is correct, you must be trying to re-build the standalone ZIP. Delete the ZIP and rebuild."
|
||||
zip_present_message << "\n"
|
||||
|
||||
raise zip_present_message if File.exist?(zip_file_name)
|
||||
end
|
||||
|
||||
5
tasks/version.rb
Normal file
5
tasks/version.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
task :version do
|
||||
require 'pp'
|
||||
pp version_hash
|
||||
pp version_string
|
||||
end
|
||||
Reference in New Issue
Block a user