From b4c4a74e810b081284469efcbf10e1d0b7389ad8 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 11 Apr 2011 06:38:47 -0400 Subject: [PATCH] add jasmine and other things --- .gitmodules | 3 ++ README.md | 22 ++++++++++++ bin/jasmine-headless-webkit | 60 +++++++++++++++++++++++++++++++++ jasmine | 1 + jasmine-headless-webkit.gemspec | 2 ++ 5 files changed, 88 insertions(+) create mode 100644 .gitmodules create mode 100644 README.md create mode 100755 bin/jasmine-headless-webkit create mode 160000 jasmine diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..71ef4f1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "jasmine"] + path = jasmine + url = https://github.com/pivotal/jasmine.git diff --git a/README.md b/README.md new file mode 100644 index 0000000..d70a663 --- /dev/null +++ b/README.md @@ -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. + + diff --git a/bin/jasmine-headless-webkit b/bin/jasmine-headless-webkit new file mode 100755 index 0000000..7fae522 --- /dev/null +++ b/bin/jasmine-headless-webkit @@ -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' + %{} + when '.css' + %{} + end +} + +output = <<-HTML + + + + Jasmine Test Runner + + #{files.join("\n")} + + + + + + + +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 + diff --git a/jasmine b/jasmine new file mode 160000 index 0000000..e826fbb --- /dev/null +++ b/jasmine @@ -0,0 +1 @@ +Subproject commit e826fbb17088f9e31a570ac4e09a738592af7b30 diff --git a/jasmine-headless-webkit.gemspec b/jasmine-headless-webkit.gemspec index 5a54303..9a021ca 100644 --- a/jasmine-headless-webkit.gemspec +++ b/jasmine-headless-webkit.gemspec @@ -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