1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

added experimental (but working) method to install CoffeeScript: 'sudo bin/cake install' -- once you've done that, you can take cake and coffee out of their bin/

This commit is contained in:
Jeremy Ashkenas 2010-02-17 01:24:02 -05:00
parent 2d0ad73af8
commit 0490cb2920
6 changed files with 23 additions and 15 deletions

View file

@ -7,6 +7,15 @@ run: (args) ->
proc.addListener 'error', (err) -> if err then puts err
task 'install', 'install CoffeeScript into /usr/local', ->
exec([
'mkdir -p /usr/local/lib/coffee-script'
'cp -rf bin lib LICENSE README package.json src vendor /usr/local/lib/coffee-script'
'ln -sf /usr/local/lib/coffee-script/bin/coffee /usr/local/bin/coffee'
'ln -sf /usr/local/lib/coffee-script/bin/cake /usr/local/bin/cake'
].join(' && '))
task 'build', 'build the CoffeeScript language from source', ->
fs.readdir('src').addCallback (files) ->
files: 'src/' + file for file in files when file.match(/\.coffee$/)

2
README
View file

@ -23,7 +23,7 @@
CoffeeScript is a little language that compiles into JavaScript.
Install the compiler:
... to be determined ...
sudo bin/cake install
Compile a script:
coffee /path/to/script.coffee

View file

@ -2,6 +2,7 @@
process.mixin(require('sys'));
require.paths.unshift('/usr/local/lib/coffee-script/lib');
require.paths.unshift('./lib');
require('cake').run();

View file

@ -2,6 +2,7 @@
process.mixin(require('sys'));
require.paths.unshift('/usr/local/lib/coffee-script/lib');
require.paths.unshift('./lib');
require('command_line').run();

View file

@ -1,5 +1,5 @@
(function(){
var coffee, prompt, quit, readline, run;
var coffee, prompt, quit, readline;
// A CoffeeScript port/version of the Node.js REPL.
// Required modules.
coffee = require('coffee-script');
@ -7,19 +7,17 @@
// Shortcut variables.
prompt = 'coffee> ';
quit = function quit() {
return process.stdio.close();
return process.exit(0);
};
// The main REPL function. Called everytime a line of code is entered.
readline = function readline(code) {
return run(coffee.compile(code, {
no_wrap: true,
globals: true
}));
};
// Attempt to evaluate the command. If there's an exception, print it.
run = function run(js) {
var val;
readline = function readline(code) {
var js, val;
try {
js = coffee.compile(code, {
no_wrap: true,
globals: true
});
val = eval(js);
if (val !== undefined) {
p(val);

View file

@ -6,14 +6,13 @@ process.mixin require 'sys'
# Shortcut variables.
prompt: 'coffee> '
quit: -> process.stdio.close()
quit: -> process.exit(0)
# The main REPL function. Called everytime a line of code is entered.
readline: (code) -> run coffee.compile code, {no_wrap: true, globals: true}
# Attempt to evaluate the command. If there's an exception, print it.
run: (js) ->
readline: (code) ->
try
js: coffee.compile code, {no_wrap: true, globals: true}
val: eval(js)
p val if val isnt undefined
catch err