/* eslint-env node */
'use strict';

module.exports = {
  name: 'ember-chrome-devtools',

  treeFor(name) {
    if (this.app.env === 'production') {
      return;
    }

    return this._super.treeFor.apply(this, arguments);
  },
};

/* eslint-env node */
'use strict';

module.exports = {
  name: 'ember-chrome-devtools',

  included(parent) {
    this.isProductionBuild = parent.env === 'production';
  },

  treeFor(name) {
    if (this.isProductionBuild) {
      return;
    }

    return this._super.treeFor.apply(this, arguments);
  },
};

Support use as a `dependency` of an addon
Support use as a `dependency` of an addon

We have an internal addon which is used by a number of applications and
I wanted to be able to specify `ember-chrome-devtools` as a `dependency`
(not `devDependency`) of that addon and have the goodness that it
brings in all of our apps.

Unfortunately `ember-chrome-devtools` blows up because `this.app` is
`undefined` in that circumstance and so `this.app.env` is not
accessible.

This workaround makes things work in my use-case with one additional
gotcha. You need to explictly trigger the included hook of this addon
from your consuming addon:

```js
included: function included(app) {
  // Other stuff?
  this.addons.forEach(function(addon) {
    if (addon.name === 'ember-chrome-devtools') {
      addon.included.apply(addon, [app]);
    }
  });
},
```

There must be a better way but for now this allows me to use this
addon successfully.
