evergreen 1.0.0.rc → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -2
- data/config/routes.rb +1 -1
- data/lib/evergreen.rb +2 -6
- data/lib/evergreen/application.rb +38 -59
- data/lib/evergreen/cli.rb +2 -2
- data/lib/evergreen/runner.rb +6 -3
- data/lib/evergreen/server.rb +1 -5
- data/lib/evergreen/suite.rb +1 -13
- data/lib/evergreen/tasks.rb +1 -1
- data/lib/evergreen/version.rb +1 -1
- data/lib/jasmine/Contribute.markdown +44 -0
- data/lib/jasmine/Gemfile +4 -6
- data/lib/jasmine/MIT.LICENSE +1 -1
- data/lib/jasmine/README.markdown +17 -14
- data/lib/jasmine/Rakefile +21 -170
- data/lib/jasmine/Release.markdown +40 -0
- data/lib/jasmine/images/jasmine_favicon.png +0 -0
- data/lib/jasmine/jasmine-core.gemspec +22 -0
- data/lib/jasmine/jshint/jshint.js +5919 -0
- data/lib/jasmine/jshint/run.js +99 -0
- data/lib/jasmine/lib/jasmine-core.rb +36 -0
- data/lib/jasmine/lib/jasmine-core/example/SpecRunner.html +54 -0
- data/lib/jasmine/{example → lib/jasmine-core/example}/spec/PlayerSpec.js +0 -0
- data/lib/jasmine/{example → lib/jasmine-core/example}/spec/SpecHelper.js +3 -3
- data/lib/jasmine/{example → lib/jasmine-core/example}/src/Player.js +0 -0
- data/lib/jasmine/{example → lib/jasmine-core/example}/src/Song.js +0 -0
- data/lib/jasmine/lib/{jasmine-html.js → jasmine-core/jasmine-html.js} +6 -4
- data/lib/jasmine/lib/{jasmine.css → jasmine-core/jasmine.css} +0 -0
- data/lib/jasmine/lib/{jasmine.js → jasmine-core/jasmine.js} +103 -48
- data/lib/jasmine/lib/{json2.js → jasmine-core/json2.js} +0 -0
- data/lib/jasmine/lib/jasmine-core/version.rb +6 -0
- data/lib/jasmine/spec/console/ConsoleReporterSpec.js +451 -0
- data/lib/jasmine/spec/{suites → core}/BaseSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/CustomMatchersSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/EnvSpec.js +3 -2
- data/lib/jasmine/spec/{suites → core}/ExceptionsSpec.js +46 -4
- data/lib/jasmine/spec/{suites → core}/JsApiReporterSpec.js +1 -1
- data/lib/jasmine/spec/{suites → core}/MatchersSpec.js +87 -44
- data/lib/jasmine/spec/{suites → core}/MockClockSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/MultiReporterSpec.js +3 -3
- data/lib/jasmine/spec/{suites → core}/NestedResultsSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/PrettyPrintSpec.js +0 -6
- data/lib/jasmine/spec/{suites → core}/QueueSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/ReporterSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/RunnerSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/SpecRunningSpec.js +14 -9
- data/lib/jasmine/spec/{suites → core}/SpecSpec.js +1 -1
- data/lib/jasmine/spec/{suites → core}/SpySpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/SuiteSpec.js +0 -0
- data/lib/jasmine/spec/{suites → core}/UtilSpec.js +0 -1
- data/lib/jasmine/spec/{suites → core}/WaitsForBlockSpec.js +32 -1
- data/lib/jasmine/spec/html/MatchersHtmlSpec.js +38 -0
- data/lib/jasmine/spec/html/PrettyPrintHtmlSpec.js +8 -0
- data/lib/jasmine/spec/{suites → html}/TrivialReporterSpec.js +3 -2
- data/lib/jasmine/spec/node_suite.js +127 -0
- data/lib/jasmine/spec/runner.html +44 -45
- data/lib/jasmine/spec/templates/runner.html.erb +49 -0
- data/lib/jasmine/spec/templates/script_tag.html.erb +1 -0
- data/lib/jasmine/src/SourcesList.json +7 -0
- data/lib/jasmine/src/console/ConsoleReporter.js +177 -0
- data/lib/jasmine/src/{Block.js → core/Block.js} +1 -1
- data/lib/jasmine/src/{Env.js → core/Env.js} +13 -8
- data/lib/jasmine/src/{JsApiReporter.js → core/JsApiReporter.js} +0 -0
- data/lib/jasmine/src/{Matchers.js → core/Matchers.js} +24 -7
- data/lib/jasmine/src/{MultiReporter.js → core/MultiReporter.js} +0 -0
- data/lib/jasmine/src/{NestedResults.js → core/NestedResults.js} +0 -0
- data/lib/jasmine/src/{PrettyPrinter.js → core/PrettyPrinter.js} +2 -1
- data/lib/jasmine/src/{Queue.js → core/Queue.js} +0 -0
- data/lib/jasmine/src/{Reporter.js → core/Reporter.js} +0 -0
- data/lib/jasmine/src/{Runner.js → core/Runner.js} +1 -1
- data/lib/jasmine/src/{Spec.js → core/Spec.js} +2 -1
- data/lib/jasmine/src/{Suite.js → core/Suite.js} +1 -1
- data/lib/jasmine/src/{WaitsBlock.js → core/WaitsBlock.js} +3 -1
- data/lib/jasmine/src/{WaitsForBlock.js → core/WaitsForBlock.js} +4 -2
- data/lib/jasmine/src/{base.js → core/base.js} +52 -24
- data/lib/jasmine/src/{mock-timeout.js → core/mock-timeout.js} +0 -0
- data/lib/jasmine/src/{util.js → core/util.js} +1 -1
- data/lib/jasmine/src/html/TrivialReporter.js +6 -4
- data/lib/jasmine/src/templates/example_project_jasmine_tags.html.erb +3 -0
- data/lib/jasmine/src/templates/version.js.erb +6 -0
- data/lib/jasmine/src/templates/version.rb.erb +6 -0
- data/lib/jasmine/src/version.js +6 -0
- data/lib/jasmine/src/version.json +2 -2
- data/lib/jasmine/tasks/build_dist.rb +48 -0
- data/lib/jasmine/tasks/build_specs.rb +50 -0
- data/lib/jasmine/tasks/docs.rb +17 -0
- data/lib/jasmine/tasks/helpers.rb +50 -0
- data/lib/jasmine/tasks/pages.rb +13 -0
- data/lib/jasmine/tasks/spec.rb +37 -0
- data/lib/jasmine/tasks/standalone.rb +91 -0
- data/lib/jasmine/tasks/version.rb +5 -0
- data/lib/tasks/evergreen.rake +1 -1
- data/spec/evergreen_spec.rb +6 -7
- data/spec/runner_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -8
- metadata +95 -77
- data/lib/jasmine/cruise_config.rb +0 -21
- data/lib/jasmine/example/SpecRunner.html +0 -27
- data/lib/jasmine/images/fail-16.png +0 -0
- data/lib/jasmine/images/fail.png +0 -0
- data/lib/jasmine/images/go-16.png +0 -0
- data/lib/jasmine/images/go.png +0 -0
- data/lib/jasmine/images/pending-16.png +0 -0
- data/lib/jasmine/images/pending.png +0 -0
- data/lib/jasmine/images/question-bk.png +0 -0
- data/lib/jasmine/images/questionbk-16.png +0 -0
- data/lib/jasmine/images/spinner.gif +0 -0
data/README.rdoc
CHANGED
|
@@ -16,6 +16,14 @@ isolation from your application. If you need a tool that tests how your
|
|
|
16
16
|
JavaScript integrates with your application you should use an integration
|
|
17
17
|
testing framework, such as {Capybara}[http://github.com/jnicklas/capybara].
|
|
18
18
|
|
|
19
|
+
== Community
|
|
20
|
+
|
|
21
|
+
Please ask questions on the {mailing
|
|
22
|
+
list}[http://groups.google.com/group/ruby-evergreen]. If you have found a
|
|
23
|
+
reproducible error, please {file it on
|
|
24
|
+
GitHub}[https://github.com/jnicklas/evergreen/issues]. Do not contact the
|
|
25
|
+
maintainers directly.
|
|
26
|
+
|
|
19
27
|
== Installation
|
|
20
28
|
|
|
21
29
|
Install as a Ruby gem:
|
|
@@ -28,12 +36,12 @@ Evergreen assumes a file and directory structure, place all your javascript
|
|
|
28
36
|
code inside ./public and all spec files inside ./spec/javascripts. All spec
|
|
29
37
|
files should end in _spec.js. For example:
|
|
30
38
|
|
|
31
|
-
public/widget.js
|
|
39
|
+
public/javascripts/widget.js
|
|
32
40
|
spec/javascripts/widget_spec.js
|
|
33
41
|
|
|
34
42
|
You can require files from the public directory inside your spec file:
|
|
35
43
|
|
|
36
|
-
require('/widget.js')
|
|
44
|
+
require('/javascripts/widget.js')
|
|
37
45
|
|
|
38
46
|
describe('a widget', function() {
|
|
39
47
|
...
|
data/config/routes.rb
CHANGED
data/lib/evergreen.rb
CHANGED
|
@@ -15,19 +15,15 @@ module Evergreen
|
|
|
15
15
|
autoload :Template, 'evergreen/template'
|
|
16
16
|
|
|
17
17
|
class << self
|
|
18
|
-
attr_accessor :driver, :public_dir, :template_dir, :spec_dir, :root, :mounted_at
|
|
18
|
+
attr_accessor :driver, :public_dir, :template_dir, :spec_dir, :root, :mounted_at, :application
|
|
19
19
|
|
|
20
20
|
def configure
|
|
21
21
|
yield self
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def extensions(&block)
|
|
25
|
-
@extensions = block if block
|
|
26
|
-
@extensions
|
|
27
|
-
end
|
|
28
|
-
|
|
29
24
|
def use_defaults!
|
|
30
25
|
configure do |config|
|
|
26
|
+
config.application = Evergreen::Application
|
|
31
27
|
config.driver = :selenium
|
|
32
28
|
config.public_dir = 'public'
|
|
33
29
|
config.spec_dir = 'spec/javascripts'
|
|
@@ -1,71 +1,50 @@
|
|
|
1
1
|
module Evergreen
|
|
2
|
-
class
|
|
3
|
-
|
|
2
|
+
class Application < Sinatra::Base
|
|
3
|
+
set :static, false
|
|
4
|
+
set :root, File.expand_path('.', File.dirname(__FILE__))
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def build_application
|
|
10
|
-
Rack::Builder.new do
|
|
11
|
-
instance_eval(&Evergreen.extensions) if Evergreen.extensions
|
|
12
|
-
|
|
13
|
-
map "/jasmine" do
|
|
14
|
-
use Rack::Static, :urls => ["/"], :root => File.expand_path('../jasmine/lib', File.dirname(__FILE__))
|
|
15
|
-
run lambda { |env| [404, {}, "No such file"]}
|
|
16
|
-
end
|
|
6
|
+
helpers do
|
|
7
|
+
def url(path)
|
|
8
|
+
Evergreen.mounted_at.to_s + path.to_s
|
|
9
|
+
end
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
def render_spec(spec)
|
|
12
|
+
spec.read if spec
|
|
13
|
+
rescue StandardError => error
|
|
14
|
+
erb :_spec_error, :locals => { :error => error }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
set :static, true
|
|
28
|
-
set :root, File.expand_path('.', File.dirname(__FILE__))
|
|
29
|
-
set :public_folder, File.expand_path(File.join(Evergreen.root, Evergreen.public_dir), File.dirname(__FILE__))
|
|
18
|
+
get '/' do
|
|
19
|
+
@suite = Evergreen::Suite.new
|
|
20
|
+
erb :list
|
|
21
|
+
end
|
|
30
22
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
get '/run/all' do
|
|
24
|
+
@suite = Evergreen::Suite.new
|
|
25
|
+
@js_spec_helper = @suite.get_spec('spec_helper.js')
|
|
26
|
+
@coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
|
|
27
|
+
erb :run
|
|
28
|
+
end
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
get '/run/*' do |name|
|
|
31
|
+
@suite = Evergreen::Suite.new
|
|
32
|
+
@spec = @suite.get_spec(name)
|
|
33
|
+
@js_spec_helper = @suite.get_spec('spec_helper.js')
|
|
34
|
+
@coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
|
|
35
|
+
erb :run
|
|
36
|
+
end
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
end
|
|
38
|
+
get "/jasmine/*" do |path|
|
|
39
|
+
send_file File.expand_path(File.join('../jasmine/lib/jasmine-core', path), File.dirname(__FILE__))
|
|
40
|
+
end
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
|
|
52
|
-
erb :run
|
|
53
|
-
end
|
|
42
|
+
get "/resources/*" do |path|
|
|
43
|
+
send_file File.expand_path(File.join('resources', path), File.dirname(__FILE__))
|
|
44
|
+
end
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@spec = @suite.get_spec(name)
|
|
58
|
-
@js_spec_helper = @suite.get_spec('spec_helper.js')
|
|
59
|
-
@coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
|
|
60
|
-
erb :run
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
run app
|
|
65
|
-
end
|
|
66
|
-
end.tap do |app|
|
|
67
|
-
def app.inspect; '<Evergreen Application>'; end
|
|
68
|
-
end
|
|
46
|
+
get '/*' do |path|
|
|
47
|
+
send_file File.join(Evergreen.root, Evergreen.public_dir, path)
|
|
69
48
|
end
|
|
70
49
|
end
|
|
71
50
|
end
|
data/lib/evergreen/cli.rb
CHANGED
|
@@ -16,10 +16,10 @@ module Evergreen
|
|
|
16
16
|
|
|
17
17
|
case command
|
|
18
18
|
when "serve"
|
|
19
|
-
Evergreen::
|
|
19
|
+
Evergreen::Server.new.serve
|
|
20
20
|
return true
|
|
21
21
|
when "run"
|
|
22
|
-
return Evergreen::
|
|
22
|
+
return Evergreen::Runner.new.run
|
|
23
23
|
else
|
|
24
24
|
puts "no such command '#{command}'"
|
|
25
25
|
return false
|
data/lib/evergreen/runner.rb
CHANGED
|
@@ -87,8 +87,7 @@ module Evergreen
|
|
|
87
87
|
|
|
88
88
|
attr_reader :suite, :io
|
|
89
89
|
|
|
90
|
-
def initialize(
|
|
91
|
-
@suite = suite
|
|
90
|
+
def initialize(io=STDOUT)
|
|
92
91
|
@io = io
|
|
93
92
|
end
|
|
94
93
|
|
|
@@ -136,7 +135,11 @@ module Evergreen
|
|
|
136
135
|
end
|
|
137
136
|
|
|
138
137
|
def session
|
|
139
|
-
@session ||= Capybara::Session.new(Evergreen.driver,
|
|
138
|
+
@session ||= Capybara::Session.new(Evergreen.driver, Evergreen.application)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def suite
|
|
142
|
+
@suite ||= Evergreen::Suite.new
|
|
140
143
|
end
|
|
141
144
|
|
|
142
145
|
protected
|
data/lib/evergreen/server.rb
CHANGED
|
@@ -2,10 +2,6 @@ module Evergreen
|
|
|
2
2
|
class Server
|
|
3
3
|
attr_reader :suite
|
|
4
4
|
|
|
5
|
-
def initialize(suite)
|
|
6
|
-
@suite = suite
|
|
7
|
-
end
|
|
8
|
-
|
|
9
5
|
def serve
|
|
10
6
|
server.boot
|
|
11
7
|
Launchy.open(server.url(Evergreen.mounted_at.to_s + '/'))
|
|
@@ -15,7 +11,7 @@ module Evergreen
|
|
|
15
11
|
protected
|
|
16
12
|
|
|
17
13
|
def server
|
|
18
|
-
@server ||= Capybara::Server.new(
|
|
14
|
+
@server ||= Capybara::Server.new(Evergreen.application)
|
|
19
15
|
end
|
|
20
16
|
end
|
|
21
17
|
end
|
data/lib/evergreen/suite.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Evergreen
|
|
2
2
|
class Suite
|
|
3
|
-
attr_reader :
|
|
3
|
+
attr_reader :driver
|
|
4
4
|
|
|
5
5
|
def initialize
|
|
6
6
|
paths = [
|
|
@@ -9,10 +9,6 @@ module Evergreen
|
|
|
9
9
|
"#{ENV["HOME"]}/.evergreen"
|
|
10
10
|
]
|
|
11
11
|
paths.each { |path| load(path) if File.exist?(path) }
|
|
12
|
-
|
|
13
|
-
@runner = Runner.new(self)
|
|
14
|
-
@server = Server.new(self)
|
|
15
|
-
@application = Evergreen.application
|
|
16
12
|
end
|
|
17
13
|
|
|
18
14
|
def root
|
|
@@ -23,14 +19,6 @@ module Evergreen
|
|
|
23
19
|
Evergreen.mounted_at
|
|
24
20
|
end
|
|
25
21
|
|
|
26
|
-
def run
|
|
27
|
-
runner.run
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def serve
|
|
31
|
-
server.serve
|
|
32
|
-
end
|
|
33
|
-
|
|
34
22
|
def get_spec(name)
|
|
35
23
|
Spec.new(self, name)
|
|
36
24
|
end
|
data/lib/evergreen/tasks.rb
CHANGED
data/lib/evergreen/version.rb
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Developing for Jasmine Core
|
|
2
|
+
|
|
3
|
+
## How to Contribute
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## How to write new Jasmine code
|
|
8
|
+
|
|
9
|
+
Or, How to make a successful pull request
|
|
10
|
+
|
|
11
|
+
* _Do not change the public interface_. Lots of projects depend on Jasmine and if you aren't careful you'll break them
|
|
12
|
+
* _Be environment agnostic_ - server-side developers are just as important as browser developers
|
|
13
|
+
* _Be browser agnostic_ - if you must rely on browser-specific functionality, please write it in a way that degrades gracefully
|
|
14
|
+
* _Write specs_ - Jasmine's a testing framework; don't add functionality without test-driving it
|
|
15
|
+
* _Ensure the *entire* test suite is green_ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users
|
|
16
|
+
|
|
17
|
+
Follow these tips and your pull request, patch, or suggestion is much more likely to be integrated.
|
|
18
|
+
|
|
19
|
+
## Environment
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
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/`.
|
|
28
|
+
|
|
29
|
+
Please respect the code patterns as possible. For example, using `jasmine.getGlobal()` to get the global object so as to remain environment agnostic.
|
|
30
|
+
|
|
31
|
+
## Running Specs
|
|
32
|
+
|
|
33
|
+
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/`).
|
|
34
|
+
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
Please ensure all specs are green before committing.
|
|
38
|
+
|
|
39
|
+
There are rake tasks to help with getting green:
|
|
40
|
+
* `rake spec` outputs the expected number of specs that should be run and attempts to run in browser and Node
|
|
41
|
+
* `rake spec:browser` opens `spec/runner.html` in the default browser on MacOS. Please run this in at least Firefox and Chrome before committing
|
|
42
|
+
* `rake spec:node` runs all the Jasmine specs in Node.js - it will complain if Node is not installed
|
|
43
|
+
* `rake hint` runs all the files through JSHint and will complain about potential viable issues with your code. Fix them.
|
|
44
|
+
|
data/lib/jasmine/Gemfile
CHANGED
data/lib/jasmine/MIT.LICENSE
CHANGED
data/lib/jasmine/README.markdown
CHANGED
|
@@ -2,27 +2,30 @@
|
|
|
2
2
|
=======
|
|
3
3
|
**A JavaScript Testing Framework**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, [Node.js](http://nodejs.org) projects, or anywhere that JavaScript can run.
|
|
6
|
+
|
|
7
|
+
Documentation & guides live here: [http://pivotal.github.com/jasmine/](http://pivotal.github.com/jasmine/)
|
|
8
|
+
|
|
9
|
+
## What's Here?
|
|
10
|
+
|
|
11
|
+
*
|
|
12
|
+
|
|
6
13
|
|
|
7
|
-
Want to contribute to Jasmine? Read on...
|
|
8
14
|
|
|
9
|
-
<i>(More developer docs to come...)</i>
|
|
10
15
|
|
|
11
16
|
## Support
|
|
12
|
-
We now have a Google Group for support & discussion.
|
|
13
17
|
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Pivotal Tracker
|
|
18
|
-
* Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD)
|
|
18
|
+
* Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
|
19
|
+
* Send an email to the list: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com)
|
|
20
|
+
* Check the current build status: [ci.pivotallabs.com](http://ci.pivotallabs.com)
|
|
21
|
+
* View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606)
|
|
22
|
+
* Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD)
|
|
23
|
+
|
|
19
24
|
|
|
20
25
|
## Maintainers
|
|
26
|
+
|
|
21
27
|
* [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs
|
|
22
28
|
* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
|
|
23
|
-
* [Christian Williams](mailto:
|
|
24
|
-
|
|
25
|
-
## Developers
|
|
26
|
-
We welcome your contributions! Jasmine is currently maintained by Davis Frank ([infews](http://github.com/infews)), Rajan Agaskar ([ragaskar](http://github.com/ragaskar)), and Christian Williams ([Xian](http://github.com/Xian)). You can help us by removing all other recipients from your pull request.
|
|
29
|
+
* [Christian Williams](mailto:antixian666@gmail.com), Square
|
|
27
30
|
|
|
28
|
-
Copyright (c) 2008-
|
|
31
|
+
Copyright (c) 2008-2011 Pivotal Labs. This software is licensed under the MIT License.
|
data/lib/jasmine/Rakefile
CHANGED
|
@@ -1,182 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
require "bundler"
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
3
|
+
require "term/ansicolor"
|
|
4
|
+
require "json"
|
|
5
|
+
require "tilt"
|
|
6
|
+
|
|
7
|
+
Dir["#{File.dirname(__FILE__)}/tasks/**/*.rb"].each do |file|
|
|
8
|
+
require file
|
|
5
9
|
end
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
["src/html/TrivialReporter.js"]
|
|
9
|
-
end
|
|
11
|
+
task :default => :spec
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
+
task :require_pages_submodule do
|
|
14
|
+
raise "Submodule for Github Pages isn't present. Run git submodule update --init" unless pages_submodule_present
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@version ||= JSON.parse(File.new("src/version.json").read);
|
|
17
|
+
task :require_node do
|
|
18
|
+
raise "\nNode.js is required to develop code for Jasmine. Please visit http://nodejs.org to install.\n\n" unless node_installed?
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def substitute_jasmine_version(filename)
|
|
23
|
-
contents = File.read(filename)
|
|
24
|
-
contents = contents.gsub(/##JASMINE_VERSION##/, (jasmine_version))
|
|
25
|
-
contents = contents.gsub(/[^\n]*REMOVE_THIS_LINE_FROM_BUILD[^\n]*/, '')
|
|
26
|
-
File.open(filename, 'w') { |f| f.write(contents) }
|
|
21
|
+
def pages_submodule_present
|
|
22
|
+
File.exist?('pages/download.html')
|
|
27
23
|
end
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
task :dist => ['jasmine:build', 'jasmine:doc', 'jasmine:build_example_project', 'jasmine:fill_index_downloads']
|
|
33
|
-
|
|
34
|
-
desc 'Check jasmine sources for coding problems'
|
|
35
|
-
task :lint do
|
|
36
|
-
passed = true
|
|
37
|
-
jasmine_sources.each do |src|
|
|
38
|
-
lines = File.read(src).split(/\n/)
|
|
39
|
-
lines.each_index do |i|
|
|
40
|
-
line = lines[i]
|
|
41
|
-
undefineds = line.scan(/.?undefined/)
|
|
42
|
-
if undefineds.include?(" undefined") || undefineds.include?("\tundefined")
|
|
43
|
-
puts "Dangerous undefined at #{src}:#{i}:\n > #{line}"
|
|
44
|
-
passed = false
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
if line.scan(/window/).length > 0
|
|
48
|
-
puts "Dangerous window at #{src}:#{i}:\n > #{line}"
|
|
49
|
-
passed = false
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
unless passed
|
|
55
|
-
puts "Lint failed!"
|
|
56
|
-
exit 1
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
desc 'Builds lib/jasmine from source'
|
|
61
|
-
task :build => :lint do
|
|
62
|
-
puts 'Building Jasmine from source'
|
|
63
|
-
|
|
64
|
-
sources = jasmine_sources
|
|
65
|
-
version = version_hash
|
|
66
|
-
|
|
67
|
-
old_jasmine_files = Dir.glob('lib/jasmine*.js')
|
|
68
|
-
old_jasmine_files.each { |file| File.delete(file) }
|
|
69
|
-
|
|
70
|
-
File.open("lib/jasmine.js", 'w') do |jasmine|
|
|
71
|
-
sources.each do |source_filename|
|
|
72
|
-
jasmine.puts(File.read(source_filename))
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
jasmine.puts %{
|
|
76
|
-
jasmine.version_= {
|
|
77
|
-
"major": #{version['major'].to_json},
|
|
78
|
-
"minor": #{version['minor'].to_json},
|
|
79
|
-
"build": #{version['build'].to_json},
|
|
80
|
-
"revision": #{Time.now.to_i}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
File.open("lib/jasmine-html.js", 'w') do |jasmine_html|
|
|
86
|
-
jasmine_html_sources.each do |source_filename|
|
|
87
|
-
jasmine_html.puts(File.read(source_filename))
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
FileUtils.cp("src/html/jasmine.css", "lib/jasmine.css")
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
downloads_file = 'pages/download.html.md'
|
|
95
|
-
task :need_pages_submodule do
|
|
96
|
-
unless File.exists?(downloads_file)
|
|
97
|
-
raise "Jasmine pages submodule isn't present. Run git submodule update --init"
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
desc "Build jasmine documentation"
|
|
102
|
-
task :doc => :need_pages_submodule do
|
|
103
|
-
puts 'Creating Jasmine Documentation'
|
|
104
|
-
require 'rubygems'
|
|
105
|
-
require 'jsdoc_helper'
|
|
106
|
-
|
|
107
|
-
FileUtils.rm_r "pages/jsdoc", :force => true
|
|
108
|
-
|
|
109
|
-
JsdocHelper::Rake::Task.new(:lambda_jsdoc) do |t|
|
|
110
|
-
t[:files] = jasmine_sources << jasmine_html_sources
|
|
111
|
-
t[:options] = "-a"
|
|
112
|
-
t[:out] = "pages/jsdoc"
|
|
113
|
-
# JsdocHelper bug: template must be relative to the JsdocHelper gem, ick
|
|
114
|
-
t[:template] = File.join("../".*(100), Dir::getwd, "jsdoc-template")
|
|
115
|
-
end
|
|
116
|
-
Rake::Task[:lambda_jsdoc].invoke
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
desc "Build example project"
|
|
120
|
-
task :build_example_project => :need_pages_submodule do
|
|
121
|
-
require 'tmpdir'
|
|
122
|
-
|
|
123
|
-
temp_dir = File.join(Dir.tmpdir, 'jasmine-standalone-project')
|
|
124
|
-
puts "Building Example Project in #{temp_dir}"
|
|
125
|
-
FileUtils.rm_r temp_dir if File.exists?(temp_dir)
|
|
126
|
-
Dir.mkdir(temp_dir)
|
|
127
|
-
|
|
128
|
-
root = File.expand_path(File.dirname(__FILE__))
|
|
129
|
-
FileUtils.cp_r File.join(root, 'example/.'), File.join(temp_dir)
|
|
130
|
-
substitute_jasmine_version(File.join(temp_dir, "SpecRunner.html"))
|
|
131
|
-
|
|
132
|
-
lib_dir = File.join(temp_dir, "lib/jasmine-#{jasmine_version}")
|
|
133
|
-
FileUtils.mkdir_p(lib_dir)
|
|
134
|
-
{
|
|
135
|
-
"lib/jasmine.js" => "jasmine.js",
|
|
136
|
-
"lib/jasmine-html.js" => "jasmine-html.js",
|
|
137
|
-
"src/html/jasmine.css" => "jasmine.css",
|
|
138
|
-
"MIT.LICENSE" => "MIT.LICENSE"
|
|
139
|
-
}.each_pair do |src, dest|
|
|
140
|
-
FileUtils.cp(File.join(root, src), File.join(lib_dir, dest))
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
dist_dir = File.join(root, 'pages/downloads')
|
|
144
|
-
zip_file_name = File.join(dist_dir, "jasmine-standalone-#{jasmine_version}.zip")
|
|
145
|
-
puts "Zipping Example Project and moving to #{zip_file_name}"
|
|
146
|
-
FileUtils.mkdir(dist_dir) unless File.exist?(dist_dir)
|
|
147
|
-
if File.exist?(zip_file_name)
|
|
148
|
-
puts "WARNING!!! #{zip_file_name} already exists!"
|
|
149
|
-
FileUtils.rm(zip_file_name)
|
|
150
|
-
end
|
|
151
|
-
exec "cd #{temp_dir} && zip -r #{zip_file_name} . -x .[a-zA-Z0-9]*"
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
task :fill_index_downloads do
|
|
155
|
-
require 'digest/sha1'
|
|
156
|
-
|
|
157
|
-
download_html = "<!-- START_DOWNLOADS -->\n"
|
|
158
|
-
Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f|
|
|
159
|
-
sha1 = Digest::SHA1.hexdigest File.read(f)
|
|
160
|
-
|
|
161
|
-
fn = f.sub(/^pages\//, '')
|
|
162
|
-
version = /jasmine-standalone-(.*).zip/.match(f)[1]
|
|
163
|
-
prerelease = /\.rc/.match(f)
|
|
164
|
-
download_html += prerelease ? "<tr class=\"rc\">\n" : "<tr>\n"
|
|
165
|
-
download_html += " <td class=\"link\"><a href=\"#{fn}\">#{fn.sub(/downloads\//, '')}</a></td>\n"
|
|
166
|
-
download_html += " <td class=\"version\">#{version}</td>\n"
|
|
167
|
-
download_html += " <td class=\"size\">#{File.size(f) / 1024}k</td>\n"
|
|
168
|
-
download_html += " <td class=\"date\">#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}</td>\n"
|
|
169
|
-
download_html += " <td class=\"sha\">#{sha1}</td>\n"
|
|
170
|
-
download_html += "</tr>\n"
|
|
171
|
-
end
|
|
172
|
-
download_html += "<!-- END_DOWNLOADS -->"
|
|
25
|
+
def node_installed?
|
|
26
|
+
`which node` =~ /node/
|
|
27
|
+
end
|
|
173
28
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
downloads_page = downloads_page.sub(matcher, download_html)
|
|
177
|
-
File.open(downloads_file, 'w') {|f| f.write(downloads_page)}
|
|
178
|
-
puts "rewrote that file"
|
|
179
|
-
end
|
|
29
|
+
class String
|
|
30
|
+
include Term::ANSIColor
|
|
180
31
|
end
|
|
181
32
|
|
|
182
|
-
|
|
33
|
+
Term::ANSIColor.coloring = STDOUT.isatty
|