Skip to content

Commit

Permalink
Cleaning up JavaScript shell rake task (including moving it to a simp…
Browse files Browse the repository at this point in the history
…ler "rake js:shell").
  • Loading branch information
Larry Karnowski committed Feb 6, 2009
1 parent 062fe5d commit 13d071b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 39 deletions.
22 changes: 0 additions & 22 deletions lib/debug_shell.js

This file was deleted.

26 changes: 26 additions & 0 deletions lib/shell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(function(){
var _old_quit = this.quit;
this.__defineGetter__("exit", function(){ _old_quit() });
this.__defineGetter__("quit", function(){ _old_quit() });

print("=================================================");
print(" Rhino JavaScript Shell");
print(" To exit type 'exit', 'quit', or 'quit()'.");
print("=================================================");

var plugin_prefix = "vendor/plugins/javascript_testing/";
var fixture_file = plugin_prefix + "generators/javascript_testing/templates/application.html";

load(plugin_prefix + "lib/env.rhino.js");
print(" - loaded env.js");

window.location = fixture_file;
print(" - sample DOM loaded");

// load(plugin_prefix + "lib/jquery-1.3.1.js");
// print (" jQuery-1.3.1 loaded");
load(plugin_prefix + "lib/jquery-1.2.6.js");
print(" - jQuery-1.2.6 loaded");

print("=================================================");
})();
20 changes: 3 additions & 17 deletions tasks/javascript_testing_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ fixture_dir = "#{RAILS_ROOT}/test/javascript/fixtures"
rhino_command = "java -jar #{plugin_prefix}/lib/js.jar -w -debug"
test_runner_command = "#{rhino_command} #{plugin_prefix}/lib/test_runner.js"

# debug_setup_script = <<END
# print("========================================");
# print(" JavaScript Testing Rhino Debug Shell");
# print(" To exit shell type: quit()");
# print("========================================");
#
# load("#{plugin_prefix}/lib/env.rhino.js");
# print("loaded env.js");
# window.location = "#{plugin_prefix}/generators/javascript_testing/templates/application.html";
# //print ("sample DOM loaded");
# END

namespace :test do
desc "Runs all the JavaScript tests and outputs the results"
task :javascripts do
Expand Down Expand Up @@ -45,10 +33,8 @@ namespace :js do
end
end

namespace :debug do
task :shell do
rlwrap = `which rlwrap`.chomp
system("#{rlwrap} #{rhino_command} -f #{plugin_prefix}/lib/debug_shell.js -f -")
end
task :shell do
rlwrap = `which rlwrap`.chomp
system("#{rlwrap} #{rhino_command} -f #{plugin_prefix}/lib/shell.js -f -")
end
end

0 comments on commit 13d071b

Please sign in to comment.