Skip to content

Commit

Permalink
Merge pull request #32 from JacksonTian/ejs2
Browse files Browse the repository at this point in the history
Ejs2
  • Loading branch information
JacksonTian committed Oct 26, 2018
2 parents 21c6ddf + 3931099 commit 6380939
Show file tree
Hide file tree
Showing 18 changed files with 518 additions and 732 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
*.debug.js
*.min.js
node_modules/*
56 changes: 56 additions & 0 deletions .eslintrc
@@ -0,0 +1,56 @@
{
"rules": {
"indent": [
2,
2
],
"quotes": [
2,
"single",
{"avoidEscape": true, "allowTemplateLiterals": true}
],
"linebreak-style": [
2,
"unix"
],
"semi": [2, "always"],
"strict": [2, "global"],
"curly": 2,
"eqeqeq": 2,
"no-eval": 2,
"guard-for-in": 2,
"no-caller": 2,
"no-else-return": 2,
"no-eq-null": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-labels": 2,
"no-with": 2,
"no-loop-func": 1,
"no-native-reassign": 2,
"no-redeclare": [2, {"builtinGlobals": true}],
"no-delete-var": 2,
"no-shadow-restricted-names": 2,
"no-undef-init": 2,
"no-use-before-define": 2,
"no-unused-vars": 2,
"no-undef": 2,
"global-require": 0,
"no-console": 0,
"generator-star-spacing": ["error", "after"]
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"globals": {
"describe": true,
"it": true,
"before": true,
"after": true
},
"extends": "eslint:recommended"
}
42 changes: 0 additions & 42 deletions .jshintrc

This file was deleted.

5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,7 +1,6 @@
language: node_js
node_js:
- "0.12"
- "0.11"
- "0.10"
- "8"
- "6"

script: make test-coveralls
15 changes: 10 additions & 5 deletions Makefile
@@ -1,25 +1,30 @@
TESTS = test/*.js
REPORTER = spec
TIMEOUT = 20000
ISTANBUL = ./node_modules/.bin/istanbul
PATH := ./node_modules/.bin:$(PATH)
MOCHA = ./node_modules/mocha/bin/_mocha
COVERALLS = ./node_modules/coveralls/bin/coveralls.js

clean:
@rm -rf node_modules

test:
@NODE_ENV=test $(MOCHA) -r should -R $(REPORTER) -t $(TIMEOUT) \
@mocha -r should -R $(REPORTER) -t $(TIMEOUT) \
$(MOCHA_OPTS) \
$(TESTS)

test-debug:
@mocha --debug-brk -r should -R $(REPORTER) -t $(TIMEOUT) \
$(MOCHA_OPTS) \
$(TESTS)

test-cov:
@$(ISTANBUL) cover --report html $(MOCHA) -- -t $(TIMEOUT) -r should -R spec $(TESTS)
@istanbul cover --report html $(MOCHA) -- -t $(TIMEOUT) -r should -R spec $(TESTS)

test-coveralls:
@$(ISTANBUL) cover --report lcovonly $(MOCHA) -- -t $(TIMEOUT) -r should -R spec $(TESTS)
@istanbul cover --report lcovonly $(MOCHA) -- -t $(TIMEOUT) -r should -R spec $(TESTS)
@echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
@cat ./coverage/lcov.info | $(COVERALLS) && rm -rf ./coverage
@cat ./coverage/lcov.info | coveralls && rm -rf ./coverage

test-all: test test-coveralls

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -57,7 +57,7 @@ var express = require('express'),
// use ejs-locals for all ejs templates:
app.engine('ejs', engine);

app.set('views',__dirname + '/views');
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs'); // so you can render('index')

// render 'index' into 'boilerplate':
Expand Down
25 changes: 25 additions & 0 deletions lib/block.js
@@ -0,0 +1,25 @@
'use strict';

class Block {
constructor() {
this.html = [];
}

toString() {
return this.html.join('\n');
}

append(more) {
this.html.push(more);
}

prepend(more) {
this.html.unshift(more);
}

replace(instead) {
this.html = [ instead ];
}
}

module.exports = Block;

0 comments on commit 6380939

Please sign in to comment.