mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge branch 'restructuring' of github.com:jashkenas/coffee-script
This commit is contained in:
commit
818216374c
19 changed files with 13 additions and 14 deletions
17
Cakefile
17
Cakefile
|
@ -1,6 +1,6 @@
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
{extend} = require './lib/helpers'
|
{extend} = require './lib/coffee-script/helpers'
|
||||||
CoffeeScript = require './lib/coffee-script'
|
CoffeeScript = require './lib/coffee-script'
|
||||||
{spawn, exec} = require 'child_process'
|
{spawn, exec} = require 'child_process'
|
||||||
|
|
||||||
|
@ -22,10 +22,9 @@ header = """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
'src/coffee-script.coffee', 'src/grammar.coffee'
|
'coffee-script', 'grammar', 'helpers'
|
||||||
'src/helpers.coffee', 'src/lexer.coffee', 'src/nodes.coffee'
|
'lexer', 'nodes', 'rewriter', 'scope'
|
||||||
'src/rewriter.coffee', 'src/scope.coffee'
|
].map (filename) -> "src/#{filename}.coffee"
|
||||||
]
|
|
||||||
|
|
||||||
# Run a CoffeeScript through our node/coffee interpreter.
|
# Run a CoffeeScript through our node/coffee interpreter.
|
||||||
run = (args, cb) ->
|
run = (args, cb) ->
|
||||||
|
@ -55,7 +54,7 @@ task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options)
|
||||||
"ln -sfn #{lib}/bin/coffee #{bin}/coffee"
|
"ln -sfn #{lib}/bin/coffee #{bin}/coffee"
|
||||||
"ln -sfn #{lib}/bin/cake #{bin}/cake"
|
"ln -sfn #{lib}/bin/cake #{bin}/cake"
|
||||||
"mkdir -p ~/.node_libraries"
|
"mkdir -p ~/.node_libraries"
|
||||||
"ln -sfn #{lib}/lib #{node}"
|
"ln -sfn #{lib}/lib/coffee-script #{node}"
|
||||||
].join(' && '), (err, stdout, stderr) ->
|
].join(' && '), (err, stdout, stderr) ->
|
||||||
if err then console.log stderr.trim() else log 'done', green
|
if err then console.log stderr.trim() else log 'done', green
|
||||||
)
|
)
|
||||||
|
@ -64,7 +63,7 @@ task 'install', 'install CoffeeScript into /usr/local (or --prefix)', (options)
|
||||||
task 'build', 'build the CoffeeScript language from source', build = (cb) ->
|
task 'build', 'build the CoffeeScript language from source', build = (cb) ->
|
||||||
files = fs.readdirSync 'src'
|
files = fs.readdirSync 'src'
|
||||||
files = ('src/' + file for file in files when file.match(/\.coffee$/))
|
files = ('src/' + file for file in files when file.match(/\.coffee$/))
|
||||||
run ['-c', '-o', 'lib'].concat(files), cb
|
run ['-c', '-o', 'lib/coffee-script'].concat(files), cb
|
||||||
|
|
||||||
|
|
||||||
task 'build:full', 'rebuild the source twice, and run the tests', ->
|
task 'build:full', 'rebuild the source twice, and run the tests', ->
|
||||||
|
@ -92,7 +91,7 @@ task 'build:browser', 'rebuild the merged script for inclusion in the browser',
|
||||||
code += """
|
code += """
|
||||||
require['./#{name}'] = new function() {
|
require['./#{name}'] = new function() {
|
||||||
var exports = this;
|
var exports = this;
|
||||||
#{fs.readFileSync "lib/#{name}.js"}
|
#{fs.readFileSync "lib/coffee-script/#{name}.js"}
|
||||||
};
|
};
|
||||||
"""
|
"""
|
||||||
code = """
|
code = """
|
||||||
|
@ -125,7 +124,7 @@ task 'doc:underscore', 'rebuild the Underscore.coffee documentation page', ->
|
||||||
throw err if err
|
throw err if err
|
||||||
|
|
||||||
task 'bench', 'quick benchmark of compilation time', ->
|
task 'bench', 'quick benchmark of compilation time', ->
|
||||||
{Rewriter} = require './lib/rewriter'
|
{Rewriter} = require './lib/coffee-script/rewriter'
|
||||||
co = sources.map((name) -> fs.readFileSync name).join '\n'
|
co = sources.map((name) -> fs.readFileSync name).join '\n'
|
||||||
fmt = (ms) -> " #{bold}#{ " #{ms}".slice -4 }#{reset} ms"
|
fmt = (ms) -> " #{bold}#{ " #{ms}".slice -4 }#{reset} ms"
|
||||||
total = 0
|
total = 0
|
||||||
|
|
2
bin/cake
2
bin/cake
|
@ -4,4 +4,4 @@ var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
|
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
|
||||||
|
|
||||||
require(lib + '/cake').run();
|
require(lib + '/coffee-script/cake').run();
|
||||||
|
|
|
@ -4,4 +4,4 @@ var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
|
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
|
||||||
|
|
||||||
require(lib + '/command').run();
|
require(lib + '/coffee-script/command').run();
|
||||||
|
|
0
lib/cake.js → lib/coffee-script/cake.js
Executable file → Normal file
0
lib/cake.js → lib/coffee-script/cake.js
Executable file → Normal file
0
lib/coffee-script.js → lib/coffee-script/coffee-script.js
Executable file → Normal file
0
lib/coffee-script.js → lib/coffee-script/coffee-script.js
Executable file → Normal file
0
lib/optparse.js → lib/coffee-script/optparse.js
Executable file → Normal file
0
lib/optparse.js → lib/coffee-script/optparse.js
Executable file → Normal file
|
@ -12,9 +12,9 @@
|
||||||
"node": ">=0.2.5"
|
"node": ">=0.2.5"
|
||||||
},
|
},
|
||||||
"directories" : {
|
"directories" : {
|
||||||
"lib" : "./lib"
|
"lib" : "./lib/coffee-script"
|
||||||
},
|
},
|
||||||
"main" : "./lib/coffee-script",
|
"main" : "./lib/coffee-script/coffee-script",
|
||||||
"bin": {
|
"bin": {
|
||||||
"coffee": "./bin/coffee",
|
"coffee": "./bin/coffee",
|
||||||
"cake": "./bin/cake"
|
"cake": "./bin/cake"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
# Ensure that the OptionParser handles arguments correctly.
|
# Ensure that the OptionParser handles arguments correctly.
|
||||||
return unless require?
|
return unless require?
|
||||||
{OptionParser} = require './../lib/optparse'
|
{OptionParser} = require './../lib/coffee-script/optparse'
|
||||||
|
|
||||||
opt = new OptionParser [
|
opt = new OptionParser [
|
||||||
['-r', '--required [DIR]', 'desc required']
|
['-r', '--required [DIR]', 'desc required']
|
||||||
|
|
Loading…
Add table
Reference in a new issue