Skip to content

Commit

Permalink
up: update some for custom dir, update jenkins lib
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 17, 2022
1 parent ddece39 commit 5925a4c
Show file tree
Hide file tree
Showing 17 changed files with 326 additions and 159 deletions.
4 changes: 2 additions & 2 deletions app/Concern/InitApplicationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Inhere\Kite\Common\GitAPI\GitHubV3API;
use Inhere\Kite\Common\GitAPI\GitLabV4API;
use Inhere\Kite\Kite;
use Inhere\Kite\Lib\Jenkins\JenkinsClient;
use Inhere\Kite\Lib\Jenkins\JenkinsFactory;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use PhpPkg\Config\ConfigBox;
Expand Down Expand Up @@ -129,7 +129,7 @@ protected function registerComServices(ObjectBox $box): void

$box->set('jenkins', function () {
$config = $this->config()->getArray('jenkins');
return new JenkinsClient($config);
return new JenkinsFactory($config);
});
}

Expand Down
4 changes: 3 additions & 1 deletion app/Helper/KiteUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@
*/
class KiteUtil
{

public const NL_CHAR = 'NL';
public const TAB_CHAR = 'TAB';
public const SPACE_CHAR = 'SPACE';

public const STDIN_ALIAS = [
'@i',
'@si',
'@stdin',
'stdin',
];

public const STDOUT_ALIAS = [
'@o',
'@so',
'@stdout',
'stdout',
];
Expand Down
7 changes: 3 additions & 4 deletions app/Kite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
namespace Inhere\Kite;

use BadMethodCallException;
use Composer\Autoload\ClassLoader;
use Inhere\Kite\Component\ScriptRunner;
use Inhere\Kite\Concern\StaticPathAliasTrait;
use Inhere\Kite\Console\CliApplication;
use Inhere\Kite\Console\Component\AutoSetProxyEnv;
use Inhere\Kite\Console\Plugin\PluginManager;
use Inhere\Kite\Http\WebApplication;
use Inhere\Kite\Lib\Jenkins\JenkinsClient;
use Inhere\Kite\Lib\Jenkins\JenkinsFactory;
use Inhere\Kite\Lib\Jump\QuickJump;
use Inhere\Route\Dispatcher\Dispatcher;
use Inhere\Route\Router;
Expand All @@ -39,7 +38,7 @@
* @method static Router webRouter()
* @method static Dispatcher dispatcher()
* @method static ScriptRunner scriptRunner()
* @method static JenkinsClient jenkins()
* @method static JenkinsFactory jenkins()
*
* @see Kite::__callStatic() for quick get object
*/
Expand Down Expand Up @@ -76,7 +75,7 @@ class Kite
*/
private static WebApplication $webApp;

/**
/*
* @var ClassLoader
*/
// public static ClassLoader $loader;
Expand Down
130 changes: 0 additions & 130 deletions app/Lib/Jenkins/JenkinsClient.php

This file was deleted.

59 changes: 59 additions & 0 deletions app/Lib/Jenkins/JenkinsConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php declare(strict_types=1);

namespace Inhere\Kite\Lib\Jenkins;

use Toolkit\Stdlib\Obj\AbstractObj;

/**
* class JenkinsConfig
*
* @author inhere
* @date 2022/11/16
*/
class JenkinsConfig extends AbstractObj
{
/**
* @var string
*/
public string $hostUrl = '';

/**
* Jenkins username
*
* @var string
*/
public string $username = '';

/**
* Jenkins user password
*
* @var string
*/
public string $password = '';

/**
* @var string
*/
public string $apiToken = '';

/**
* @param string $jobName
*
* @return string
*/
public function jobPageUrl(string $jobName): string
{
return $this->hostUrl . '/job/' . $jobName;
}

/**
* @param string $viewName
*
* @return string
*/
public function viewPageUrl(string $viewName): string
{
return $this->hostUrl . '/view/' . $viewName;
}

}
Loading

0 comments on commit 5925a4c

Please sign in to comment.