add jasmine and other things

This commit is contained in:
John Bintz 2011-04-11 06:38:47 -04:00
parent 209dd69ae1
commit b4c4a74e81
5 changed files with 88 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "jasmine"]
path = jasmine
url = https://github.com/pivotal/jasmine.git

22
README.md Normal file
View File

@ -0,0 +1,22 @@
Copyright (c) 2010 Sencha Inc.
Copyright (c) 2011 John Bintz
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.

60
bin/jasmine-headless-webkit Executable file
View File

@ -0,0 +1,60 @@
#!/usr/bin/env ruby
require 'yaml'
require 'fileutils'
data = YAML.load_file('spec/javascripts/support/jasmine.yml')
gem_dir = File.expand_path('../..', __FILE__)
files = [
File.join(gem_dir, 'lib/jasmine/lib/jasmine.js'),
File.join(gem_dir, 'lib/jasmine/lib/jasmine-html.js'),
File.join(gem_dir, 'lib/jasmine/lib/jasmine.css')
]
files += [ [ 'src_files', 'src_dir' ], [ 'stylesheets', 'src_dir' ], [ 'helpers', 'spec_dir' ], [ 'spec_files', 'spec_dir' ] ].collect do |searches, root|
data[searches].collect do |search|
path = search
path = File.join(data[root], path) if data[root]
Dir[path]
end
end
files = files.flatten.collect { |file|
case File.extname(file)
when '.js'
%{<script type="text/javascript" src="#{file}"></script>}
when '.css'
%{<link rel="stylesheet" href="#{file}" type="text/css" />}
end
}
output = <<-HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Test Runner</title>
<script type="text/javascript">
window.console = { log: function(data) { debug.log(JSON.stringify(data)); } };
</script>
#{files.join("\n")}
</head>
<body>
<script type="text/javascript">
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
jasmine.getEnv().execute();
</script>
</body>
</html>
HTML
File.open(target = "specrunner.#{$$}.html", 'w') { |fh| fh.print output }
system %{#{File.join(gem_dir, 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner'} #{target}}
status = ($? == 0) ? 0 : 1
FileUtils.rm_f target
exit status

1
jasmine Submodule

@ -0,0 +1 @@
Subproject commit e826fbb17088f9e31a570ac4e09a738592af7b30

View File

@ -19,4 +19,6 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.add_dependency 'jasmine-gem'
end