Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/models/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ class Project {
return false;
};

NULL_PROJECT.isModuleUnification = function() {
return false;
};

NULL_PROJECT.name = function() {
return path.basename(process.cwd());
};
Expand Down Expand Up @@ -185,6 +189,16 @@ class Project {
return !!this.pkg.keywords && this.pkg.keywords.indexOf('ember-addon') > -1;
}

/**
Returns whether this is using a module unification format.
@private
@method isModuleUnification
@return {Boolean} Whether this is using a module unification format.
*/
isModuleUnification() {
return this.has('src');
}

/**
Returns the path to the configuration.

Expand Down
4 changes: 4 additions & 0 deletions tests/helpers/mock-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class MockProject extends Project {
isEmberCLIAddon() {
return false;
}

isModuleUnification() {
return false;
}
}

module.exports = MockProject;
19 changes: 19 additions & 0 deletions tests/unit/models/project-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,25 @@ describe('models/project.js', function() {
});
});

describe('isModuleUnification', function() {
beforeEach(function() {
projectPath = `${process.cwd()}/tmp/test-app`;

makeProject();
});

it('returns false when `./src` does not exist', function() {
expect(project.isModuleUnification()).to.equal(false);
});

it('returns true when `./src` exists', function() {
let srcPath = path.join(projectPath, 'src');
fs.ensureDirSync(srcPath);

expect(project.isModuleUnification()).to.equal(true);
});
});

describe('findAddonByName', function() {
beforeEach(function() {
projectPath = `${process.cwd()}/tmp/test-app`;
Expand Down