Skip to content

Commit 7617551

Browse files
authored
Merge pull request #7541 from GavinJoyce/gj/mu
Add `project.isModuleUnification()`
2 parents 09de17f + 47a6f88 commit 7617551

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

lib/models/project.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class Project {
141141
return false;
142142
};
143143

144+
NULL_PROJECT.isModuleUnification = function() {
145+
return false;
146+
};
147+
144148
NULL_PROJECT.name = function() {
145149
return path.basename(process.cwd());
146150
};
@@ -185,6 +189,16 @@ class Project {
185189
return !!this.pkg.keywords && this.pkg.keywords.indexOf('ember-addon') > -1;
186190
}
187191

192+
/**
193+
Returns whether this is using a module unification format.
194+
@private
195+
@method isModuleUnification
196+
@return {Boolean} Whether this is using a module unification format.
197+
*/
198+
isModuleUnification() {
199+
return this.has('src');
200+
}
201+
188202
/**
189203
Returns the path to the configuration.
190204

tests/helpers/mock-project.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ class MockProject extends Project {
6363
isEmberCLIAddon() {
6464
return false;
6565
}
66+
67+
isModuleUnification() {
68+
return false;
69+
}
6670
}
6771

6872
module.exports = MockProject;

tests/unit/models/project-test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,25 @@ describe('models/project.js', function() {
526526
});
527527
});
528528

529+
describe('isModuleUnification', function() {
530+
beforeEach(function() {
531+
projectPath = `${process.cwd()}/tmp/test-app`;
532+
533+
makeProject();
534+
});
535+
536+
it('returns false when `./src` does not exist', function() {
537+
expect(project.isModuleUnification()).to.equal(false);
538+
});
539+
540+
it('returns true when `./src` exists', function() {
541+
let srcPath = path.join(projectPath, 'src');
542+
fs.ensureDirSync(srcPath);
543+
544+
expect(project.isModuleUnification()).to.equal(true);
545+
});
546+
});
547+
529548
describe('findAddonByName', function() {
530549
beforeEach(function() {
531550
projectPath = `${process.cwd()}/tmp/test-app`;

0 commit comments

Comments
 (0)