Skip to content

Commit

Permalink
removed iced-coffee-script dev dependency. fixed package info with merge
Browse files Browse the repository at this point in the history
  • Loading branch information
malgorithms committed Jun 28, 2012
1 parent 496c0bc commit 1620fec
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 97 deletions.
12 changes: 6 additions & 6 deletions Cakefile
Expand Up @@ -6,18 +6,18 @@ stitch = require 'stitch'
task 'build', 'build the whole jam', (cb) ->
console.log "Building"
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.iced$/))
files = ('src/' + file for file in files when file.match(/\.coffee$/))
clearLibJs ->
buildParser ->
runIced ['-I', 'inline', '-c', '-o', 'lib/'].concat(files), ->
runIced ['-I', 'none', '-c', 'index.iced'], ->
runIced ['package.iced'], ->
runCoffee ['-c', '-o', 'lib/'].concat(files), ->
runCoffee ['-c', 'index.coffee'], ->
runCoffee ['package.coffee'], ->
stitchIt ->
console.log "Done building."
cb() if typeof cb is 'function'

runIced = (args, cb) ->
proc = spawn 'iced', args
runCoffee = (args, cb) ->
proc = spawn 'coffee', args
console.log args
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) ->
Expand Down
16 changes: 15 additions & 1 deletion README.md
Expand Up @@ -216,8 +216,22 @@ app.register '.toffee', toffee

contributing
=============
I would love for someone to make a textmate/sublime bundle for Toffee. :-) . I would even pay for it.
I'm likely to accept good pull requests.

If you'd like to edit code for this project, note that you should always edit the `.coffee` files,
as the `.js` files as generated automatically by building.

To build
```
> cake build
```

To make sure you didn't break something
```
> coffee tests/run_cases.coffee
```

I'm also very interested in someone building a Sublime/Textmate package for Toffee.

todo
======
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/command_line.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/consts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions lib/engine.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 22 additions & 8 deletions lib/view.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.iced → package.coffee
Expand Up @@ -3,7 +3,7 @@ fs = require 'fs'
obj =
name: "toffee"
description: """an express 3.x templating language based on coffeescript with slicker tokens."""
version: "0.0.7"
version: "0.0.9"
directories: {"lib" : "./lib"}
main: "index.js"
author: "Chris Coyne <ccoyne77@gmail.com>"
Expand All @@ -13,13 +13,12 @@ obj =
repository:
type: "git"
url: "http://github.com/malgorithms/toffee"
devDependencies:
"iced-coffee-script" : "1.3.1a"
licenses: [
{
type: "MIT"
url: "http://github.com/malgorithms/node-toffee/raw/master/LICENSE"
url: "http://github.com/malgorithms/toffee/raw/master/LICENSE"
}
]

await fs.writeFile './package.json', JSON.stringify(obj, null, " "), defer err, res
fs.writeFile './package.json', JSON.stringify(obj, null, " "), (err, res) ->
console.log "package.json written."
7 changes: 2 additions & 5 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "toffee",
"description": "an express 3.x templating language based on coffeescript with slicker tokens.",
"version": "0.0.7",
"version": "0.0.8",
"directories": {
"lib": "./lib"
},
Expand All @@ -15,13 +15,10 @@
"type": "git",
"url": "http://github.com/malgorithms/toffee"
},
"devDependencies": {
"iced-coffee-script": "1.3.1a"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/malgorithms/node-toffee/raw/master/LICENSE"
"url": "http://github.com/malgorithms/toffee/raw/master/LICENSE"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions test/run_cases.coffee
@@ -0,0 +1,56 @@
{engine} = require '../lib/engine'
fs = require 'fs'
path = require 'path'

e = new engine(maxCacheAge: 10000)

run_case_dir = (dir, cb) ->
expected = fs.readFileSync "#{dir}/output.toffee", "utf8"
if path.existsSync "#{dir}/vars.json"
vars = fs.readFileSync "#{dir}/vars.json", "utf8"
vars = JSON.parse vars
else
vars = {}
d = Date.now()
e.run "#{dir}/input.toffee", vars, (err, res) ->
time_ms = Date.now() - d
if err
cb err, time_ms
else
if res isnt expected
cb "Failure in case #{dir}." +
"\n\nExpected\n=====\n#{expected}\n=====" +
"\nGot\n=====\n#{res}\n=====\n", time_ms
else
cb null, time_ms

run_all_case_dirs = (cb) ->
time_ms = 0
case_dirs = fs.readdirSync "#{__dirname}/cases/"
countdown = case_dirs.length
for dir in case_dirs
run_case_dir "#{__dirname}/cases/#{dir}", (err, ms) ->
countdown--
time_ms += ms
if err
console.log err
process.exit 1
if countdown is 0
cb null, time_ms, case_dirs.length

run_all_case_dirs (err, time, tests_run) ->

console.log "SUCCESS for #{tests_run} cold tests in #{time}ms"

times = []
speed_runs = 20
countdown = speed_runs
total_time = 0
total_tests = 0
for i in [0...speed_runs]
run_all_case_dirs (err, time, tests_run) ->
countdown--
total_time += time
total_tests += tests_run
if countdown is 0
console.log "SUCCESS for #{total_tests} hot tests in #{total_time}ms. #{total_time / total_tests}ms/test"
49 changes: 0 additions & 49 deletions test/run_cases.iced

This file was deleted.

0 comments on commit 1620fec

Please sign in to comment.