Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.

Commit 244a710

Browse files
committed
Support Many Kinds of Projects
Resolves #381
1 parent 3afce2f commit 244a710

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

lib/commands/print-failing.js

+35-7
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,47 @@ module.exports = {
1212

1313
availableOptions: [],
1414

15-
run() {
15+
appRoot() {
16+
let project = this.project;
17+
let appRoot;
18+
19+
if (project.isEmberCLIAddon()) {
20+
return 'addon';
21+
} else if (project.isModuleUnification()) {
22+
return 'src';
23+
} else {
24+
return 'app';
25+
}
26+
},
27+
28+
_scanForHbsFiles(dir) {
29+
return walkSync(dir, { globs: ['**/*.hbs'] });
30+
},
31+
32+
getTemplateFiles() {
1633
let project = this.project;
34+
let appRoot = this.appRoot();
35+
36+
if (project.isEmberCLIAddon()) {
37+
let files = this._scanForHbsFiles(appRoot);
38+
let moreFiles = this._scanForHbsFiles('tests/dummy/app');
39+
40+
return files.concat(moreFiles);
41+
} else if (project.isModuleUnification()) {
42+
return this._scanForHbsFiles(appRoot);
43+
} else {
44+
return this._scanForHbsFiles(appRoot);
45+
}
46+
},
47+
48+
run() {
49+
let appRoot = this.appRoot();
1750
let modulePrefix = project.config().modulePrefix;
1851
let linter = new Linter();
1952
let templatesWithErrors = [];
2053

21-
let templateFiles = walkSync('app').filter(file => {
22-
// remove any non-hbs files
23-
return path.extname(file) === '.hbs';
24-
});
25-
2654
templateFiles.forEach(file => {
27-
let filePath = path.join('app', file);
55+
let filePath = path.join(appRoot, file);
2856
let contents = fs.readFileSync(filePath, { encoding: 'utf8' });
2957
let moduleId = path.join(modulePrefix, file).slice(0, -4);
3058

0 commit comments

Comments
 (0)