diff --git a/.gitignore b/.gitignore index ff8c3e3..caa0327 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,5 @@ .#* *~ npm-debug.log -.grunt.js node_modules/* -build/ -public/ +lib/ diff --git a/Makefile b/Makefile index f574a2c..80dee91 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,18 @@ -.PHONY: app libs test +.PHONY: lib test - -app_sources:= $(wildcard src/*/*.coffee) -app_objects:= $(subst src/, app/, $(app_sources:%.coffee=%.js)) - -libs= $(shell cd src && find . -type f -name '*.js') - -home_sources = src/index.haml -home_objects = app/index.html +lib_sources:= $(wildcard src/*.coffee) +lib_objects:= $(subst src/, lib/, $(lib_sources:%.coffee=%.js)) default: build -build: app bootstrap $(app_objects) $(home_objects) libs +build: $(lib_objects) -app: - mkdir -p $@ - -$(app_objects): app/%.js: src/%.coffee +$(lib_objects): lib/%.js: src/%.coffee + @mkdir -p $(@D) coffee -o $(@D) -c $< -libs: - cd src && tar cf - $(libs) | ( cd ../app; tar xvf - ) - -$(home_objects): app/%.html: src/%.haml - haml --unix-newlines --no-escape-attrs --double-quote-attributes $< > $@ - -bootstrap: app - cp bootstrap-extras/variables.less vendor/bootstrap/less - cd vendor/bootstrap && make build - cd vendor/bootstrap/bootstrap && tar cf - .| (cd ../../../app && tar xvf - ) - test: test/[0-9]*_mocha.coffee ./node_modules/.bin/mocha -C --compilers coffee:coffee-script -u tdd $< clean: - rm -fr app - cd vendor/bootstrap && git reset --hard HEAD + rm -fr lib diff --git a/package.json b/package.json index 1c062ba..3e2519b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "url": "http://elfsternberg.com/home/elfsternberg/repos/Tumble/LICENSE" }], "dependencies": { - "coffee-script": "1.x.x" + "coffee-script": "1.x.x", + "reparse-coffeescript": "git://github.com/elfsternberg/reparse-coffeescript#master" }, "devDependencies": { "docco": "0.3.x", diff --git a/src/tumble.coffee b/src/tumble.coffee new file mode 100644 index 0000000..91674c5 --- /dev/null +++ b/src/tumble.coffee @@ -0,0 +1,14 @@ +# _ _ _ _ _____ _ _ +# /_\ | |__ __| |_ _ _ __ _ __| ||_ _| _ _ __ | |__| |_ _ +# / _ \| '_ (_-< _| '_/ _` / _| _|| || || | ' \| '_ \ | '_| +# /_/ \_\_.__/__/\__|_| \__,_\__|\__||_| \_,_|_|_|_|_.__/_|_| +# + +# Built on top of the basic parser-combinator for Coffeescript, this +# defines a parser for the Tumblr engine, assuming the following: + +ReParse = require('reparse-coffeescript/lib/reparse').ReParse + +class AbstractTumbler extends ReParse + +module.exports = class extends AbstractTumbler diff --git a/test/01_basics_mocha.coffee b/test/01_basics_mocha.coffee index 843df2b..d984573 100644 --- a/test/01_basics_mocha.coffee +++ b/test/01_basics_mocha.coffee @@ -3,38 +3,39 @@ assert = chai.assert expect = chai.expect should = chai.should() -tumbl = require 'lib/tumble' +Tumbler = require('../lib/tumble') + +tumbl = new Tumbler() test_data = [ - { - 'input': '', - 'output': '' - } - { - 'input': '', - 'output': '', - } - { - 'input': '