Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
Depend on jasmine-core gem, remove submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
ragaskar committed Jun 18, 2011
1 parent 5e39bc5 commit 9fee8ba
Show file tree
Hide file tree
Showing 20 changed files with 158 additions and 76 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ bin
.rvmrc
.pairs
*.swp
tags
Gemfile.lock
spec/reports
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
source "http://rubygems.org"

# dependencies are specified in jasmine.gemspec

gemspec
24 changes: 4 additions & 20 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,20 @@ require 'ci/reporter/rake/rspec'
desc "Run all examples"
if rspec2?
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*.rb'
t.pattern = 'spec/**/*_spec.rb'
end
else
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/**/*.rb']
end
end

task :spec => ['jasmine:copy_examples_to_gem', 'bundle_install', 'ci:setup:rspec']

task :spex do
`bundle install`
Rake::Task["spec"].invoke
end
task :spec => ['jasmine:copy_examples_to_gem', 'ci:setup:rspec']

task :default => :spec

namespace :jasmine do
require "jasmine-core"
require './spec/jasmine_self_test_config'
task :server do
puts "your tests are here:"
Expand All @@ -51,26 +47,14 @@ namespace :jasmine do

desc "Copy examples from Jasmine JS to the gem"
task :copy_examples_to_gem do
unless File.exist?('jasmine/lib')
raise "Jasmine submodule isn't present. Run git submodule update --init"
end

require "fileutils"

# copy jasmine's example tree into our generator templates dir
FileUtils.rm_r('generators/jasmine/templates/jasmine-example', :force => true)
FileUtils.cp_r('jasmine/example', 'generators/jasmine/templates/jasmine-example', :preserve => true)
FileUtils.cp_r(File.join(Jasmine::Core.path, 'example'), 'generators/jasmine/templates/jasmine-example', :preserve => true)
end
end

desc "Run specs via server"
task :jasmine => ['jasmine:server']

desc "Install Bundle"
task "bundle_install" do
`bundle install`
end


require 'bundler'
Bundler::GemHelper.install_tasks
53 changes: 40 additions & 13 deletions generators/jasmine/templates/jasmine-example/SpecRunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,53 @@
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Test Runner</title>
<link rel="stylesheet" type="text/css" href="lib/jasmine-##JASMINE_VERSION##/jasmine.css">
<script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-##JASMINE_VERSION##/jasmine-html.js"></script>
<title>Jasmine Spec Runner</title>

<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.1.0.rc1/jasmine_favicon.png">

<link rel="stylesheet" type="text/css" href="lib/jasmine-1.1.0.rc1/jasmine.css">
<script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.1.0.rc1/jasmine-html.js"></script>

<!-- include source files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
<script type="text/javascript" src="spec/PlayerSpec.js"></script>

<!-- include spec files here... -->
<script type="text/javascript" src="src/Player.js"></script>
<script type="text/javascript" src="src/Song.js"></script>

<!-- include spec files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
<script type="text/javascript" src="spec/PlayerSpec.js"></script>
<script type="text/javascript">
(function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;

var trivialReporter = new jasmine.TrivialReporter();

jasmineEnv.addReporter(trivialReporter);

jasmineEnv.specFilter = function(spec) {
return trivialReporter.specFilter(spec);
};

var currentWindowOnload = window.onload;

window.onload = function() {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};

function execJasmine() {
jasmineEnv.execute();
}

})();
</script>

</head>
<body>
<div id="REMOVE_THIS_LINE_FROM_BUILD"><p>You must be trying to look at examples in the Jasmine source tree.</p><p>Please download a distribution version of Jasmine at <a href="http://pivotal.github.com/jasmine/">http://pivotal.github.com/jasmine/</a>.</p></div>
<script type="text/javascript">
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
jasmine.getEnv().execute();
</script>

<body>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ beforeEach(function() {
this.addMatchers({
toBePlaying: function(expectedSong) {
var player = this.actual;
return player.currentlyPlayingSong === expectedSong
&& player.isPlaying;
return player.currentlyPlayingSong === expectedSong &&
player.isPlaying;
}
})
});
});
1 change: 0 additions & 1 deletion jasmine
Submodule jasmine deleted from d875d1
24 changes: 17 additions & 7 deletions jasmine.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,42 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]

if ENV['RAILS_VERSION'] == 'pojs-rspec1'
s.add_development_dependency 'rspec', '1.3.1'
if ENV["RUBY_VERSION"] =~ /1\.8\.6/
#1.3.2 buffer overflows
s.add_development_dependency 'rspec', '= 1.3.1'
s.add_development_dependency 'rack', "1.1"
else
s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
end
s.add_development_dependency 'rake-tasks'
s.add_development_dependency 'rack', "1.1" if ENV["RUBY_VERSION"] =~ /1\.8\.6/
elsif ENV['RAILS_VERSION'] == 'pojs-rspec2'
s.add_development_dependency 'rspec', '>= 2.5.0'
s.add_development_dependency 'rake-tasks'
s.add_development_dependency 'rack', "1.1" if ENV["RUBY_VERSION"] =~ /1\.8\.6/
elsif ENV['RAILS_VERSION'] == 'rails2'
if ENV["RUBY_VERSION"] =~ /1\.8\.6/
#1.3.2 buffer overflows
s.add_development_dependency 'rspec', '= 1.3.1'
else
s.add_development_dependency 'rspec', '>= 1.3.1', '< 2'
end
# for development & test of Rails 2 Generators
s.add_development_dependency 'rspec', '1.3.1'
s.add_development_dependency 'rails', '2.3.11'
s.add_development_dependency 'rack', '1.1'
s.add_development_dependency 'rails', '2.3.11', "< 3"
s.add_development_dependency 'rack', '>= 1.1', "< 1.2"
else
# for development & test of Rails 3 Generators
s.add_development_dependency 'rspec', '>= 2.5.0'
s.add_development_dependency 'rails', '>= 3.0.3 '
s.add_development_dependency 'rails', '>= 3.0.0'
s.add_development_dependency 'rack', '>= 1.2.1'
end

