Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon configuration. #1972

Merged
merged 2 commits into from
Sep 12, 2014
Merged

Addon configuration. #1972

merged 2 commits into from
Sep 12, 2014

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 12, 2014

  • Replaces Introducing config hook for addons #1914.
  • Adds basic unit tests for updateCache method.
  • Add Project.prototype.configPath.
  • Add Project.prototype.getAddonConfig.
  • Update Project.prototype.config to merge addon config with application config.
    • Ensure that app config ALWAYS wins.
    • If no app config exists, return addon config result.

Implements: ember-cli#1907

A new `config` hook is available for addons. It can be used to alternate application configuration (example: toggling FEATURE flags for Ember) or to read the current config and change addon behaviour (example: importing dependencies conditionally).

Interface:
```
// environment - 'development', 'test', 'production'
// currentConfig - hash with config for given environment
config: function(environment, currentConfig) {}
```
@rwjblue
Copy link
Member Author

rwjblue commented Sep 12, 2014

There will be more PR's incoming, but this gets us moving in the correct direction (and lands addon configuration merging).

@@ -182,6 +183,10 @@ EmberApp.prototype._notifyAddonIncluded = function() {
}, this);
};

EmberApp.prototype.configureAddons = function() {
// do something that will make addon `config` hook to fire
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me that's the important part but not sure how to make it happen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, you want the configuration to be available within the included hook, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that you can tailor what is included based on the full addon + app config.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored this to Project.prototype.config (and removed this configureAddons function). If you need the configuration in an addon's included hook, call this.project.config(this.app.env).

@rwjblue rwjblue force-pushed the addon-config branch 3 times, most recently from f9a2455 to bc8c749 Compare September 12, 2014 12:17
rwjblue added a commit that referenced this pull request Sep 12, 2014
@rwjblue rwjblue merged commit 3886135 into ember-cli:master Sep 12, 2014
@rwjblue rwjblue deleted the addon-config branch September 12, 2014 13:51
@chrmod
Copy link
Member

chrmod commented Sep 12, 2014

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants