Issues with PSR-0 in hook_cron after hours trying to solve this issue by myself and searching for solutions in Google I thought that maybe someone may already faced this.

Scenario:
I am running drush site-install
The installation goes well until it hits a hook_cron (don't really know why) and tries to instantiate a a class. If I run drush cron on an installed site it works as a charm as is only when I am installing the site that this happens.

I use PSR-0 to bootstrap the namespaces and the implementation looks much like this:

/**
 * Implements hook_boot().
 */
function MY_MODULE_boot() {
  //Autoload classes PSR-0
  $namespaces = array(
    'COMPANY\MY_MODULE'     =&gt; array(__DIR__ . '/lib'),
  );
  MY_MODULE_register_class_namespace($namespaces);
}

/**
 * Registers a class namespace with the Composer autoloader
 *
 * @param  array  $namespaces
 */
function MY_MODULE_register_class_namespace(array $namespaces = array()){
  static $loader = null;
  if (!$loader) {
    $loader = require_once realpath('.') . '/vendor/autoload.php';
  }

  foreach ($namespaces as $namespace =&gt; $namespace_path) {
    $loader-&gt;add($namespace, $namespace_path);
  }
}


This is the error I get in the console:

Drush command terminated abnormally due to an unrecoverable error.                                                                                              [error]
Error: Class 'COMPANY\MY_MODULE\Repository\MYCLASSRepository' not found in
&lt;path to module&gt;, line 588


I would really appreciate any help with this one.
Thanks in advance and sorry about my English.
Apparently there is an issue with the way Drupal bootstraps when doing a fresh install. I solved the issue by adding a call to: 

module_invoke_all('boot');


Hope it helps you if you come up with the same issue.