Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit c4d5080

Browse files
committed
add file extension to oPattern, update unit test
1 parent fd5e6b6 commit c4d5080

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

builder/object_factory.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
(function () {
1212
"use strict";
1313

14-
var PatternEngines = require('./pattern_engines/pattern_engines');
14+
var patternEngines = require('./pattern_engines/pattern_engines');
15+
var path = require('path');
1516

1617
var oPattern = function(abspath, subdir, filename, data){
1718
this.fileName = filename.substring(0, filename.indexOf('.'));
19+
this.fileExtension = path.extname(abspath);
1820
this.abspath = abspath;
1921
this.subdir = subdir;
2022
this.name = subdir.replace(/[\/\\]/g, '-') + '-' + this.fileName; //this is the unique name with the subDir
@@ -34,7 +36,7 @@
3436
this.lineageIndex = [];
3537
this.lineageR = [];
3638
this.lineageRIndex = [];
37-
this.engine = PatternEngines.getEngineForPattern(this);
39+
this.engine = patternEngines.getEngineForPattern(this);
3840
};
3941
// render method on oPatterns; this acts as a proxy for the PatternEngine's
4042
// render function

test/object_factory_tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
test.equals(p.abspath, 'source/_patterns/00-atoms/00-global/00-colors.mustache');
1111
test.equals(p.subdir, '00-atoms/00-global');
1212
test.equals(p.fileName, '00-colors');
13+
test.equals(p.fileExtension, '.mustache');
1314
test.equals(p.jsonFileData.d, 123);
1415
test.equals(p.patternName, 'colors');
1516
test.equals(p.patternDisplayName, 'Colors');

0 commit comments

Comments
 (0)