Skip to content

Commit

Permalink
update: format and remove some not used files (#553)
Browse files Browse the repository at this point in the history
update: format and remove some not used files
  • Loading branch information
inhere committed Jan 6, 2020
2 parents 1fc37a0 + 9e07ccd commit b57fc12
Show file tree
Hide file tree
Showing 49 changed files with 228 additions and 1,730 deletions.
24 changes: 19 additions & 5 deletions Makefile
Expand Up @@ -16,17 +16,31 @@ help:
update:
git checkout . && git pull

installcli: ## Install the swoft releasecli tool from github
installcli:
cd ~
git clone https://github.com/swoftlabs/swoft-releasecli
cd swoft-releasecli; \
ln -s $PWD/bin/releasecli /usr/local/bin/releasecli; \
chmod a+x bin/releasecli

updatecli: ## Update the swoft releasecli tool from github
updatecli:
cd ~/swoft-releasecli; \
git pull; \
chmod a+x bin/releasecli

addrmt: ## Add the remote repository address of each component to the local remote
addrmt:
php dtool.php git:addrmt --all
addrmt: update
releasecli git:addrmt --all

fpush: ## Push all update to remote sub-repo by git push with '--force'
fpush:
php dtool.php git:fpush --all
fpush: update
releasecli git:fpush --all

release: ## Release all sub-repo to new tag version and push to remote repo. eg: tag=v2.0.3
release:
php dtool.php tag:release --all -y -t $(TAG)
releasecli tag:release --all -y -t $(TAG)

sami: ## Gen classes docs by sami.phar
classdoc:
Expand Down
7 changes: 6 additions & 1 deletion README.md
@@ -1,6 +1,7 @@
# Swoft Component

[![Actions Status](https://github.com/swoft-cloud/swoft-component/workflows/Unit-tests/badge.svg)](https://github.com/swoft-cloud/swoft-component/actions)
[![Build Status](https://travis-ci.org/swoft-cloud/swoft-component.svg?branch=master)](https://travis-ci.org/swoft-cloud/swoft-component)


This repository is used to manage all swoft core components.
Expand All @@ -23,7 +24,7 @@ Add require to `composer.json`

Install:

```json
```bash
composer update
```

Expand Down Expand Up @@ -60,6 +61,10 @@ phpdbg -dauto_globals_jit=Off -qrr /usr/local/bin/phpunit --coverage-text
phpdbg -dauto_globals_jit=Off -qrr run.php --coverage-text -c src/event/phpunit.xml
```

## Releases

Please see https://github.com/swoftlabs/swoft-releasecli

## Document

- [中文文档](https://www.swoft.org/docs)
Expand Down
19 changes: 13 additions & 6 deletions README.zh-CN.md
@@ -1,28 +1,31 @@
# Swoft Component

[![Actions Status](https://github.com/swoft-cloud/swoft-component/workflows/Unit-tests/badge.svg)](https://github.com/swoft-cloud/swoft-component/actions)
[![Build Status](https://travis-ci.org/swoft-cloud/swoft-component.svg?branch=master)](https://travis-ci.org/swoft-cloud/swoft-component)

这里是swoft基础和核心组件的开发仓库,所有的核心组件都是由这里分发出去的。

## [English](README.md)

## 如何使用

Add require to `composer.json`
添加组件到`composer.json`

```json
"require": {
"swoft/component": "dev-master as 2.0"
}
```

Install:
安装:

```json
```bash
composer update
```

### 单元测试

Quick run tests for component:
快速运行测试:

```bash
// For all components
Expand All @@ -33,7 +36,7 @@ Quick run tests for component:
./phpunit.sh event
```

Only tests an special component:
测试指定的组件:

```bash
./phpunit.sh event
Expand All @@ -43,7 +46,7 @@ php run.php -c src/event/phpunit.xml
php run.php -c src/event/phpunit.xml --filter testAddModule
```

Output coverage data:
输出测试覆盖率:

```bash
// output coverage. require xdebug ext
Expand All @@ -53,6 +56,10 @@ phpdbg -dauto_globals_jit=Off -qrr /usr/local/bin/phpunit --coverage-text
phpdbg -dauto_globals_jit=Off -qrr run.php --coverage-text -c src/event/phpunit.xml
```

## 版本发布

需要使用工具 https://github.com/swoftlabs/swoft-releasecli

## 使用文档

- [中文文档](https://www.swoft.org/docs)
Expand Down
37 changes: 0 additions & 37 deletions dtool.php

This file was deleted.

6 changes: 3 additions & 3 deletions phpunit.xml
Expand Up @@ -13,12 +13,12 @@
stopOnFailure="false">
<testsuites>
<testsuite name="test">
<directory suffix="Test.php">./test/unit</directory>
<directory suffix="Test.php">test/unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/*</directory>
<directory suffix=".php">src/*</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>
59 changes: 38 additions & 21 deletions run.php
Expand Up @@ -19,15 +19,9 @@
* file that was distributed with this source code.
*/
if (version_compare('7.1.0', PHP_VERSION, '>')) {
fwrite(
STDERR,
sprintf(
'This version of PHPUnit is supported on PHP 7.1 and PHP 7.2.' . PHP_EOL .
'You are using PHP %s (%s).' . PHP_EOL,
PHP_VERSION,
PHP_BINARY
)
);
fwrite(STDERR,
sprintf('This version of PHPUnit is supported on PHP 7.1 and PHP 7.2.' . PHP_EOL . 'You are using PHP %s (%s).' . PHP_EOL,
PHP_VERSION, PHP_BINARY));
die(1);
}

Expand All @@ -37,24 +31,19 @@

// add loader file
foreach ([
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'
] as $__loader_file
) {
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'
] as $__loader_file) {
if (file_exists($__loader_file)) {
define('PHPUNIT_COMPOSER_INSTALL', $__loader_file);
break;
}
}

if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
fwrite(
STDERR,
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
' composer install' . PHP_EOL . PHP_EOL .
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
);
fwrite(STDERR,
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL . ' composer install' . PHP_EOL . PHP_EOL . 'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL);
die(1);
}

Expand All @@ -79,6 +68,28 @@

require PHPUNIT_COMPOSER_INSTALL;

// php run.php -c src/websocket-server/phpunit.xml
// SWOFT_TEST_SERVER: http, ws, rpc, tcp
if ($srvType = (string)getenv('SWOFT_TEST_SERVER')) {
// Output: "php is /usr/local/bin/php"
[$ok, $ret,] = \Swoft\Stdlib\Helper\Sys::run('type php');
if (0 !== $ok) {
exit('php not found');
}

$php = substr(trim($ret), 7);
$proc = new \Swoole\Process(function (\Swoole\Process $proc) use ($php) {
// $proc->exec($php, [ $dir . '/test/bin/swoft', 'ws:start');
$proc->exec($php, ['test/bin/swoft', 'ws:start']);
});
$pid = $proc->start();
echo "Swoft server started, PID $pid\n";

// wait server starting...
sleep(2);
echo file_get_contents('http://127.0.0.1:18308/hi');
}

$status = 0;
\Swoft\Co::run(function () {
// Status
Expand All @@ -88,8 +99,14 @@
$status = Command::main(false);
} catch (ExitException $e) {
$status = $e->getCode();
echo 'ExitException: ' .$e->getMessage(), "\n";
echo 'ExitException: ' . $e->getMessage(), "\n";
}
});

if (isset($pid) && $pid > 0) {
echo "Stop server on tests end. PID $pid";
$ok = \Swoole\Process::kill($pid, 15);
echo $ok ? " OK\n" : " FAIL\n";
}

exit($status);

0 comments on commit b57fc12

Please sign in to comment.