Compare commits

...

3 Commits

Author SHA1 Message Date
ragaskar
22904c4f83 Add release candidate option. Add node required message. Bump version. 2011-06-11 00:33:47 -04:00
ragaskar
995cdd6e3b Jasmine core files should be available to other gems 2011-06-10 23:16:10 -04:00
ragaskar
48c8d2cc1f Add bundler gem skeleton 2011-06-10 23:02:12 -04:00
23 changed files with 133574 additions and 110 deletions

4
.gitignore vendored
View File

@@ -5,3 +5,7 @@ site/
.bundle/
.pairs
.rvmrc
*.gem
.bundle
Gemfile.lock
pkg/*

View File

@@ -1,6 +1,3 @@
source :rubygems
gem "json_pure", "~>1.4.3"
gem "frank"
gem "ragaskar-jsdoc_helper"
gem "rake", "0.8.7"
gemspec

View File

@@ -1,33 +0,0 @@
GEM
remote: http://rubygems.org/
specs:
daemons (1.0.10)
frank (1.0.8)
haml (>= 3.0)
mongrel (>= 1.2.0.pre2)
net-scp (>= 1.0)
net-ssh (>= 2.0)
rack (>= 1.0)
tilt (= 0.9)
gem_plugin (0.2.3)
haml (3.0.25)
json_pure (1.4.6)
mongrel (1.2.0.pre2)
daemons (~> 1.0.10)
gem_plugin (~> 0.2.3)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.1.0)
rack (1.2.1)
ragaskar-jsdoc_helper (0.0.2.1)
rake (0.8.7)
tilt (0.9)
PLATFORMS
ruby
DEPENDENCIES
frank
json_pure (~> 1.4.3)
ragaskar-jsdoc_helper
rake (= 0.8.7)

View File

@@ -1,31 +1,23 @@
require 'json'
require 'bundler'
Bundler::GemHelper.install_tasks
def jasmine_sources
first_sources = JSON.parse(File.read('src/SourcesList.json')).collect {|f| "src/core/#{f}"}
sources = first_sources
sources += Dir.glob('src/core/*.js').reject {|f| first_sources.include?(f)}.sort
sources
def sources
dependencies = JSON.parse(File.read('./src/SourcesList.json')).collect {|f| "./src/core/#{f}"}
dependencies + Dir.glob('./src/core/*.js').reject {|f| dependencies.include?(f)}.sort
end
def jasmine_html_sources
["src/html/TrivialReporter.js"]
end
def jasmine_version
"#{version_hash['major']}.#{version_hash['minor']}.#{version_hash['build']}"
def html_sources
["./src/html/TrivialReporter.js"]
end
def version_hash
require 'json'
@version ||= JSON.parse(File.new("src/core/version.json").read);
@version ||= JSON.parse(File.new("./src/core/version.json").read)
end
def substitute_jasmine_version(filename)
def substitute_version(filename)
contents = File.read(filename)
contents = contents.gsub(/##JASMINE_VERSION##/, (jasmine_version))
contents = contents.gsub(/[^\n]*REMOVE_THIS_LINE_FROM_BUILD[^\n]*/, '')
contents = contents.gsub(/[^\n]*REMOVE_THIS_LINE_FROM_BUILD[^\n]*/, '')
File.open(filename, 'w') { |f| f.write(contents) }
end
@@ -36,8 +28,8 @@ task :spec => ["jasmine:build", "spec:node", "spec:browser"]
namespace :spec do
desc 'Run specs in Node.js'
task :node do
raise "Node is required to run all jasmine specs" unless system("node spec/node_suite.js")
task :node => "jasmine:require_node" do
system("node spec/node_suite.js")
end
desc "Run specs in the default browser (MacOS only)"
@@ -48,15 +40,20 @@ end
namespace :jasmine do
task :require_node do
raise "Node.js is required" if `which node` == ''
end
desc 'Prepares for distribution'
task :dist => ['jasmine:build',
'jasmine:doc',
'jasmine:build_pages',
'jasmine:build_example_project',
'jasmine:fill_index_downloads']
'jasmine:doc',
'jasmine:build_pages',
'jasmine:build_example_project',
'jasmine:fill_index_downloads']
desc 'Check jasmine sources for coding problems'
task :lint do
task :lint => "jasmine:require_node" do
puts "Running JSHint via Node.js"
system("node jshint/run.js") || exit(1)
end
@@ -68,10 +65,9 @@ namespace :jasmine do
task :build => :lint do
puts 'Building Jasmine from source'
sources = jasmine_sources
version = version_hash
version = Jasmine::Core::VERSION_HASH
File.open("lib/jasmine.js", 'w') do |jasmine|
File.open("./lib/jasmine-core/jasmine.js", 'w') do |jasmine|
sources.each do |source_filename|
jasmine.puts(File.read(source_filename))
end
@@ -81,18 +77,19 @@ jasmine.version_= {
"major": #{version['major'].to_json},
"minor": #{version['minor'].to_json},
"build": #{version['build'].to_json},
"revision": #{Time.now.to_i}
"revision": #{Time.now.to_i},
"release_candidate": #{version['release_candidate'].to_json}
};
}
}
end
File.open("lib/jasmine-html.js", 'w') do |jasmine_html|
jasmine_html_sources.each do |source_filename|
File.open("./lib/jasmine-core/jasmine-html.js", 'w') do |jasmine_html|
html_sources.each do |source_filename|
jasmine_html.puts(File.read(source_filename))
end
end
FileUtils.cp("src/html/jasmine.css", "lib/jasmine.css")
FileUtils.cp("./src/html/jasmine.css", "lib/jasmine-core/jasmine.css")
end
downloads_file = 'pages/download.html'
@@ -123,7 +120,7 @@ jasmine.version_= {
FileUtils.rm_r "pages/jsdoc", :force => true
JsdocHelper::Rake::Task.new(:lambda_jsdoc) do |t|
t[:files] = jasmine_sources << jasmine_html_sources
t[:files] = sources << html_sources
t[:options] = "-a"
t[:out] = "pages/jsdoc"
# JsdocHelper bug: template must be relative to the JsdocHelper gem, ick
@@ -143,15 +140,15 @@ jasmine.version_= {
root = File.expand_path(File.dirname(__FILE__))
FileUtils.cp_r File.join(root, 'example/.'), File.join(temp_dir)
substitute_jasmine_version(File.join(temp_dir, "SpecRunner.html"))
substitute_version(File.join(temp_dir, "SpecRunner.html"))
lib_dir = File.join(temp_dir, "lib/jasmine-#{jasmine_version}")
lib_dir = File.join(temp_dir, "lib", "jasmine-#{jasmine_version}")
FileUtils.mkdir_p(lib_dir)
{
"lib/jasmine.js" => "jasmine.js",
"lib/jasmine-html.js" => "jasmine-html.js",
"src/html/jasmine.css" => "jasmine.css",
"MIT.LICENSE" => "MIT.LICENSE"
"lib/jasmine.js" => "jasmine.js",
"lib/jasmine-html.js" => "jasmine-html.js",
"src/html/jasmine.css" => "jasmine.css",
"MIT.LICENSE" => "MIT.LICENSE"
}.each_pair do |src, dest|
FileUtils.cp(File.join(root, src), File.join(lib_dir, dest))
end
@@ -168,3 +165,5 @@ jasmine.version_= {
end
end
task :build => "jasmine:build"

View File

@@ -1,21 +0,0 @@
# Project-specific configuration for CruiseControl.rb
Project.configure do |project|
# Send email notifications about broken and fixed builds to email1@your.site, email2@your.site (default: send to nobody)
# project.email_notifier.emails = ['email1@your.site', 'email2@your.site']
# Set email 'from' field to john@doe.com:
# project.email_notifier.from = 'john@doe.com'
# Build the project by invoking rake task 'custom'
project.rake_task = 'jasmine:test:ci:saucelabs'
# Build the project by invoking shell script "build_my_app.sh". Keep in mind that when the script is invoked,
# current working directory is <em>[cruise&nbsp;data]</em>/projects/your_project/work, so if you do not keep build_my_app.sh
# in version control, it should be '../build_my_app.sh' instead
#project.build_command = 'cp ../saucelabs.yml .'
# Ping Subversion for new revisions every 5 minutes (default: 30 seconds)
# project.scheduler.polling_interval = 5.minutes
end

22
jasmine-core.gemspec Normal file
View File

@@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "jasmine-core/version"
Gem::Specification.new do |s|
s.name = "jasmine-core"
s.version = Jasmine::Core::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Rajan Agaskar", "Davis Frank", "Christian Williams"]
s.summary = %q{JavaScript BDD framework}
s.description = %q{Test your JavaScript without any framework dependencies, in any environment, and with a nice descriptive syntax.}
s.email = %q{jasmine-js@googlegroups.com}
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.require_paths = ["lib"]
s.add_development_dependency "json_pure", ">= 1.4.3"
s.add_development_dependency "frank"
s.add_development_dependency "ragaskar-jsdoc_helper"
end

17
lib/jasmine-core.rb Normal file
View File

@@ -0,0 +1,17 @@
module Jasmine
module Core
class << self
def path
File.join(File.dirname(__FILE__), "jasmine-core")
end
def js_files
(["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq
end
def css_files
Dir.glob(File.join(path, "*.css")).map { |f| File.basename(f) }
end
end
end
end

View File

@@ -737,7 +737,12 @@ jasmine.Env.prototype.version = function () {
jasmine.Env.prototype.versionString = function() {
if (jasmine.version_) {
var version = this.version();
return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
var versionString = version.major + "." + version.minor + "." + version.build;
if (version.release_candidate) {
versionString += ".rc" + version.release_candidate
}
versionString += " revision " + version.revision
return versionString;
} else {
return "version unknown";
}
@@ -2465,8 +2470,10 @@ jasmine.getGlobal().clearInterval = function(timeoutKey) {
jasmine.version_= {
"major": 1,
"minor": 1,
"major": 2,
"minor": 0,
"build": 0,
"revision": 1307546962
"revision": 1307766763,
"release_candidate": 1
};

View File

@@ -0,0 +1,8 @@
module Jasmine
module Core
require 'json'
VERSION_HASH = JSON.parse(File.new(File.join(File.dirname(__FILE__), "..", "..", "src", "core", "version.json")).read);
VERSION = "#{VERSION_HASH['major']}.#{VERSION_HASH['minor']}.#{VERSION_HASH['build']}"
VERSION << ".rc#{VERSION_HASH['release_candidate']}" if VERSION_HASH['release_candidate']
end
end

View File

@@ -64,9 +64,10 @@ describe("jasmine.Env", function() {
"major": 1,
"minor": 9,
"build": 7,
"release_candidate": "1",
"revision": 8
};
expect(env.versionString()).toEqual("1.9.7 revision 8");
expect(env.versionString()).toEqual("1.9.7.rc1 revision 8");
});
it("should return a nice string when version is unknown", function() {

View File

@@ -6,7 +6,7 @@ var path = require('path');
// undefined = "diz be undefined yo";
var jasmineGlobals = require('../lib/jasmine.js');
var jasmineGlobals = require('../lib/jasmine-core/jasmine.js');
for (var k in jasmineGlobals) {
global[k] = jasmineGlobals[k];
}
@@ -124,4 +124,4 @@ jasmine.executeSpecs(domIndependentSpecs, function(runner, log) {
} else {
process.exit(1);
}
}, isVerbose, showColors);
}, isVerbose, showColors);

View File

@@ -9,7 +9,7 @@
undefined = "diz be undefined yo";
</script>
<link rel="shortcut icon" type="image/png" href="../images/jasmine_favicon.png">
<script type="text/javascript" src="../lib/jasmine.js"></script>
<script type="text/javascript" src="../lib/jasmine-core/jasmine.js"></script>
<script type="text/javascript" src="../src/html/TrivialReporter.js"></script>
<script type="text/javascript" src="../src/console/TrivialConsoleReporter.js"></script>

View File

@@ -53,7 +53,12 @@ jasmine.Env.prototype.version = function () {
jasmine.Env.prototype.versionString = function() {
if (jasmine.version_) {
var version = this.version();
return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
var versionString = version.major + "." + version.minor + "." + version.build;
if (version.release_candidate) {
versionString += ".rc" + version.release_candidate
}
versionString += " revision " + version.revision
return versionString;
} else {
return "version unknown";
}

View File

@@ -1,5 +1,6 @@
{
"major": 1,
"minor": 1,
"build": 0
"major": 2,
"minor": 0,
"build": 0,
"release_candidate": 1
}

133457
tags Normal file

File diff suppressed because one or more lines are too long