Browse Source

tested command

mx 3 years ago
parent
commit
9e2a49624e
6 changed files with 116 additions and 2 deletions
  1. 1 0
      .gitignore
  2. 5 0
      README.md
  3. 37 0
      app/command/TestTestCommand.php
  4. 2 1
      composer.json
  5. 53 1
      composer.lock
  6. 18 0
      config/plugin/webman/console/app.php

+ 1 - 0
.gitignore

@@ -3,5 +3,6 @@
 /vendor
 *.log
 .env
+/webman
 /tests/tmp
 /tests/.phpunit.result.cache

+ 5 - 0
README.md

@@ -53,3 +53,8 @@ NOTICE
 1. run `vendor/bin/phpunit --bootstrap support/bootstrap.php tests/TestConnection.php`
 2. change code in `tests/TestConnection.php`
 3. run again
+
+### Command
+
+see [official doc](https://www.workerman.net/doc/webman/plugin/console.html)
+

+ 37 - 0
app/command/TestTestCommand.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace app\command;
+
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Output\OutputInterface;
+
+
+class TestTestCommand extends Command
+{
+    protected static $defaultName = 'test:test';
+    protected static $defaultDescription = 'test test';
+
+    /**
+     * @return void
+     */
+    protected function configure()
+    {
+        $this->addArgument('name', InputArgument::OPTIONAL, 'Name description');
+    }
+
+    /**
+     * @param InputInterface $input
+     * @param OutputInterface $output
+     * @return int
+     */
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        $name = $input->getArgument('name');
+        $output->writeln('Hello test:test');
+        return self::SUCCESS;
+    }
+
+}

+ 2 - 1
composer.json

@@ -32,7 +32,8 @@
     "illuminate/events": "^8.83",
     "robmorgan/phinx": "^0.12.10",
     "illuminate/redis": "^8.83",
-    "symfony/cache": "^5.4"
+    "symfony/cache": "^5.4",
+    "webman/console": "^1.0"
   },
   "suggest": {
     "ext-event": "For better performance. "

+ 53 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "a1c118fec00a7396b7279dc75e09b1bf",
+    "content-hash": "1a5c089f6890394e174e43150171a25f",
     "packages": [
         {
             "name": "cakephp/core",
@@ -2997,6 +2997,58 @@
             ],
             "time": "2022-01-24T18:55:24+00:00"
         },
+        {
+            "name": "webman/console",
+            "version": "v1.0.24",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/webman-php/console.git",
+                "reference": "e4ff8b4d669ac02bf975b98d5d00ccd652967c23"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/webman-php/console/zipball/e4ff8b4d669ac02bf975b98d5d00ccd652967c23",
+                "reference": "e4ff8b4d669ac02bf975b98d5d00ccd652967c23",
+                "shasum": ""
+            },
+            "require": {
+                "symfony/console": ">=5.0"
+            },
+            "require-dev": {
+                "workerman/webman": "^1.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Webman\\Console\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "walkor",
+                    "email": "walkor@workerman.net",
+                    "homepage": "http://www.workerman.net",
+                    "role": "Developer"
+                }
+            ],
+            "description": "Webman console",
+            "homepage": "http://www.workerman.net",
+            "keywords": [
+                "webman console"
+            ],
+            "support": {
+                "email": "walkor@workerman.net",
+                "forum": "http://www.workerman.net/questions",
+                "issues": "https://github.com/webman-php/console/issues",
+                "source": "https://github.com/webman-php/console",
+                "wiki": "http://www.workerman.net/doc/webman"
+            },
+            "time": "2022-03-25T02:01:45+00:00"
+        },
         {
             "name": "workerman/webman-framework",
             "version": "v1.3.6",

+ 18 - 0
config/plugin/webman/console/app.php

@@ -0,0 +1,18 @@
+<?php
+return [
+    'enable'            => true,
+
+    'phar_file_output_dir'    => BASE_PATH . DIRECTORY_SEPARATOR . 'build',
+
+    'phar_filename'     => 'webman.phar',
+
+    'signature_algorithm'=> Phar::SHA256, //set the signature algorithm for a phar and apply it. The signature algorithm must be one of Phar::MD5, Phar::SHA1, Phar::SHA256, Phar::SHA512, or Phar::OPENSSL.
+
+    'private_key_file'  => '', // The file path for certificate or OpenSSL private key file.
+
+    'exclude_pattern'   => '#^(?!.*(config/plugin/webman/console/app.php|webman/console/src/Commands/(PharPackCommand.php|ReloadCommand.php)|LICENSE|composer.json|.github|.idea|doc|docs|.git|.setting|runtime|test|test_old|tests|Tests|vendor-bin|.md))(.*)$#',
+
+    'exclude_files'     => [
+        '.env', 'LICENSE', 'composer.json', 'composer.lock','start.php'
+    ]
+];