Skip to content

Commit

Permalink
Support Many Kinds of Projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jherdman committed Sep 13, 2018
1 parent 3afce2f commit 244a710
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions lib/commands/print-failing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,47 @@ module.exports = {

availableOptions: [],

run() {
appRoot() {
let project = this.project;
let appRoot;

if (project.isEmberCLIAddon()) {
return 'addon';
} else if (project.isModuleUnification()) {
return 'src';
} else {
return 'app';
}
},

_scanForHbsFiles(dir) {
return walkSync(dir, { globs: ['**/*.hbs'] });
},

getTemplateFiles() {
let project = this.project;
let appRoot = this.appRoot();

if (project.isEmberCLIAddon()) {
let files = this._scanForHbsFiles(appRoot);
let moreFiles = this._scanForHbsFiles('tests/dummy/app');

return files.concat(moreFiles);
} else if (project.isModuleUnification()) {
return this._scanForHbsFiles(appRoot);
} else {
return this._scanForHbsFiles(appRoot);
}
},

run() {
let appRoot = this.appRoot();
let modulePrefix = project.config().modulePrefix;
let linter = new Linter();
let templatesWithErrors = [];

let templateFiles = walkSync('app').filter(file => {
// remove any non-hbs files
return path.extname(file) === '.hbs';
});

templateFiles.forEach(file => {
let filePath = path.join('app', file);
let filePath = path.join(appRoot, file);
let contents = fs.readFileSync(filePath, { encoding: 'utf8' });
let moduleId = path.join(modulePrefix, file).slice(0, -4);

Expand Down

0 comments on commit 244a710

Please sign in to comment.