Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start of big refactor to break it down into pieces
- Loading branch information
1 parent
0d62d13
commit 674fd7a
Showing
20 changed files
with
604 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
|
||
# Clean non-checked-in files. | ||
clean: | ||
@rm -rf node_modules | ||
# Binaries. | ||
mocha = ./node_modules/.bin/mocha \ | ||
--require gnode \ | ||
--require co-mocha \ | ||
--reporter spec \ | ||
--slow 500 \ | ||
--bail | ||
|
||
# Install dependencies from npm. | ||
node_modules: package.json | ||
@npm install | ||
@touch node_modules | ||
|
||
# Run the tests. | ||
test: node_modules | ||
@node_modules/.bin/mocha \ | ||
test/index \ | ||
--reporter spec \ | ||
--timeout 10000 \ | ||
--bail | ||
@$(mocha) | ||
|
||
# Run the tests in debug mode. | ||
test-debug: node_modules | ||
@$(mocha) debug | ||
|
||
# Phony targets. | ||
.PHONY: clean | ||
.PHONY: test | ||
.PHONY: test | ||
.PHONY: test-debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
/** | ||
* Add backwards compatibility for Node 0.10. | ||
*/ | ||
|
||
require('gnode'); | ||
|
||
/** | ||
* Export `Khaos`. | ||
*/ | ||
|
||
module.exports = require('./lib'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
|
||
var handlebars = require('handlebars'); | ||
var Case = require('case'); | ||
var moment = require('moment'); | ||
|
||
/** | ||
* Register a helper for each case. | ||
* Cases. | ||
*/ | ||
|
||
Object.keys(Case.cases).forEach(function(key){ | ||
handlebars.registerHelper(key + 'case', function(str){ | ||
exports[key + 'case'] = function(str){ | ||
return Case[key](str); | ||
}); | ||
}; | ||
}); | ||
|
||
/** | ||
* Add a default helper. | ||
* Default. | ||
*/ | ||
|
||
handlebars.registerHelper('default', function(value, def){ | ||
exports.default = function(value, def){ | ||
return value ? value : def; | ||
}); | ||
}; | ||
|
||
/** | ||
* Add a date helper. | ||
* Date. | ||
*/ | ||
|
||
handlebars.registerHelper('date', function(date, format){ | ||
exports.date = function(date, format){ | ||
return moment(date).format(format); | ||
}); | ||
}; | ||
|
||
/** | ||
* Add `is` and `isnt` helper. | ||
* Is and isnt. | ||
*/ | ||
|
||
handlebars.registerHelper('is', function(value, match){ | ||
exports.is = function(value, match){ | ||
return value === match; | ||
}); | ||
}; | ||
|
||
handlebars.registerHelper('isnt', function(value, match){ | ||
exports.isnt = function(value, match){ | ||
return value !== match; | ||
}); | ||
}; |
Oops, something went wrong.