Skip to content

Commit

Permalink
up: update composer lock and update script
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jul 24, 2022
1 parent e082447 commit cf00393
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 24 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#SHELL = /bin/sh
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明
# mac 下这条声明 没起作用 !!
.RECIPEPREFIX = >
# .RECIPEPREFIX = >
.PHONY: all usage help clean

# 需要注意的是,每行命令在一个单独的shell中执行。这些Shell之间没有继承关系。
Expand Down Expand Up @@ -36,6 +36,12 @@ install: ## Clean all created artifacts
clean: ## Clean all created artifacts
git clean --exclude=.idea/ -fdx

up-dev-deps: ## Update all kite dev depends on vendor
$(SHELL) script/update-kite-deps.sh

up-dev-deps: ## Update kite composer.lock and all depends on vendor
$(SHELL) script/upinit-kite-dev-deps.sh

phar: ## build kite application to phar package
php -d phar.readonly=0 bin/kite phar:pack -o kite.phar

Expand Down
40 changes: 20 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions script/mycmd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
// kite mycmd.php
// kite mycmd.php [opts] [args]

use Toolkit\Cli\Cli;
use Toolkit\PFlag\CliCmd;
use Toolkit\PFlag\FlagsParser;


// load kite boot file, allow use all class in the kite.
$kiteBootFile = getenv('KITE_BOOT_FILE');
if (!$kiteBootFile || !is_file($kiteBootFile)) {
throw new RuntimeException("kite boot file is not exists", 1);
}

echo "... load kite boot file: ", $kiteBootFile, "\n\n";
require $kiteBootFile;

// can use toolkit/pflag, more please see https://github.com/php-toolkit/pflag

CliCmd::new()
->config(function (CliCmd $cmd) {
$cmd->name = 'cgen';
$cmd->desc = 'quickly generate a blog or doc markdown file';

// config flags
$cmd->options = [
'i,interactive' => 'bool;interactive set config',
't,tpl-file' => 'the tempalte file;;',
];
// or use property
// $cmd->arguments = [...];
})
// ->withArguments([
// 'arg1' => 'this is arg1, is string'
// ])
->setHandler('handle_func')
->run();

function handle_func(FlagsParser $fs)
{
Cli::info("hello");
vdump(
$fs->getScriptFile() . implode(' ', $fs->getFlags()),
$fs->getOpts()
);
}
19 changes: 16 additions & 3 deletions script/update-kite-deps.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
#!/usr/bin/env bash
#
# - update composer.lock
# - update all depends package
#

# run: kite run --proxy update-kite-deps.sh
# run: bash script/update-kite-deps.sh

set -e
#tmpKiteDir=~/Workspace/my-github/inhere/kite
# windows
tmpKiteDir=/f/work/php/inhere/kite-tmp

osName=$(uname -s)
usrKiteDir=~/.kite

# macOS
if [ "$osName" == "Darwin" ]; then
tmpKiteDir=~/Workspace/my-github/inhere/kite
# windows: MINGW64_NT-10.0-19043
elif [ "${osName:0:5}" == "MINGW" ]; then
tmpKiteDir=/f/work/php/inhere/kite-tmp
else
tmpKiteDir=/tmp/kite-tmp
fi

set -x
#kite env prox
cd $tmpKiteDir || exit 2
Expand Down
4 changes: 4 additions & 0 deletions script/upinit-kite-dev-deps.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash
#
# each dev packages and run composer update
#
#

# run: kite run --proxy upinit-kite-dev-deps.sh
# run: bash script/upinit-kite-dev-deps.sh
Expand Down

0 comments on commit cf00393

Please sign in to comment.