Skip to content

Commit 33ba439

Browse files
committed
Allow router and routes in src root.
1 parent b12a55f commit 33ba439

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

lib/engines/classic/main-file-info.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var path = require('path');
22
var ClassicFileInfo = require('./classic-file-info');
33

4+
var ROOT_FILES = ['main', 'router', 'routes'];
5+
46
var MainFileInfo = ClassicFileInfo.extend({
57
fileInfoType: 'MainFileInfo',
68

@@ -15,7 +17,7 @@ var MainFileInfo = ClassicFileInfo.extend({
1517
this.collectionGroup = '';
1618
this.collection = '';
1719

18-
if (this.name === 'main') {
20+
if (ROOT_FILES.indexOf(this.name) > -1) {
1921
// do nothing
2022
} else if (this.ext === '.js' || this.ext === '.html') {
2123
this.collection = 'main';

test/engines/classic-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('classic engine', function() {
4747
confirm('app/templates/foo-bar/baz/index.hbs', {type: 'template', name: 'index', namespace: 'foo-bar/baz', collection: 'routes', collectionGroup: 'ui'});
4848
confirm('app/adapters/application.js', {type: 'adapter', name: 'application', namespace: '', collection: 'models', collectionGroup: 'data' });
4949
confirm('app/app.js', {type: 'main', name: 'main', namespace: '', collection: '', collectionGroup: ''});
50-
confirm('app/router.js', {type: 'main', name: 'router', namespace: '', collection: 'main', collectionGroup: ''});
50+
confirm('app/router.js', {type: 'main', name: 'router', namespace: '', collection: '', collectionGroup: ''});
5151
confirm('app/index.md', { name: 'index', namespace: '', collection: '', collectionGroup: '' });
5252
confirm('app/styles/app.css', { type: 'style', name: 'app', namespace: '', collection: 'styles', collectionGroup: 'ui' });
5353
confirm('app/styles/components/badges.css', { type: 'style', name: 'badges', namespace: 'components', collection: 'styles', collectionGroup: 'ui' });
@@ -77,7 +77,8 @@ describe('classic engine', function() {
7777
'app/controllers/foo/bar/baz.js': 'src/ui/routes/foo/bar/baz/controller.js',
7878
'app/templates/posts/post/index.hbs': 'src/ui/routes/posts/post/index/template.hbs',
7979
'app/app.js': 'src/main.js',
80-
'app/router.js': 'src/main/router.js',
80+
'app/routes.js': 'src/routes.js',
81+
'app/router.js': 'src/router.js',
8182
'app/README.md': 'src/README.md',
8283
'app/_config.yml': 'src/_config.yml',
8384
'app/index.html': 'src/main/index.html',

test/fixtures/classic-acceptance/output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
22
'src': {
33
'main.js': 'app.js',
4+
'router.js': 'router.js',
45
'init': {
56
'initializers': {
67
'blah.js': 'blah initializer',
@@ -11,7 +12,6 @@ module.exports = {
1112
}
1213
},
1314
'main': {
14-
'router.js': 'router.js',
1515
'index.html': 'index.html contents'
1616
},
1717
'ui': {

0 commit comments

Comments
 (0)