Skip to content

Commit b934322

Browse files
committed
update changelog
1 parent ef43ea1 commit b934322

File tree

3 files changed

+77
-12
lines changed

3 files changed

+77
-12
lines changed

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
# CHANGELOG
22

3+
## v2.3.2
4+
5+
> publish at: 2018.01.26
6+
7+
- now can disable a controller or command by method `isEnabled()`
8+
- fixed: should not display 'isAlone' command in a controller
9+
- format codes, add more param type define
10+
- some update for process util
11+
- phar compiler can only pack changed files(by git status)
12+
- group/command allow define alias by aliases() in class
13+
- support run command by coroutine, base on swoole.
14+
- update demo classes. add changelog file
15+
- Update README.md
16+
317
## v2.3.1
418

519
- fixed for alone command description message dispaly on use `-h`
620
- add global options for a method help info
721
- method annotation format update
822
- complete phar package tool. add a example controller for pack phar
923
- you can run: `php examples/app phar:pack` to see demo
10-
24+
1125

1226
## v2.3.0
1327

@@ -42,4 +56,4 @@
4256
- add new interactive : `multi` `select`
4357
- Update README.md
4458

45-
## ....
59+
## ....

phar.build.inc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* - the is a config file for compile phar package.
5+
* User: Inhere
6+
* Date: 2018/1/26 0026
7+
* Time: 22:11
8+
* @var \Inhere\Console\Components\PharCompiler $compiler
9+
*/
10+
11+
// config
12+
$compiler
13+
// ->stripComments(false)
14+
->setShebang(true)
15+
->addExclude([
16+
'demo',
17+
'tests',
18+
'tmp',
19+
])
20+
->addFile([
21+
'LICENSE',
22+
'composer.json',
23+
'README.md',
24+
'tests/boot.php',
25+
])
26+
->setCliIndex('examples/app')
27+
// ->setWebIndex('web/index.php')
28+
// ->setVersionFile('config/config.php')
29+
;
30+
31+
// Console 下的 Command Controller 命令类不去除注释,注释上是命令帮助信息
32+
$compiler->setStripFilter(function ($file) {
33+
/** @var \SplFileInfo $file */
34+
$name = $file->getFilename();
35+
36+
return false === strpos($name, 'Command.php') && false === strpos($name, 'Controller.php');
37+
});

src/BuiltIn/PharController.php

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ class PharController extends Controller
2626
* pack project to a phar package
2727
* @usage {fullCommand} [--dir DIR] [--output FILE]
2828
* @options
29-
* --dir STRING Setting the directory for packing.
30-
* - default is current work-dir.(<comment>{workDir}</comment>)
31-
* --fast BOOL Fast build. only add modified files by <cyan>git status -s</cyan>
32-
* --output STRING Setting the output file name(<comment>app.phar</comment>)
33-
* --refresh BOOL Whether build vendor folder files on phar file exists(<comment>False</comment>)
29+
* --dir STRING Setting the project directory for packing.
30+
* - default is current work-dir.(<comment>{workDir}</comment>)
31+
* --fast BOOL Fast build. only add modified files by <cyan>git status -s</cyan>
32+
* -c, --config STRING Use the defined config for build phar.
33+
* --output STRING Setting the output file name(<comment>app.phar</comment>)
34+
* --refresh BOOL Whether build vendor folder files on phar file exists(<comment>False</comment>)
3435
* @param \Inhere\Console\IO\Input $in
3536
* @param \Inhere\Console\IO\Output $out
3637
* @return int
@@ -101,8 +102,21 @@ public function packCommand($in, $out): int
101102
protected function configCompiler(string $dir): PharCompiler
102103
{
103104
// config
104-
$cpr = new PharCompiler($dir);
105-
$cpr
105+
$compiler = new PharCompiler($dir);
106+
107+
// if set config file.
108+
$configFile = $this->input->getSameOpt(['c', 'config']) ?: $dir . '/phar.build.inc';
109+
110+
if ($configFile && is_file($configFile)) {
111+
require $configFile;
112+
113+
$compiler->in($dir);
114+
115+
return $compiler;
116+
}
117+
118+
// you can also extend this controller, then config in the sub-class.
119+
$compiler
106120
// ->stripComments(false)
107121
->setShebang(true)
108122
->addExclude([
@@ -123,14 +137,14 @@ protected function configCompiler(string $dir): PharCompiler
123137
;
124138

125139
// Command Controller 命令类不去除注释,注释上是命令帮助信息
126-
$cpr->setStripFilter(function ($file) {
140+
$compiler->setStripFilter(function ($file) {
127141
/** @var \SplFileInfo $file */
128142
$name = $file->getFilename();
129143

130144
return false === strpos($name, 'Command.php') && false === strpos($name, 'Controller.php');
131145
});
132146

133-
return $cpr;
147+
return $compiler;
134148
}
135149

136150
/**
@@ -174,4 +188,4 @@ public function unpackCommand($in, $out): int
174188

175189
return 0;
176190
}
177-
}
191+
}

0 commit comments

Comments
 (0)