"use strict";

/*!
 * Module dependencies.
 */

var dummy
  , hotplate = require('hotplate')
;


exports.getAllStores = hotplate.cachable( function( done ){
  
  var res = {
    stores: {},
    collections: {},
  };

  hotplate.hotEvents.emit( 'stores', function( err, results){

    results.forEach( function( element ) {
      element.result.forEach( function( Store ){

        try {
         var store = new Store();
        } catch ( e ){
          hotplate.log("AN ERROR HAPPENED WHILE INSTANCING A STORE: " );
          hotplate.log( e );
          hotplate.log( element );
          hotplate.log( Store );
        }

        // If the store was created (no exception thrown...)
        if( store ){

           // Add the module to the store registry
           res.stores[ store.storeName ] = { Store: Store, storeObject: store };

          // Add the module to the collection registry
          if( store.collectionName ){
            res.collections[ store.collectionName ] = res.collections[ store.collectionName ] || [];
            res.collections[ store.collectionName ].push( { Store: Store, storeObject: store }  );
          }

        }

      });
      
    });
    done( null, res );
  });

});




"use strict";

/*!
 * Module dependencies.
 */

var dummy
  , hotplate = require('hotplate')
;


exports.getAllStores = hotplate.cachable( function( done ){
  
  var res = {
    stores: {},
    collections: {},
  };

  hotplate.hotEvents.emit( 'stores', function( err, results){

    results.forEach( function( element ) {

      Object.keys( element.result ).forEach( function( k ){

        var Store = element.result[ k ];

        try {
         var store = new Store();
        } catch ( e ){
          hotplate.log("AN ERROR HAPPENED WHILE INSTANCING A STORE: " );
          hotplate.log( e );
          hotplate.log( element );
          hotplate.log( Store );
        }

        // If the store was created (no exception thrown...)
        if( store ){

           // Add the module to the store registry
           res.stores[ store.storeName ] = { Store: Store, storeObject: store };

          // Add the module to the collection registry
          if( store.collectionName ){
            res.collections[ store.collectionName ] = res.collections[ store.collectionName ] || [];
            res.collections[ store.collectionName ].push( { Store: Store, storeObject: store }  );
          }

        }

      });
      
    });
    done( null, res );
  });

});




Change way in which storeRegistry expects stores to be returned, it's now a hash
Change way in which storeRegistry expects stores to be returned, it's now a hash
