merging in tlrobinson's fix for package.json

This commit is contained in:
Jeremy Ashkenas
2009-12-28 16:09:14 -05:00
9 changed files with 13 additions and 15 deletions

View File

@@ -19,8 +19,9 @@ Usage:
# Seconds to pause between checks for changed source files.
WATCH_INTERVAL = 0.5
# Path to the Narwhal Launcher:
LAUNCHER = File.expand_path(File.dirname(__FILE__)) + '/narwhal/js/launcher.js'
# Command to execute in Narwhal
PACKAGE = File.dirname(File.dirname(File.dirname(__FILE__)))
LAUNCHER = "narwhal -p #{PACKAGE} -e 'require(\"coffee-script\").run(system.args);'"
# Run the CommandLine off the contents of ARGV.
def initialize
@@ -107,7 +108,7 @@ Usage:
# Use Narwhal to run an interactive CoffeeScript session.
def launch_repl
exec "narwhal #{LAUNCHER}"
exec "#{LAUNCHER}"
rescue Errno::ENOENT
puts "Error: Narwhal must be installed to use the interactive REPL."
exit(1)
@@ -116,7 +117,7 @@ Usage:
# Use Narwhal to compile and execute CoffeeScripts.
def run_scripts
sources = @sources.join(' ')
exec "narwhal #{LAUNCHER} #{sources}"
exec "#{LAUNCHER} #{sources}"
rescue Errno::ENOENT
puts "Error: Narwhal must be installed in order to execute CoffeeScripts."
exit(1)

View File

@@ -1,3 +0,0 @@
(function(){
require("./coffee-script").run(system.args);
})();

View File

@@ -1 +0,0 @@
require("./coffee-script").run(system.args)

View File

@@ -65,7 +65,7 @@
exports.makeNarwhalFactory = function(path) {
var code, factoryText;
code = exports.compileFile(path);
factoryText = "function(require,exports,module,system,print){ 1 + 1 /**/\n}";
factoryText = "function(require,exports,module,system,print){ " + code + " /**/\n}";
if (system.engine === "rhino") {
return Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(global, factoryText, path, 0, null);
} else {

View File

@@ -7,7 +7,7 @@
loader = {
// Reload the coffee-script environment from source.
reload: function(topId, path) {
coffeescript = coffeescript || require('./coffee-script');
coffeescript = coffeescript || require('coffee-script');
return (factories[topId] = coffeescript.makeNarwhalFactory(path));
},
// Ensure that the coffee-script environment is loaded.

View File

@@ -7,7 +7,7 @@ loader: {
# Reload the coffee-script environment from source.
reload: topId, path =>
coffeescript ||= require('./coffee-script')
coffeescript ||= require('coffee-script')
factories[topId]: coffeescript.makeNarwhalFactory(path).
# Ensure that the coffee-script environment is loaded.