fr3nch13/cakephp-jira

一个用于与 Jira 交互的 CakePHP 4.x 插件。

安装次数: 2,765

依赖者: 0

建议者: 0

安全性: 0

星级: 3

关注者: 2

分支: 0

开放性问题: 1

类型:cakephp-plugin

2.4.3 2023-02-08 00:06 UTC

README

Build Status Total Downloads Latest Stable Version Coverage Status

Build Status Scrutinizer Code Quality Code Coverage Code Intelligence Status

这是一个用于与您的 Jira 服务器交互的 CakePHP 4.x 插件。

此插件大量使用 lesstif/php-jira-rest-client 的项目,本质上是一个针对该项目的 CakePHP 特定包装。

安装

您可以使用 composer 将此插件安装到您的 CakePHP 应用程序中。

运行以下命令(可能会根据您的 composer 安装方式有所不同)

composer require fr3nch13/cakephp-jira

或者将以下内容添加到您的 composer.json 文件中

{
    "require": {
        "fr3nch13/cakephp-jira": "^2.0"
    }
}

然后运行

composer update

设置

在您的 src/Application.phpbootstrap() 方法中添加以下内容

/**
 * Bootstrap function for browser-based access.
 *
 * @return void
 */
public function bootstrap()
{
    /**
     * Load stuff needed from the cakephp core.
     */
    parent::bootstrap();

    // .... other code here.

    /**
     * Load all of the plugins you need.
     */
    $this->addPlugin('Fr3nch13/Jira');

    // .... other code here.
}

在您的 src/View/AppView.phpinitialize() 方法中加载辅助函数

    /**
     * Initialize method
     *
     * @return void
     */
    public function initialize()
    {
        parent::initialize();

        // .... other code here.

        if (Plugin::isLoaded('Fr3nch13/Jira')) {
            $this->loadHelper('Jira', ['className' => 'Fr3nch13/Jira.Jira']);
        }

        // .... other code here.
    }

此插件使用 josegonzalez/dotenv。如果您使用他的扩展,请在您的 config/.env 文件中添加以下内容

##### Jira Settings. (if the JIRA plugin is active.)
export JIRA_SCHEMA=""
## name: Protocol
## desc: The protocol that the Jira server uses. Either http, or https
## default: https
## type: select
## options: {"http": "http", "https": "https"}
export JIRA_HOST=""
## name: Hostname
## desc: The full hostname to the Jira server
## default: jira.domain.com
## type: string
export JIRA_USERNAME=''
## name: Username
## desc: The username to use when authenticating with Jira.
## default: jirausername
## type: string
export JIRA_API_KEY=''
## name: API Key
## desc: The API Key to authenticate with Jira.
## default: jiraapikey
## type: string
export JIRA_PROJECT_KEY=''
## name: Project Key
## desc: The Key of the Project in Jira that represents this app.
## default: jiraprojectkey
## type: string

此插件 src/Plugin.phpbootstrap() 将自动读取这些配置到 Cakephp 的 Configure 静态类中。

如果您不使用 dotenv,则将其添加到您的 config/app.php 文件中

/// ... previous settings.
    'Jira' => [
        'schema' => 'https',
        'host' => 'jira.domain.com',
        'username' => 'your-jira-username',
        'apiKey' => 'you-jira-username-or-api-key',
        'projectKey' => 'your-project-key', // The code before the issue id ex: PROJECT-81, it would be PROJECT.
    ]
/// ... more settings.

用法

主要的入口点是 Jira 辅助函数。

我还添加了将问题发送到您的 Jira 服务器的功能。

默认/预配置的问题有 Bug 和功能请求,但您也可以配置自己的。

要创建自己的问题设置,请参考以下示例

在我特定的例子中,我将在应用程序标题中的下拉菜单部分添加链接。我的应用程序使用 AdmilLte/bootstrap 模板/前端,因此如果您想的话,可以像这样包含现有的元素

<?php if (Plugin::isLoaded('Fr3nch13/Jira')) : ?>
<?= $this->element('Fr3nch13/Jira.nav-links') ?>
<?php endif; //Plugin::isLoaded('Fr3nch13/Jira') ?>

如果您想查看我如何创建页面链接,请参阅 templates/element/nav-links.php 文件。

如果您想覆盖插件模板,请按照 CakePHP 文档 中的说明进行。

版本兼容性

主版本与 CakePHP 的主版本锁定。

  • Jira 1.x 锁定到 CakePHP ^3.8
  • Jira 2.x 锁定到 CakePHP ^4.0

贡献

规则很简单

  • 新功能需要测试。
  • 所有测试都必须通过。
    composer ci
  • 每个 PR 1 个功能

我们将很高兴合并您的功能。

备注

  • 我已包含 composer.lock 文件,如果您是分叉/拉取请求,则应使用它/更新它。这样我们的环境尽可能接近。这有助于调试/重现问题。