Skip to content

Commit

Permalink
Fix composer autoloader loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Hyde committed Jun 23, 2015
1 parent 986a4d2 commit bac97b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/DBSteward/dbsteward.php
Expand Up @@ -14,7 +14,17 @@

define('SQLFORMAT_DIR', __DIR__ . '/sql_format');

require_once __DIR__ . '/../../vendor/autoload.php';
// composer autoloader
if (file_exists($fs[] = $f = __DIR__ . '/../../vendor/autoload.php')) {
// in a dbsteward checkout
require_once $f;
} else if (file_exists($fs[] = $f = __DIR__ . '/../../../../autoload.php')) {
// in a composer install
require_once $f;
} else {
throw new Exception("Cannot find composer autoload file, checked:\n- " . implode("\n- ", $fs));
}

require_once __DIR__ . '/dbx.php';
require_once __DIR__ . '/xml_parser.php';
require_once __DIR__ . '/sql_parser.php';
Expand Down
1 change: 0 additions & 1 deletion tests/bootstrap.php
Expand Up @@ -31,7 +31,6 @@ public function __get($k) {

// set up our database connection instances

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../lib/DBSteward/dbsteward.php';
require_once __DIR__ . '/dbsteward_sql99_connection.php';
require_once __DIR__ . '/dbsteward_pgsql8_connection.php';
Expand Down

0 comments on commit bac97b2

Please sign in to comment.