Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Jan 22, 2015
1 parent 5dfee00 commit 0e2cb3a
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 74 deletions.
10 changes: 5 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .editorconfig <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2014 Charlike Mike Reagent, contributors.
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#

Expand All @@ -13,17 +13,17 @@ end_of_line = lf
insert_final_newline = false
trim_trailing_whitespace = false

[*.{json,cson,yml,yaml,md}]
indent_size = 2

[*.{js,php}]
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.{php,html,jade,css,stylus}]
[*.{php,html}]
indent_size = 4

[*.{json,cson,yml,yaml,html,md,jade,css,stylus}]
indent_size = 2

[Makefile]
indent_size = 2
indent_style = tab
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .gitattributes <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2014 Charlike Mike Reagent, contributors.
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .gitignore <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2014 Charlike Mike Reagent, contributors.
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#

Expand Down
8 changes: 4 additions & 4 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@
"disallowKeywordsOnNewLine": ["else"],
"disallowSpacesInCallExpression": true,

"requireSpacesInNamedFunctionExpression": {
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},

Expand Down
2 changes: 1 addition & 1 deletion .jshintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .jshintignore <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2014 Charlike Mike Reagent, contributors.
# Copyright (c) 2015 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#

Expand Down
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ node_js:
- "0.11"
matrix:
allow_failures:
- node_js: "0.11"
fast_finish: true
- node_js: "0.10"
fast_finish: true
script: "npm run-script test-travis"
after_script: "npm install coveralls && cat ./coverage/lcov.info | coveralls"
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

5 changes: 4 additions & 1 deletion history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## v1.0.0 / January 22, 2015
- publish