s.add_development_dependency 'rack-test'
s.add_development_dependency 'gem-release', ">= 0.0.16"
s.add_development_dependency 'ci_reporter'

s.add_dependency 'jasmine-core', ">= 1.1.0.rc1"
s.add_dependency 'rack', '>= 1.1'
s.add_dependency 'rspec', '>= 1.3.1'
s.add_dependency 'json_pure', '>= 1.4.3'
s.add_dependency 'selenium-webdriver', '>= 0.1.3'

end
4 changes: 0 additions & 4 deletions lib/jasmine/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
require 'erb'

module Jasmine
def self.root
ENV["JASMINE_ROOT"] || File.expand_path(File.join(File.dirname(__FILE__), '../../jasmine'))
end

# this seemingly-over-complex method is necessary to get an open port on at least some of our Macs
def self.open_socket_on_unused_port
infos = Socket::getaddrinfo("localhost", nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
Expand Down
Binary file added lib/jasmine/firebug/firebug-1.6.2.xpi
Binary file not shown.
Binary file added lib/jasmine/firebug/firebug-1.7.0.xpi
Binary file not shown.
30 changes: 30 additions & 0 deletions lib/jasmine/firebug/firebug-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Software License Agreement (BSD License)

Copyright (c) 2007, Parakey Inc.
All rights reserved.

Redistribution and use of this software in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.

* Neither the name of Parakey Inc. nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of Parakey Inc.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 30 additions & 0 deletions lib/jasmine/firebug/firebug.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'selenium/webdriver'

class Selenium::WebDriver::Firefox::Profile
def self.firebug_version
@firebug_version ||= '1.6.2'
end

def self.firebug_version=(version)
@firebug_version = version
end

def enable_firebug(version = nil)
version ||= Selenium::WebDriver::Firefox::Profile.firebug_version
add_extension(File.expand_path("../firebug-#{version}.xpi", __FILE__))

# Prevent "Welcome!" tab
self["extensions.firebug.currentVersion"] = "999"

# Enable for all sites.
self["extensions.firebug.allPagesActivation"] = "on"

# Enable all features.
['console', 'net', 'script'].each do |feature|
self["extensions.firebug.#{feature}.enableSites"] = true
end

# Open by default.
self["extensions.firebug.previousPlacement"] = 1
end
end
10 changes: 8 additions & 2 deletions lib/jasmine/selenium_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ def initialize(browser, http_address)
elsif ENV['SELENIUM_SERVER_PORT']
"http://localhost:#{ENV['SELENIUM_SERVER_PORT']}/wd/hub"
end
options = if browser == "firefox" && ENV["JASMINE_FIREBUG"]
require File.join(File.dirname(__FILE__), "firebug/firebug")
profile = Selenium::WebDriver::Firefox::Profile.new
profile.enable_firebug
{:profile => profile}
end || {}
@driver = if selenium_server
Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => browser.to_sym
else
Selenium::WebDriver.for browser.to_sym
Selenium::WebDriver.for browser.to_sym, options
end
@http_address = http_address
end
Expand Down Expand Up @@ -46,4 +52,4 @@ def json_generate(obj)
JSON.generate(obj)
end
end
end
end
11 changes: 4 additions & 7 deletions lib/jasmine/server.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
require 'rack'
require 'jasmine-core'

module Jasmine
class RunAdapter
def initialize(config)
@config = config
@jasmine_files = [
"/__JASMINE_ROOT__/lib/jasmine.js",
"/__JASMINE_ROOT__/lib/jasmine-html.js",
"/__JASMINE_ROOT__/lib/json2.js",
]
@jasmine_stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"]
@jasmine_files = Jasmine::Core.js_files.map {|f| "/__JASMINE_ROOT__/#{f}"}
@jasmine_stylesheets = Jasmine::Core.css_files.map {|f| "/__JASMINE_ROOT__/#{f}"}
end

def call(env)
Expand Down Expand Up @@ -81,7 +78,7 @@ def self.app(config)
map('/run.html') { run Jasmine::Redirect.new('/') }
map('/__suite__') { run Jasmine::FocusedSuite.new(config) }

map('/__JASMINE_ROOT__') { run Rack::File.new(Jasmine.root) }
map('/__JASMINE_ROOT__') { run Rack::File.new(Jasmine::Core.path) }
map(config.spec_path) { run Rack::File.new(config.spec_dir) }
map(config.root_path) { run Rack::File.new(config.project_root) }

Expand Down
2 changes: 1 addition & 1 deletion lib/jasmine/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Jasmine
VERSION = "1.0.2.1"
VERSION = "1.1.0.rc1"
end
5 changes: 5 additions & 0 deletions spec/fixture/spec/example_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("example_spec", function() {
it("should be here for path loading tests", function() {
expect(true).toBe(true);
}
})
3 changes: 3 additions & 0 deletions spec/fixture/src/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Example() {
this.is_here = "for path loading tests";
}
1 change: 0 additions & 1 deletion spec/jasmine_self_test_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

require 'jasmine_self_test_config'

jasmine_config = JasmineSelfTestConfig.new
Expand Down
Loading

0 comments on commit 9fee8ba

Please sign in to comment.