Jasmine core files should be available to other gems
This commit is contained in:
5
Gemfile
5
Gemfile
@@ -1,6 +1,3 @@
|
||||
source :rubygems
|
||||
|
||||
gem "json_pure", "~>1.4.3"
|
||||
gem "frank"
|
||||
gem "ragaskar-jsdoc_helper"
|
||||
gem "rake", "0.8.7"
|
||||
gemspec
|
||||
|
||||
64
Rakefile
64
Rakefile
@@ -1,37 +1,26 @@
|
||||
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
|
||||
|
||||
require 'bundler'
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
||||
task :default => :spec
|
||||
|
||||
desc "Run spec suite: Browser, Node, JSHint"
|
||||
@@ -53,10 +42,10 @@ namespace :jasmine do
|
||||
|
||||
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
|
||||
@@ -71,10 +60,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
|
||||
@@ -86,16 +74,16 @@ jasmine.version_= {
|
||||
"build": #{version['build'].to_json},
|
||||
"revision": #{Time.now.to_i}
|
||||
};
|
||||
}
|
||||
}
|
||||
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'
|
||||
@@ -126,7 +114,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] = jasmine_sources << html_sources
|
||||
t[:options] = "-a"
|
||||
t[:out] = "pages/jsdoc"
|
||||
# JsdocHelper bug: template must be relative to the JsdocHelper gem, ick
|
||||
@@ -146,15 +134,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}")
|
||||
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
|
||||
|
||||
@@ -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 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
|
||||
@@ -3,19 +3,20 @@ $:.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 = ["TODO: Write your name"]
|
||||
s.email = ["TODO: Write your email address"]
|
||||
s.homepage = ""
|
||||
s.summary = %q{TODO: Write a gem summary}
|
||||
s.description = %q{TODO: Write a gem description}
|
||||
|
||||
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 = `git ls-files`.split("\n")
|
||||
s.files = Dir.glob("./lib/**/*")
|
||||
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_development_dependency "json_pure", ">= 1.4.3"
|
||||
s.add_development_dependency "frank"
|
||||
s.add_development_dependency "ragaskar-jsdoc_helper"
|
||||
end
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
module Jasmine
|
||||
module Core
|
||||
# Your code goes here...
|
||||
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
|
||||
|
||||
@@ -991,7 +991,7 @@ jasmine.Block = function(env, func, spec) {
|
||||
this.spec = spec;
|
||||
};
|
||||
|
||||
jasmine.Block.prototype.execute = function(onComplete) {
|
||||
jasmine.Block.prototype.execute = function(onComplete) {
|
||||
try {
|
||||
this.func.apply(this.spec);
|
||||
} catch (e) {
|
||||
@@ -1031,7 +1031,7 @@ jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
type: isSuite ? 'suite' : 'spec',
|
||||
children: []
|
||||
};
|
||||
|
||||
|
||||
if (isSuite) {
|
||||
var children = suiteOrSpec.children();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
@@ -1647,7 +1647,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
||||
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||
for (var property in obj) {
|
||||
if (property == '__Jasmine_been_here_before__') continue;
|
||||
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
||||
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
||||
obj.__lookupGetter__(property) !== null) : false);
|
||||
}
|
||||
};
|
||||
@@ -1750,7 +1750,7 @@ jasmine.Queue.prototype.next_ = function() {
|
||||
|
||||
while (goAgain) {
|
||||
goAgain = false;
|
||||
|
||||
|
||||
if (self.index < self.blocks.length && !this.abort) {
|
||||
var calledSynchronously = true;
|
||||
var completedSynchronously = false;
|
||||
@@ -1788,7 +1788,7 @@ jasmine.Queue.prototype.next_ = function() {
|
||||
if (completedSynchronously) {
|
||||
onComplete();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
self.running = false;
|
||||
if (self.onComplete) {
|
||||
@@ -2470,3 +2470,4 @@ jasmine.version_= {
|
||||
"build": 0,
|
||||
"revision": 1307546962
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module Jasmine
|
||||
module Core
|
||||
VERSION = "0.0.1"
|
||||
require 'json'
|
||||
VERSION_HASH = JSON.parse(File.new(File.join(File.dirname(__FILE__), "..", "..", "src/version.json")).read);
|
||||
VERSION = "#{VERSION_HASH['major']}.#{VERSION_HASH['minor']}.#{VERSION_HASH['build']}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user