Commit 8a5c4f85 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

copying pushstream.js to a temporary dir without the function encapsulation,...

copying pushstream.js to a temporary dir without the function encapsulation, to all functions be available on tests
parent 9c9209b6
......@@ -24,7 +24,7 @@
* Created: Nov 01, 2011
* Authors: Wandenberg Peixoto <wandenberg@gmail.com>, Rogério Carvalho Schneider <stockrt@gmail.com>
*/
(function (window, undefined) {
(function (window, document, undefined) {
"use strict";
/* prevent duplicate declaration */
......@@ -49,7 +49,7 @@
validBraces = /(?:^|:|,)(?:\s*\[)+/g;
var trim = function(value) {
return value.replace(/^\s*/, "").replace(/\s*$/, "");
return value.replace(/^\s*/, "").replace(/\s*$/, "");
};
var parseJSON = function(data) {
......@@ -994,4 +994,4 @@
if (window.attachEvent) { window.attachEvent("onunload", PushStream.unload); }
if (window.addEventListener) { window.addEventListener.call(window, "unload", PushStream.unload, false); }
})(window);
})(window, document);
......@@ -120,8 +120,30 @@ task :tests, :executable, :host, :port, :workers, :tests_tmp_dir do |t, args|
end
begin
require 'listen'
require 'jasmine'
load 'jasmine/tasks/jasmine.rake'
task "jasmine:require" => "monitor_js"
task :monitor_js do
copy_inner_js = Proc.new do |modified, added, removed|
modified.each do |file|
destiny_path = File.dirname(file).gsub('misc/js', 'test/tmp/js')
FileUtils.mkdir_p(destiny_path)
content = File.read file
content.gsub!('(function (window, document, undefined) {', '')
content.gsub!('if (window.PushStream) { return; }', '')
content.gsub!('})(window, document);', '')
File.open(File.join(destiny_path, File.basename(file)), 'w') {|f| f.write content }
end
end
copy_inner_js.call([File.expand_path('misc/js/pushstream.js', base_dir)])
listener = Listen.to(File.expand_path('misc/js', base_dir), :filter => /\.js$/)
listener.change(&copy_inner_js)
listener.start(false)
end
rescue LoadError
task :jasmine do
abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
......
......@@ -11,7 +11,7 @@
# - dist/**/*.js
#
src_files:
- misc/js/pushstream.js
- test/tmp/js/pushstream.js
# stylesheets
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment