lib/models/project.js:25
Project
The Project model is tied to your package.json. It is instantiated by giving closestSync the path to your project.
Static Method Summary
Static Public Methods | |
---|---|
public static |
getProjectRoot( ): String
Returns the project root based on the first package.json that is found |
Static Private Methods | |
---|---|
private static |
closestSync(pathName, _ui): Project
Returns a new project based on the first package.json that is found in |
private static |
projectOrnullProject(_ui): Project
Returns a new project based on the first package.json that is found in |
Constructor Summary
Public Constructors | |
---|---|
public |
Project(root, pkg, ui, cli)
The Project model is tied to your package.json. It is instantiated by giving closestSync the path to your project. |
Property Summary
Public Properties | |
---|---|
public |
targets: Unknown
Returns the targets of this project, or the default targets if not present. |
Private Properties | |
---|---|
private |
_watchmanInfo: Unknown
Set when the |
Method Summary
Public Methods | |
---|---|
public |
Loads the configuration for this project and its addons. |
public |
generateTestFile(moduleName, tests): String
Generate test file contents. |
public |
Returns whether or not this is an Ember CLI addon. |
public |
Calls |
Private Methods | |
---|---|
private |
Returns a list of addon paths where blueprints will be looked up. |
private |
addonCommands( ): Object
Returns what commands are made available by addons by inspecting |
private |
Returns a list of paths (including addon paths) where blueprints will be looked up. |
private |
bowerDependencies(bower): Object
Returns the bower dependencies for this project. |
private |
configPath( ): String
Returns the path to the configuration. |
private |
configWithoutCache(env): Object
|
private |
dependencies([pkg=this.pkg], [excludeDevDeps=false]): Object
Returns the dependencies from a package.json |
private |
Discovers all addons for this project and stores their names and package.json contents in this.addonPackages as key-value pairs |
private |
eachAddonCommand(callback)
Execute a given callback for every addon command. Example: |
private |
findAddonByName(name): Addon
Find an addon by its name |
private |
getAddonsConfig(env, appConfig): Object
Returns the addons configuration. |
private |
Returns whether or not the given file name is present in this project. |
private |
Loads and initializes all addons for this project. |
private |
Returns whether or not this is an Ember CLI project. This checks whether ember-cli is listed in devDependencies. |
private |
Returns whether this is using a module unification format. |
private |
Path to the blueprints for this project. |
private |
Returns the name from package.json. |
private |
reloadAddons( )
Re-initializes addons. |
private |
Reloads package.json |
private |
resolveSync(file): String
Resolves the absolute path to a file synchronously |
private |
Sets the name of the bower directory for this project |
private |
Provides the list of paths to consult for addons that may be provided internally to this project. Used for middleware addons with built-in support. |
Static Public Methods
lib/models/project.js:683
public static getProjectRoot( ): String
Returns the project root based on the first package.json that is found
Return:
The project root directory
Static Private Methods
lib/models/project.js:623
private static closestSync(pathName, _ui): Project
Returns a new project based on the first package.json that is found
in pathName
.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
pathName | String |
|
Path to your project |
_ui | UI |
|
The UI instance to provide to the created Project. |
Return:
Project instance
lib/models/project.js:659
private static projectOrnullProject(_ui): Project
Returns a new project based on the first package.json that is found
in pathName
, or the nullProject.
The nullProject signifies no-project, but abides by the null object pattern
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
_ui | UI |
|
The UI instance to provide to the created Project. |
Return:
Project instance
Public Constructors
lib/models/project.js:25
public Project(root, pkg, ui, cli)
Public Properties
lib/models/project.js:260
public targets: Unknown
Returns the targets of this project, or the default targets if not present.
Private Properties
lib/models/project.js:55
private _watchmanInfo: Unknown
Set when the Watcher.detectWatchman
helper method finishes running,
so that other areas of the system can be aware that watchman is being used.
For example, this information is used in the broccoli build pipeline to know if we can watch additional directories (like bower_components) "cheaply".
Contains enabled
and version
.
Public Methods
lib/models/project.js:223
public config(env): Object
Loads the configuration for this project and its addons.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
env | String |
|
Environment name |
Return:
Merged confiration object
lib/models/project.js:599
public generateTestFile(moduleName, tests): String
Generate test file contents.
This method is supposed to be overwritten by test framework addons
like ember-cli-qunit
and ember-cli-mocha
.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
moduleName | String |
|
Name of the test module (e.g. |
tests | Object[] |
|
Array of tests with |
Return:
The test file content
lib/models/project.js:182
public isEmberCLIAddon( ): Boolean
Returns whether or not this is an Ember CLI addon.
Return:
Whether or not this is an Ember CLI Addon.
lib/models/project.js:336
public require(file): Object
Calls require
on a given module from the context of the project. For
instance, an addon may want to require a class from the root project's
version of ember-cli.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
file | String |
|
File path or module name |
Return:
Imported module
Private Methods
lib/models/project.js:538
private addonBlueprintLookupPaths( ): Array
Returns a list of addon paths where blueprints will be looked up.
Return:
List of paths
lib/models/project.js:447
private addonCommands( ): Object
Returns what commands are made available by addons by inspecting
includedCommands
for every addon.
Return:
Addon names and command maps as key-value pairs
lib/models/project.js:520
private blueprintLookupPaths( ): Array
Returns a list of paths (including addon paths) where blueprints will be looked up.
Return:
List of paths
lib/models/project.js:371
private bowerDependencies(bower): Object
Returns the bower dependencies for this project.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
bower | String |
|
Path to bower.json |
Return:
Bower dependencies
lib/models/project.js:206
private configPath( ): String
Returns the path to the configuration.
Return:
Configuration path
lib/models/project.js:241
private configWithoutCache(env): Object
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
env | String |
|
Environment name |
Return:
Merged confiration object
lib/models/project.js:351
private dependencies([pkg=this.pkg], [excludeDevDeps=false]): Object
Returns the dependencies from a package.json
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
pkg | Object |
|
Package object |
excludeDevDeps | Boolean |
|
Whether or not development dependencies should be excluded |
Return:
Dependencies
lib/models/project.js:411
private discoverAddons( )
Discovers all addons for this project and stores their names and package.json contents in this.addonPackages as key-value pairs
lib/models/project.js:486
private eachAddonCommand(callback)
Execute a given callback for every addon command. Example:
project.eachAddonCommand(function(addonName, commands) {
console.log('Addon ' + addonName + ' exported the following commands:' + commands.keys().join(', '));
});
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
callback | Function |
|
[description] |
lib/models/project.js:585
private findAddonByName(name): Addon
Find an addon by its name
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
name | String |
|
Addon name as specified in package.json |
Return:
Addon instance
lib/models/project.js:287
private getAddonsConfig(env, appConfig): Object
Returns the addons configuration.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
env | String |
|
Environment name |
appConfig | Object |
|
Application configuration |
Return:
Merged configuration of all addons
lib/models/project.js:310
private has(file): Boolean
Returns whether or not the given file name is present in this project.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
file | String |
|
File name |
Return:
Whether or not the file is present
lib/models/project.js:424
private initializeAddons( )
Loads and initializes all addons for this project.
lib/models/project.js:170
private isEmberCLIProject( ): Boolean
Returns whether or not this is an Ember CLI project. This checks whether ember-cli is listed in devDependencies.
Return:
Whether this is an Ember CLI project
lib/models/project.js:192
private isModuleUnification( ): Boolean
Returns whether this is using a module unification format.
Return:
Whether this is using a module unification format.
lib/models/project.js:509
private localBlueprintLookupPath( ): String
Path to the blueprints for this project.
Return:
Path to blueprints
lib/models/project.js:157
private name( ): String
Returns the name from package.json.
Return:
Package name
lib/models/project.js:573
private reloadAddons( )
Re-initializes addons.
lib/models/project.js:557
private reloadPkg( ): Object
Reloads package.json
Return:
Package content
lib/models/project.js:322
private resolveSync(file): String
Resolves the absolute path to a file synchronously
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
file | String |
|
File to resolve |
Return:
Absolute path to file
lib/models/project.js:82
private setupBowerDirectory( )
Sets the name of the bower directory for this project
lib/models/project.js:387
private supportedInternalAddonPaths( )
Provides the list of paths to consult for addons that may be provided internally to this project. Used for middleware addons with built-in support.