@@ -12,19 +12,47 @@ module.exports = {
12
12
13
13
availableOptions : [ ] ,
14
14
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 ( ) {
16
33
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 ( ) ;
17
50
let modulePrefix = project . config ( ) . modulePrefix ;
18
51
let linter = new Linter ( ) ;
19
52
let templatesWithErrors = [ ] ;
20
53
21
- let templateFiles = walkSync ( 'app' ) . filter ( file => {
22
- // remove any non-hbs files
23
- return path . extname ( file ) === '.hbs' ;
24
- } ) ;
25
-
26
54
templateFiles . forEach ( file => {
27
- let filePath = path . join ( 'app' , file ) ;
55
+ let filePath = path . join ( appRoot , file ) ;
28
56
let contents = fs . readFileSync ( filePath , { encoding : 'utf8' } ) ;
29
57
let moduleId = path . join ( modulePrefix , file ) . slice ( 0 , - 4 ) ;
30
58
0 commit comments