Skip to content

Commit

Permalink
增加 Composer 的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
breath-co2 committed Aug 30, 2013
1 parent 8d362bc commit cc756dd
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ Icon?
/config.php
/debug.config.php
/data/*
/manual/html/zh-cn/*
/manual/html/zh-cn/*
/libraries/autoload.php
/libraries/composer/*
/composer.lock
17 changes: 17 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "myqee/myqee",
"description": "The MyQEE PHP Framework",
"version": "3.0.1-dev",
"keywords": ["myqee", "framework"],
"authors": [
{
"name": "jonwang",
"email": "[email protected]",
"homepage": "http://www.queyang.com/"
}
],
"config": {
"vendor-dir" : "libraries",
"bin-dir" : "bin"
}
}
28 changes: 27 additions & 1 deletion core/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,34 @@ public static function setup($auto_execute = true)
{
$run = true;

# PHP5.3 支持 composer 的加载
if (HAVE_NS && is_file(DIR_LIBRARY .'autoload.php'))
{
try
{
require DIR_LIBRARY .'autoload.php';
}
catch (Exception $e)
{
self::_show_error($e->getMessage());
}

$composer = true;
}
else
{
$composer = false;
}

/**
* 是否加载了Composer
*
* @var boolean
*/
define('IS_COMPOSER_LOADED', $composer);

# 注册自动加载类
spl_autoload_register(array('Bootstrap', 'auto_load'));
spl_autoload_register(array('Bootstrap', 'auto_load'), true, true);

# 读取配置
if (!is_file(DIR_SYSTEM .'config'. EXT))
Expand Down
21 changes: 21 additions & 0 deletions core/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "myqee/myqee",
"description": "MyQEE Core for Composer",
"keywords": ["MyQEE", "framework"],
"homepage": "http://www.myqee.com/",
"type": "library",
"license": "Apache-2.0",
"authors": [
{
"name": "jonwang",
"email": "[email protected]",
"homepage": "http://www.queyang.com/"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": {"MyQEE\\Core": "src/"}
}
}
1 change: 1 addition & 0 deletions libraries/myqee/myqee
File renamed without changes.

0 comments on commit cc756dd

Please sign in to comment.