function(config, aliasMap, pluginInstances) {
    var self = this;

    pluginInstances.forEach(function(instance) {
      if (instance.runBefore) {
        var befores = self._castArray(instance.runBefore);
        config = self._mergeAuthorProvidedOrderWithConfigOrder('before', instance.name, befores, config, aliasMap);
      }

      if (instance.runAfter) {
        var afters = self._castArray(instance.runAfter);
        config = self._mergeAuthorProvidedOrderWithConfigOrder('after', instance.name, afters, config, aliasMap);
      }
    });

    var aliases = this._flattenAliasMap(aliasMap);

    var configNames = Object.keys(config).reduce(function(arr, key) {
      arr.push(key);

      var befores = self._castArray(config[key].before);
      var afters = self._castArray(config[key].after);

      return arr.concat(befores).concat(afters);
    }, [])
    .reduce(function(arr, key) {
      if (arr.indexOf(key) === -1) {
        arr.push(key);
      }
      return arr;
    }, []);

    var unknownConfigKeys = _.difference(configNames, aliases);

    if (unknownConfigKeys.length) {
      this._logUnknownPlugins(unknownConfigKeys, 'config.pipeline.runOrder');
    }

    return config;
  }
function(config, aliasMap, pluginInstances) {
    var self = this;

    pluginInstances.forEach(function(instance) {
      if (instance.runBefore) {
        var befores = self._castArray(instance.runBefore);
        config = self._mergeAuthorProvidedOrderWithConfigOrder('before', instance.name, befores, config, aliasMap);
      }

      if (instance.runAfter) {
        var afters = self._castArray(instance.runAfter);
        config = self._mergeAuthorProvidedOrderWithConfigOrder('after', instance.name, afters, config, aliasMap);
      }
    });

    var aliases = this._flattenAliasMap(aliasMap);

    var configNames = Object.keys(config).reduce(function(arr, key) {
      arr.push(key);

      var befores = self._castArray(config[key].before);
      var afters = self._castArray(config[key].after);

      return arr.concat(befores).concat(afters);
    }, [])
    .reduce(function(arr, key) {
      if (arr.indexOf(key) === -1) {
        arr.push(key);
      }
      return arr;
    }, []);

    var unknownConfigKeys = _.difference(configNames, aliases);

    if (unknownConfigKeys.length) {
      this._logUnknownPlugins(unknownConfigKeys, 'config.pipeline.runOrder');
    }

    return config;
  }
function ( config , aliasMap , pluginInstances ) { var self = this ; pluginInstances . forEach ( function ( instance ) { if ( instance . runBefore ) { var befores = self . _castArray ( instance . runBefore ) ; config = self . _mergeAuthorProvidedOrderWithConfigOrder ( 'before' , instance . name , befores , config , aliasMap ) ; } if ( instance . runAfter ) { var afters = self . _castArray ( instance . runAfter ) ; config = self . _mergeAuthorProvidedOrderWithConfigOrder ( 'after' , instance . name , afters , config , aliasMap ) ; } } ) ; var aliases = this . _flattenAliasMap ( aliasMap ) ; var configNames = Object . keys ( config ) . reduce ( function ( arr , key ) { arr . push ( key ) ; var befores = self . _castArray ( config [ key ] . before ) ; var afters = self . _castArray ( config [ key ] . after ) ; return arr . concat ( befores ) . concat ( afters ) ; } , [ ] ) . reduce ( function ( arr , key ) { if ( arr . indexOf ( key ) === - 1 ) { arr . push ( key ) ; } return arr ; } , [ ] ) ; var unknownConfigKeys = _ . difference ( configNames , aliases ) ; if ( unknownConfigKeys . length ) { this . _logUnknownPlugins ( unknownConfigKeys , 'config.pipeline.runOrder' ) ; } return config ; }
Build up a hash of plugin instance execution order overrides.
This hash will only container an entry for instances that should run in a particular order. All other instances will be ordered by their natural
ordering.

Ordering of plugin instances can be specified by users of ember-cli-deploy via `config.pipeline.runOrder` and by plugin authors via `run{Before,After}`.
This function will attempt to merge the author defined run orders with the user defined ones.

Example return value:

{
foo: { before: ['bar'] },
baz: { after: ['boo', 'bom'] }
}
Build up a hash of plugin instance execution order overrides . This hash will only container an entry for instances that should run in a particular order . All other instances will be ordered by their natural ordering .