## v0.0.1 / December 20, 2014
- waiting [export-files#1](https://github.com/jonschlinkert/export-files/pull/1) merge
- ~~waiting [export-files#1](https://github.com/jonschlinkert/export-files/pull/1) merge~~

## v0.0.0 / December 20, 2014
- init commits
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* mustache-spec <https://github.com/tunnckoCore/mustache-spec>
*
* Copyright (c) 2014 Charlike Mike Reagent, contributors.
* Copyright (c) 2015 Charlike Mike Reagent, contributors.
* Released under the MIT license.
*/

Expand All @@ -10,12 +10,10 @@
var path = require('path');
var exportFiles = require('export-files');

function specs() {
module.exports = function mustacheSpec() {
return exportFiles(path.join(__dirname, 'specs'), {
filter: function(fp) {
return /\.json$/.test(path.basename(fp));
}
});
}

module.exports = specs();
};
2 changes: 1 addition & 1 deletion license.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 [Charlike Make Reagent](http://j.mp/1stW47C), contributors
Copyright (c) 2015 [Charlike Make Reagent](http://j.mp/1stW47C), contributors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
38 changes: 26 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"name": "mustache-spec",
"description": "mustache/spec as package",
"version": "v0.0.1",
"version": "0.0.0",
"description": "{{Mustache}} template specification, `mustache/spec` as package",
"scripts": {
"lint": "jshint . && jscs . --reporter inline",
"test": "mocha --require should"
"lint": "jshint index.js && jscs index.js --reporter inline",
"test": "mocha",
"test-cov": "istanbul cover _mocha",
"test-travis": "istanbul cover _mocha --report lcovonly"
},
"author": {
"name": "Charlike Make Reagent",
"email": "mameto_100@mail.bg",
"url": "https://github.com/tunnckoCore"
},
"repository": {
"type": "git",
"url": "git://github.com/tunnckoCore/mustache-spec.git"
},
"keywords": [
"mustache",
"mustache spec",
Expand All @@ -19,21 +25,29 @@
"spec tests",
"tests",
"test",
"template",
"templates",
"syntax",
"lang",
"language",
"langs",
"languages",
"render",
"standart",
"tpl",
"compile",
"specification"
],
"repository": {
"type": "git",
"url": "git://github.com/tunnckoCore/mustache-spec.git"
},
"license": {
"type": "MIT",
"url": "https://github.com/tunnckoCore/mustache-spec/blob/master/license.md"
},
"dependencies": {
"export-files": "*"
"export-files": ">=0"
},
"devDependencies": {
"mocha": ">=2",
"should": "^4.4.1"
"istanbul-harmony": "^0.3.1",
"mocha": "*",
"mocha-lcov-reporter": "^0.0.1"
}
}
}
28 changes: 14 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
[![npm version][npmjs-img]][npmjs-url]
[![mit license][license-img]][license-url]
[![build status][travis-img]][travis-url]
[![deps status][daviddm-img]][daviddm-url]
[![coveralls][coveralls-img]][coveralls-url]
## [![npm][npmjs-img]][npmjs-url] [![mit license][license-img]][license-url] [![build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![deps status][daviddm-img]][daviddm-url]

> mustache/spec as package
> {{Mustache}} template specification, `mustache/spec` as package
## Install
```bash
$ npm install mustache-spec
$ npm test
npm install mustache-spec
npm test
```


## Usage
> See the [tests](./test.js)
> For more use-cases see the [tests](./test.js)
```js
var specs = require('mustache-spec');

var mustacheSpec = require('mustache-spec');
var specs = mustacheSpec();
//=> specs.comments
//=> specs.delimiters
//=> specs.partials
//=> specs['~lambdas']
//=> etc...
```

Expand All @@ -36,7 +32,7 @@ var specs = require('mustache-spec');


## License [![MIT license][license-img]][license-url]
Copyright (c) 2014 [Charlike Mike Reagent][contrib-more], [contributors][contrib-graf].
Copyright (c) 2015 [Charlike Mike Reagent][contrib-more], [contributors][contrib-graf].
Released under the [`MIT`][license-url] license.


Expand All @@ -61,4 +57,8 @@ Released under the [`MIT`][license-url] license.
[author-npmjs]: https://npmjs.org/~tunnckocore

[contrib-more]: http://j.mp/1stW47C
[contrib-graf]: https://github.com/tunnckoCore/mustache-spec/graphs/contributors
[contrib-graf]: https://github.com/tunnckoCore/mustache-spec/graphs/contributors

***

_Powered and automated by [kdf](https://github.com/tunnckoCore), January 22, 2015_
41 changes: 31 additions & 10 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
/**
* mustache-spec <https://github.com/tunnckoCore/mustache-spec>
*
* Copyright (c) 2014 Charlike Mike Reagent, contributors.
* Copyright (c) 2015 Charlike Mike Reagent, contributors.
* Released under the MIT license.
*/

'use strict';

var assert = require('assert');
var specs = require('./index');

describe('mustache-spec', function() {
it('should be javascript object with all data', function(done) {
Object.keys(specs).should.have.lengthOf(7);
specs.should.have.properties('comments', 'delimiters', 'sections');
specs.comments.tests[0].name.should.equal('Inline');
specs.sections.tests[3].name.should.equal('Deeply Nested Contexts');
specs.sections.tests[3].data.a.one.should.equal(1);
specs.sections.tests[3].data.d.should.eql({four: 4});
specs.partials.overview.should.startWith('Partial tags are used to');
describe('mustache-spec:', function() {
it('should be json object with all data', function(done) {
assert.strictEqual(Object.keys(specs()).length, 6);
assert(specs().comments && specs().delimiters && specs().sections);
assert.strictEqual(specs().sections.tests[3].name, 'Deeply Nested Contexts');
done();
});
it('should have comments.json spec', function(done) {
assert.strictEqual(Object.keys(specs()).length, 6);
assert(specs().comments);
assert.strictEqual(specs().comments.tests[0].name, 'Inline');
done();
});
it('should have delimiters.json spec', function(done) {
assert.strictEqual(Object.keys(specs()).length, 6);
assert(specs().delimiters);
done();
});
it('should have sections.json spec', function(done) {
assert.strictEqual(Object.keys(specs()).length, 6);
assert(specs().sections);
assert.strictEqual(specs().sections.tests[3].data.a.one, 1);
assert.deepEqual(specs().sections.tests[3].data.d, {four: 4});
done();
});
it('should have partials.json spec', function(done) {
assert.strictEqual(Object.keys(specs()).length, 6);
assert(specs().partials);
assert(specs().partials.overview.indexOf('Partial tags are used to') !== -1);
done();
});
});

0 comments on commit 0e2cb3a

Please sign in to comment.