Loading lib/util/git.js +1 −102 Original line number Diff line number Diff line var childProcess = require('child_process'); module.exports = { debug: function(callback) { childProcess.exec('git remote -v', {}, function(err, remotes) { if (err) { throw new Error('git.remote: ' + err.message); } childProcess.exec('git branch -a', {}, function(err, branches) { if (err) { throw new Error('git.branch: ' + err.message); } callback(remotes, branches); }); }); }, clean: function(callback) { childProcess.exec('git diff-index --name-only HEAD --', {}, function(err, stdout) { callback(undefined, !err && !stdout); }); }, commitInfo: function(callback) { module.exports.head(function(err, headSha) { module.exports.master(function(err, masterSha) { module.exports.tagName(function(err, tagName) { callback(undefined, { head: headSha, master: masterSha, tagName: tagName, isMaster: headSha === masterSha }); }); }); }); }, head: function(callback) { childProcess.exec('git rev-parse --short HEAD', {}, function(err, stdout) { if (err) { throw new Error('git.head: ' + err.message); } callback(undefined, stdout.trim()); }); }, master: function(callback) { childProcess.exec('git rev-parse --short origin/master', {}, function(err, stdout) { // This will error if master was not checked out but in this case we know we are not master // so we can ignore. if (err && !(/Needed a single revision/.test(err.message))) { throw new Error('git.master: ' + err.message); } callback(undefined, stdout.trim()); }); }, add: function(path, callback) { childProcess.exec('git add -f ' + path, {}, function(err) { if (err) { throw new Error('git.add: ' + err.message); } callback(); }); }, commit: function(name, callback) { childProcess.exec('git commit --message=' + name, {}, function(err) { if (err) { throw new Error('git.commit: ' + err.message); } callback(); }); }, tag: function(name, callback) { childProcess.exec('git tag -a --message=' + name + ' ' + name, {}, function(err) { if (err) { throw new Error('git.tag: ' + err.message); } callback(); }); }, tagName: function(callback) { childProcess.exec('git describe --tags', {}, function(err, stdout) { if (err) { throw new Error('git.tagName: ' + err.message); } var tags = stdout.trim().split(/\n/); tags = tags.filter(function(info) { info = info.split('-'); return info.length == 1; }); var versionTags = tags.filter(function(info) { return (/^v/.test(info[0])); }); callback(undefined, versionTags[0] || tags[0]); }); }, log: function(filepath, pretty, callback) { var dateformat = 'format:"%d/%m/%Y"'; Loading @@ -115,4 +13,5 @@ module.exports = { return childProcess.execSync(cmd); } }; lib/util/highlight-code.js +0 −2 Original line number Diff line number Diff line var hljs = require('../vendor/highlightjs'); var multiline = require('multiline'); /** * render a code snippet into highlighted code HTML Loading lib/util/log.js +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ function processlog(file, data, time) { debug : debug, warn : warn };*/ module.exports = function () {}; //module.exports = function () {}; module.exports.log = info, module.exports.info = info, module.exports.process= processlog, Loading test/data/patterns.json 0 → 100644 +112 −0 Original line number Diff line number Diff line { "atom/link": { "pattern": { "name": "atom/link", "categories": [ "basic", "typography" ], "uses": null }, "params": { "class": [ "*" ], "href": [ "*" ], "label": [ "*" ] }, "body": "<a class=\"{{class}}\" href=\"{{#if href}}{{href}}{{/if}}{{#unless href}}{{texthelper 'url'}}{{/unless}}\">{{#if label}}{{label}}{{/if}}{{#unless label}}{{texthelper 'word'}}{{/unless}}</a>" }, "atom/modal-close-button": { "pattern": { "name": "atom/modal-close-button", "categories": [ "button", "modal" ] }, "body": "<a class=\"btn btn-icon btn-cta-xhr cta-xhr-modal-close\" href=\"javascript:return true;\" aria-label=\"Close modal\" data-close>\n <span aria-hidden=\"true\">×</span>\n</a>" }, "atom/text-headline": { "pattern": { "name": "atom/text-headline", "categories": [ "basic", "typography" ], "uses": null }, "params": { "heading": [ "1", "2", "3", "4", "5", "6" ], "class": [ "*" ], "text": [ "*" ] }, "defaults": { "heading": "1" }, "body": "{{#unless heading}}\n<h{{defaults.heading}} class=\"{{class}}\">{{#unless text}}{{texthelper 'words'}}{{/unless}}{{#if text}}{{text}}{{/if}}</h{{defaults.heading}}>\n{{/unless}}\n{{#if heading}}\n<h{{heading}} class=\"{{class}}\">{{#unless text}}{{texthelper 'words'}}{{/unless}}{{#if text}}{{text}}{{/if}}</h{{heading}}>\n{{/if}}\n" }, "atom/text-paragraph": { "pattern": { "name": "atom/text-paragraph", "categories": [ "basic", "typography" ], "uses": null }, "params": { "class": [ "*" ] }, "body": "<p class=\"{{class}}\">{{texthelper 'normal'}}</p>" }, "molecule/article-teaser": { "pattern": { "name": "molecule/article-teaser", "categories": [ "typography", "article" ], "uses": [ "atom/text-headline", "atom/text-paragraph", "atom/link" ] }, "params": { "class": [ "*" ], "headline": [ "*" ], "content": [ "*" ], "url": [ "*" ] }, "defaults": { "headline": "This is some article headline..." }, "body": "<article class=\"{{class}}\">\n {{patternlibrary atom=\"text-headline\" text=headline}}\n {{patternlibrary atom=\"text-paragraph\" text=content}}\n {{patternlibrary atom=\"link\" href=url label=\"more\" class=\"more\"}}\n</article>" } } test/test.20.adapter.js +0 −10 Original line number Diff line number Diff line Loading @@ -74,7 +74,6 @@ describe('Patternlibrary instanciation and configuration:', function() { 'test/fixtures/adapters/example/partials/atoms/link/atom-link.html', {}, ( a, b ) => { console.log(b); expect(b.pattern.name).to.be.a('string').that.is.equal('atom/link'); expect(b.pattern.categories).to.be.an('array').that.is.deep.equal(['basics','texts']); done(); Loading Loading @@ -134,15 +133,6 @@ describe('Patternlibrary instanciation and configuration:', function() { describe('Patternlibrary "example" adapter:', () => { let adapter = require('../lib/adapters/example.js'); /*let patternlibraryOptions = { verbose : false, dest : FIXTURES + 'example/build', root : FIXTURES + 'example/pages/', layouts : FIXTURES + 'example/layouts/', partials: FIXTURES + 'example/partials/', testing : true }; var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);*/ var p = new Patternlibrary.Patternlibrary(); it('retrieves example\'s source-code from file', function (done) { Loading Loading
lib/util/git.js +1 −102 Original line number Diff line number Diff line var childProcess = require('child_process'); module.exports = { debug: function(callback) { childProcess.exec('git remote -v', {}, function(err, remotes) { if (err) { throw new Error('git.remote: ' + err.message); } childProcess.exec('git branch -a', {}, function(err, branches) { if (err) { throw new Error('git.branch: ' + err.message); } callback(remotes, branches); }); }); }, clean: function(callback) { childProcess.exec('git diff-index --name-only HEAD --', {}, function(err, stdout) { callback(undefined, !err && !stdout); }); }, commitInfo: function(callback) { module.exports.head(function(err, headSha) { module.exports.master(function(err, masterSha) { module.exports.tagName(function(err, tagName) { callback(undefined, { head: headSha, master: masterSha, tagName: tagName, isMaster: headSha === masterSha }); }); }); }); }, head: function(callback) { childProcess.exec('git rev-parse --short HEAD', {}, function(err, stdout) { if (err) { throw new Error('git.head: ' + err.message); } callback(undefined, stdout.trim()); }); }, master: function(callback) { childProcess.exec('git rev-parse --short origin/master', {}, function(err, stdout) { // This will error if master was not checked out but in this case we know we are not master // so we can ignore. if (err && !(/Needed a single revision/.test(err.message))) { throw new Error('git.master: ' + err.message); } callback(undefined, stdout.trim()); }); }, add: function(path, callback) { childProcess.exec('git add -f ' + path, {}, function(err) { if (err) { throw new Error('git.add: ' + err.message); } callback(); }); }, commit: function(name, callback) { childProcess.exec('git commit --message=' + name, {}, function(err) { if (err) { throw new Error('git.commit: ' + err.message); } callback(); }); }, tag: function(name, callback) { childProcess.exec('git tag -a --message=' + name + ' ' + name, {}, function(err) { if (err) { throw new Error('git.tag: ' + err.message); } callback(); }); }, tagName: function(callback) { childProcess.exec('git describe --tags', {}, function(err, stdout) { if (err) { throw new Error('git.tagName: ' + err.message); } var tags = stdout.trim().split(/\n/); tags = tags.filter(function(info) { info = info.split('-'); return info.length == 1; }); var versionTags = tags.filter(function(info) { return (/^v/.test(info[0])); }); callback(undefined, versionTags[0] || tags[0]); }); }, log: function(filepath, pretty, callback) { var dateformat = 'format:"%d/%m/%Y"'; Loading @@ -115,4 +13,5 @@ module.exports = { return childProcess.execSync(cmd); } };
lib/util/highlight-code.js +0 −2 Original line number Diff line number Diff line var hljs = require('../vendor/highlightjs'); var multiline = require('multiline'); /** * render a code snippet into highlighted code HTML Loading
lib/util/log.js +1 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ function processlog(file, data, time) { debug : debug, warn : warn };*/ module.exports = function () {}; //module.exports = function () {}; module.exports.log = info, module.exports.info = info, module.exports.process= processlog, Loading
test/data/patterns.json 0 → 100644 +112 −0 Original line number Diff line number Diff line { "atom/link": { "pattern": { "name": "atom/link", "categories": [ "basic", "typography" ], "uses": null }, "params": { "class": [ "*" ], "href": [ "*" ], "label": [ "*" ] }, "body": "<a class=\"{{class}}\" href=\"{{#if href}}{{href}}{{/if}}{{#unless href}}{{texthelper 'url'}}{{/unless}}\">{{#if label}}{{label}}{{/if}}{{#unless label}}{{texthelper 'word'}}{{/unless}}</a>" }, "atom/modal-close-button": { "pattern": { "name": "atom/modal-close-button", "categories": [ "button", "modal" ] }, "body": "<a class=\"btn btn-icon btn-cta-xhr cta-xhr-modal-close\" href=\"javascript:return true;\" aria-label=\"Close modal\" data-close>\n <span aria-hidden=\"true\">×</span>\n</a>" }, "atom/text-headline": { "pattern": { "name": "atom/text-headline", "categories": [ "basic", "typography" ], "uses": null }, "params": { "heading": [ "1", "2", "3", "4", "5", "6" ], "class": [ "*" ], "text": [ "*" ] }, "defaults": { "heading": "1" }, "body": "{{#unless heading}}\n<h{{defaults.heading}} class=\"{{class}}\">{{#unless text}}{{texthelper 'words'}}{{/unless}}{{#if text}}{{text}}{{/if}}</h{{defaults.heading}}>\n{{/unless}}\n{{#if heading}}\n<h{{heading}} class=\"{{class}}\">{{#unless text}}{{texthelper 'words'}}{{/unless}}{{#if text}}{{text}}{{/if}}</h{{heading}}>\n{{/if}}\n" }, "atom/text-paragraph": { "pattern": { "name": "atom/text-paragraph", "categories": [ "basic", "typography" ], "uses": null }, "params": { "class": [ "*" ] }, "body": "<p class=\"{{class}}\">{{texthelper 'normal'}}</p>" }, "molecule/article-teaser": { "pattern": { "name": "molecule/article-teaser", "categories": [ "typography", "article" ], "uses": [ "atom/text-headline", "atom/text-paragraph", "atom/link" ] }, "params": { "class": [ "*" ], "headline": [ "*" ], "content": [ "*" ], "url": [ "*" ] }, "defaults": { "headline": "This is some article headline..." }, "body": "<article class=\"{{class}}\">\n {{patternlibrary atom=\"text-headline\" text=headline}}\n {{patternlibrary atom=\"text-paragraph\" text=content}}\n {{patternlibrary atom=\"link\" href=url label=\"more\" class=\"more\"}}\n</article>" } }
test/test.20.adapter.js +0 −10 Original line number Diff line number Diff line Loading @@ -74,7 +74,6 @@ describe('Patternlibrary instanciation and configuration:', function() { 'test/fixtures/adapters/example/partials/atoms/link/atom-link.html', {}, ( a, b ) => { console.log(b); expect(b.pattern.name).to.be.a('string').that.is.equal('atom/link'); expect(b.pattern.categories).to.be.an('array').that.is.deep.equal(['basics','texts']); done(); Loading Loading @@ -134,15 +133,6 @@ describe('Patternlibrary instanciation and configuration:', function() { describe('Patternlibrary "example" adapter:', () => { let adapter = require('../lib/adapters/example.js'); /*let patternlibraryOptions = { verbose : false, dest : FIXTURES + 'example/build', root : FIXTURES + 'example/pages/', layouts : FIXTURES + 'example/layouts/', partials: FIXTURES + 'example/partials/', testing : true }; var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);*/ var p = new Patternlibrary.Patternlibrary(); it('retrieves example\'s source-code from file', function (done) { Loading