Skip to content

Commit

Permalink
修正composer安装,完善console模式
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Mar 28, 2016
1 parent 1cb86e4 commit fd2c58b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 14 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ www WEB部署目录(或者子目录)
│ ├─mode 应用模式目录
│ ├─tpl 系统模板目录
│ ├─tests 单元测试文件目录
│ ├─vendor 第三方类库目录
│ ├─base.php 基础定义文件
│ ├─convention.php 框架惯例配置文件
│ ├─helper.php 助手函数文件
│ ├─phpunit.xml phpunit配置文件
│ └─start.php 框架入口文件
├─extend 扩展类库目录
├─vendor 第三方类库目录(Composer依赖库)
~~~

> router.php用于php自带webserver支持,可用于快速测试
Expand Down
8 changes: 4 additions & 4 deletions base.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
// 系统常量
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
defined('THINK_PATH') or define('THINK_PATH', dirname(__FILE__) . DS);
defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS);
defined('ROOT_PATH') or define('ROOT_PATH', dirname(APP_PATH) . DS);
defined('LIB_PATH') or define('LIB_PATH', THINK_PATH . 'library' . DS);
defined('EXTEND_PATH') or define('EXTEND_PATH', THINK_PATH . 'extend' . DS);
defined('EXTEND_PATH') or define('EXTEND_PATH', ROOT_PATH . 'extend' . DS);
defined('MODE_PATH') or define('MODE_PATH', THINK_PATH . 'mode' . DS); // 系统应用模式目录
defined('CORE_PATH') or define('CORE_PATH', LIB_PATH . 'think' . DS);
defined('TRAIT_PATH') or define('TRAIT_PATH', LIB_PATH . 'traits' . DS);
defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS);
defined('ROOT_PATH') or define('ROOT_PATH', dirname(APP_PATH) . DS);
defined('APP_NAMESPACE') or define('APP_NAMESPACE', 'app');
defined('COMMON_MODULE') or define('COMMON_MODULE', 'common');
defined('RUNTIME_PATH') or define('RUNTIME_PATH', ROOT_PATH . 'runtime' . DS);
defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH . 'log' . DS);
defined('CACHE_PATH') or define('CACHE_PATH', RUNTIME_PATH . 'cache' . DS);
defined('TEMP_PATH') or define('TEMP_PATH', RUNTIME_PATH . 'temp' . DS);
defined('VENDOR_PATH') or define('VENDOR_PATH', THINK_PATH . 'vendor' . DS);
defined('VENDOR_PATH') or define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS);
defined('EXT') or define('EXT', '.php');
defined('MODEL_LAYER') or define('MODEL_LAYER', 'model');
defined('VIEW_LAYER') or define('VIEW_LAYER', 'view');
Expand Down
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "topthink/framework",
"description": "the new thinkphp framework",
"type": "thinkphp-framework",
"keywords": ["framework", "thinkphp", "ORM"],
"type": "think-framework",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
Expand All @@ -12,7 +16,8 @@
}
],
"require": {
"php": ">=5.4.0"
"php": ">=5.4.0",
"topthink/think-installer": "*"
},
"require-dev": {
"johnkary/phpunit-speedtrap": "^1.0",
Expand All @@ -21,5 +26,6 @@
"phpunit/phpunit": "4.8.*",
"sebastian/phpcpd": "*",
"squizlabs/php_codesniffer": "2.*"
}
},
"minimum-stability": "dev"
}
2 changes: 0 additions & 2 deletions extend/.gitignore

This file was deleted.

3 changes: 2 additions & 1 deletion mode/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
],
// 别名定义
'alias' => [
'think\Error' => MODE_PATH . 'console/Error' . EXT,
'think\App' => MODE_PATH . 'console/App' . EXT,
'think\Error' => MODE_PATH . 'console/Error' . EXT
],
// 配置文件
'config' => [
Expand Down
43 changes: 43 additions & 0 deletions mode/console/App.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <[email protected]>
// +----------------------------------------------------------------------

namespace think;


use think\Console;

class App
{
/**
* 执行应用程序
* @access public
* @return void
*/
public static function run()
{
// 实例化console
$console = new Console('Think Console', '0.1');
// 读取指令集
if (is_file(APP_PATH . 'command' . EXT)) {
$commands = include APP_PATH . 'command' . EXT;
if (is_array($commands)) {
foreach ($commands as $command) {
if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) {
// 注册指令
$console->add(new $command());
}
}
}
}
// 运行
$console->run();
}
}
2 changes: 0 additions & 2 deletions vendor/.gitignore

This file was deleted.

0 comments on commit fd2c58b

Please sign in to comment.