Update Rakefile a bit. Added more rake tasks to run specs.

This commit is contained in:
Davis W. Frank 2011-03-08 18:38:46 -08:00
parent 70aed2d900
commit fc994108db
1 changed files with 18 additions and 7 deletions

View File

@ -17,7 +17,6 @@ def version_hash
@version ||= JSON.parse(File.new("src/version.json").read); @version ||= JSON.parse(File.new("src/version.json").read);
end end
task :default => 'jasmine:dist'
def substitute_jasmine_version(filename) def substitute_jasmine_version(filename)
contents = File.read(filename) contents = File.read(filename)
@ -26,6 +25,23 @@ def substitute_jasmine_version(filename)
File.open(filename, 'w') { |f| f.write(contents) } File.open(filename, 'w') { |f| f.write(contents) }
end end
task :default => :spec
desc "Run spec suite: Browser, Node, JSHint"
task :spec => ["spec:node", "spec:browser", "jasmine:hint"]
namespace :spec do
desc 'Run specs in Node.js'
task :node do
system("node spec/node_suite.js")
end
desc "Run specs in the default browser (MacOS only)"
task :browser do
system("open spec/runner.html")
end
end
namespace :jasmine do namespace :jasmine do
desc 'Prepares for distribution' desc 'Prepares for distribution'
@ -51,9 +67,6 @@ namespace :jasmine do
sources = jasmine_sources sources = jasmine_sources
version = version_hash version = version_hash
old_jasmine_files = Dir.glob('lib/jasmine*.js')
old_jasmine_files.each { |file| File.delete(file) }
File.open("lib/jasmine.js", 'w') do |jasmine| File.open("lib/jasmine.js", 'w') do |jasmine|
sources.each do |source_filename| sources.each do |source_filename|
jasmine.puts(File.read(source_filename)) jasmine.puts(File.read(source_filename))
@ -150,6 +163,4 @@ jasmine.version_= {
exec "cd #{temp_dir} && zip -r #{zip_file_name} . -x .[a-zA-Z0-9]*" exec "cd #{temp_dir} && zip -r #{zip_file_name} . -x .[a-zA-Z0-9]*"
end end
end end
task :jasmine => ['jasmine:dist']